2 * Copyright 2001-2015 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
10 #include <InterfaceDefs.h>
12 #include <Messenger.h>
30 class ServerMemoryAllocator
;
34 class BApplication
: public BLooper
{
36 BApplication(const char* signature
);
37 BApplication(const char* signature
,
39 virtual ~BApplication();
42 BApplication(BMessage
* data
);
43 static BArchivable
* Instantiate(BMessage
* data
);
44 virtual status_t
Archive(BMessage
* data
, bool deep
= true) const;
46 status_t
InitCheck() const;
48 // App control and System Message handling
49 virtual thread_id
Run();
51 virtual bool QuitRequested();
53 virtual void ReadyToRun();
54 virtual void MessageReceived(BMessage
* message
);
55 virtual void ArgvReceived(int32 argc
, char** argv
);
56 virtual void AppActivated(bool active
);
57 virtual void RefsReceived(BMessage
* message
);
58 virtual void AboutRequested();
61 virtual BHandler
* ResolveSpecifier(BMessage
* message
, int32 index
,
62 BMessage
* specifier
, int32 form
,
63 const char* property
);
65 // Cursor control, window/looper list, and app info
69 bool IsCursorHidden() const;
70 void SetCursor(const void* cursor
);
71 void SetCursor(const BCursor
* cursor
,
74 int32
CountWindows() const;
75 BWindow
* WindowAt(int32 index
) const;
77 int32
CountLoopers() const;
78 BLooper
* LooperAt(int32 index
) const;
79 bool IsLaunching() const;
80 const char* Signature() const;
81 status_t
GetAppInfo(app_info
* info
) const;
82 static BResources
* AppResources();
84 virtual void DispatchMessage(BMessage
* message
,
86 void SetPulseRate(bigtime_t rate
);
88 // Register a BLooper to be quit before the BApplication
89 // object is destroyed.
90 status_t
RegisterLooper(BLooper
* looper
);
91 status_t
UnregisterLooper(BLooper
* looper
);
94 virtual status_t
GetSupportedSuites(BMessage
* data
);
97 // Private or reserved
98 virtual status_t
Perform(perform_code d
, void* arg
);
103 typedef BLooper _inherited
;
105 friend class Private
;
106 friend class BServer
;
108 BApplication(const char* signature
,
109 const char* looperName
, port_id port
,
110 bool initGUI
, status_t
* error
);
111 BApplication(uint32 signature
);
112 BApplication(const BApplication
&);
113 BApplication
& operator=(const BApplication
&);
115 virtual void _ReservedApplication1();
116 virtual void _ReservedApplication2();
117 virtual void _ReservedApplication3();
118 virtual void _ReservedApplication4();
119 virtual void _ReservedApplication5();
120 virtual void _ReservedApplication6();
121 virtual void _ReservedApplication7();
122 virtual void _ReservedApplication8();
124 virtual bool ScriptReceived(BMessage
* msg
, int32 index
,
125 BMessage
* specifier
, int32 form
,
126 const char* property
);
127 void _InitData(const char* signature
, bool initGUI
,
129 port_id
_GetPort(const char* signature
);
130 void BeginRectTracking(BRect r
, bool trackWhole
);
131 void EndRectTracking();
132 status_t
_SetupServerAllocator();
133 status_t
_InitGUIContext();
134 status_t
_ConnectToServer();
135 void _ReconnectToServer();
136 bool _QuitAllWindows(bool force
);
137 bool _WindowQuitLoop(bool quitFilePanels
,
139 void _ArgvReceived(BMessage
* message
);
141 uint32
InitialWorkspace();
142 int32
_CountWindows(bool includeMenus
) const;
143 BWindow
* _WindowAt(uint32 index
,
144 bool includeMenus
) const;
146 static void _InitAppResources();
149 static BResources
* sAppResources
;
151 const char* fAppName
;
152 ::BPrivate::PortLink
* fServerLink
;
153 ::BPrivate::ServerMemoryAllocator
* fServerAllocator
;
156 bigtime_t fPulseRate
;
157 uint32 fInitialWorkspace
;
158 BMessageRunner
* fPulseRunner
;
160 void* fServerReadOnlyMemory
;
161 uint32 _reserved
[12];
163 bool fReadyToRunCalled
;
169 extern BApplication
* be_app
;
170 extern BMessenger be_app_messenger
;
173 #endif // _APPLICATION_H