2005-06-15 01:28:56 +04:00
|
|
|
/*
|
2009-12-01 10:58:45 +03:00
|
|
|
* Copyright 2001-2009, Haiku Inc.
|
2005-06-15 01:28:56 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _APPLICATION_H
|
|
|
|
#define _APPLICATION_H
|
|
|
|
|
|
|
|
|
2009-12-01 10:58:45 +03:00
|
|
|
#include <AppDefs.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <InterfaceDefs.h>
|
|
|
|
#include <Looper.h>
|
|
|
|
#include <Messenger.h>
|
|
|
|
#include <Point.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BCursor;
|
|
|
|
class BList;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BLocker;
|
2002-07-09 16:24:59 +04:00
|
|
|
class BMessageRunner;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BResources;
|
2005-06-28 18:53:29 +04:00
|
|
|
class BServer;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BWindow;
|
|
|
|
struct app_info;
|
2005-06-15 01:28:56 +04:00
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
class PortLink;
|
2006-03-18 17:43:29 +03:00
|
|
|
class ServerMemoryAllocator;
|
2005-06-15 01:28:56 +04:00
|
|
|
}
|
2003-03-23 21:53:33 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
class BApplication : public BLooper {
|
|
|
|
public:
|
2009-12-01 10:58:45 +03:00
|
|
|
BApplication(const char* signature);
|
|
|
|
BApplication(const char* signature,
|
|
|
|
status_t* error);
|
|
|
|
virtual ~BApplication();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// Archiving
|
2009-12-01 10:58:45 +03:00
|
|
|
BApplication(BMessage* data);
|
|
|
|
static BArchivable* Instantiate(BMessage* data);
|
|
|
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2009-12-01 10:58:45 +03:00
|
|
|
status_t InitCheck() const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// App control and System Message handling
|
2009-12-01 10:58:45 +03:00
|
|
|
virtual thread_id Run();
|
|
|
|
virtual void Quit();
|
|
|
|
virtual bool QuitRequested();
|
|
|
|
virtual void Pulse();
|
|
|
|
virtual void ReadyToRun();
|
|
|
|
virtual void MessageReceived(BMessage* message);
|
|
|
|
virtual void ArgvReceived(int32 argc, char** argv);
|
|
|
|
virtual void AppActivated(bool active);
|
|
|
|
virtual void RefsReceived(BMessage* message);
|
|
|
|
virtual void AboutRequested();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// Scripting
|
2009-12-01 10:58:45 +03:00
|
|
|
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
|
|
|
BMessage* specifier, int32 form,
|
|
|
|
const char* property);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// Cursor control, window/looper list, and app info
|
2009-12-01 10:58:45 +03:00
|
|
|
void ShowCursor();
|
|
|
|
void HideCursor();
|
|
|
|
void ObscureCursor();
|
|
|
|
bool IsCursorHidden() const;
|
|
|
|
void SetCursor(const void* cursor);
|
|
|
|
void SetCursor(const BCursor* cursor,
|
|
|
|
bool sync = true);
|
|
|
|
|
|
|
|
int32 CountWindows() const;
|
|
|
|
BWindow* WindowAt(int32 index) const;
|
|
|
|
|
|
|
|
int32 CountLoopers() const;
|
|
|
|
BLooper* LooperAt(int32 index) const;
|
|
|
|
bool IsLaunching() const;
|
|
|
|
status_t GetAppInfo(app_info* info) const;
|
|
|
|
static BResources* AppResources();
|
|
|
|
|
|
|
|
virtual void DispatchMessage(BMessage* message,
|
|
|
|
BHandler* handler);
|
|
|
|
void SetPulseRate(bigtime_t rate);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
// More scripting
|
2009-12-01 10:58:45 +03:00
|
|
|
virtual status_t GetSupportedSuites(BMessage* data);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
|
2006-03-18 17:43:29 +03:00
|
|
|
// Private or reserved
|
2009-12-01 10:58:45 +03:00
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2005-07-03 20:53:59 +04:00
|
|
|
class Private;
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
private:
|
|
|
|
typedef BLooper _inherited;
|
|
|
|
|
2005-06-28 16:55:16 +04:00
|
|
|
friend class Private;
|
2005-06-28 18:53:29 +04:00
|
|
|
friend class BServer;
|
|
|
|
|
2009-12-01 10:58:45 +03:00
|
|
|
BApplication(const char* signature, bool initGUI,
|
|
|
|
status_t* error);
|
|
|
|
BApplication(uint32 signature);
|
|
|
|
BApplication(const BApplication&);
|
|
|
|
BApplication& operator=(const BApplication&);
|
|
|
|
|
|
|
|
virtual void _ReservedApplication1();
|
|
|
|
virtual void _ReservedApplication2();
|
|
|
|
virtual void _ReservedApplication3();
|
|
|
|
virtual void _ReservedApplication4();
|
|
|
|
virtual void _ReservedApplication5();
|
|
|
|
virtual void _ReservedApplication6();
|
|
|
|
virtual void _ReservedApplication7();
|
|
|
|
virtual void _ReservedApplication8();
|
|
|
|
|
|
|
|
virtual bool ScriptReceived(BMessage* msg, int32 index,
|
|
|
|
BMessage* specifier, int32 form,
|
|
|
|
const char* property);
|
|
|
|
void _InitData(const char* signature, bool initGUI,
|
|
|
|
status_t* error);
|
|
|
|
void BeginRectTracking(BRect r, bool trackWhole);
|
|
|
|
void EndRectTracking();
|
|
|
|
status_t _SetupServerAllocator();
|
|
|
|
status_t _InitGUIContext();
|
|
|
|
status_t _ConnectToServer();
|
|
|
|
bool _QuitAllWindows(bool force);
|
|
|
|
bool _WindowQuitLoop(bool quitFilePanels, bool force);
|
|
|
|
void _ArgvReceived(BMessage* message);
|
|
|
|
|
|
|
|
uint32 InitialWorkspace();
|
|
|
|
int32 _CountWindows(bool includeMenus) const;
|
|
|
|
BWindow* _WindowAt(uint32 index, bool includeMenus) const;
|
|
|
|
|
|
|
|
static void _InitAppResources();
|
2009-11-30 14:54:30 +03:00
|
|
|
|
|
|
|
private:
|
2009-12-01 10:58:45 +03:00
|
|
|
static BResources* sAppResources;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2009-12-01 10:58:45 +03:00
|
|
|
const char* fAppName;
|
|
|
|
BPrivate::PortLink* fServerLink;
|
2006-03-18 17:43:29 +03:00
|
|
|
BPrivate::ServerMemoryAllocator* fServerAllocator;
|
2005-06-15 02:12:32 +04:00
|
|
|
|
2009-12-01 10:58:45 +03:00
|
|
|
void* fCursorData;
|
|
|
|
bigtime_t fPulseRate;
|
|
|
|
uint32 fInitialWorkspace;
|
|
|
|
BMessageRunner* fPulseRunner;
|
|
|
|
status_t fInitError;
|
|
|
|
void* fServerReadOnlyMemory;
|
2010-11-18 01:19:09 +03:00
|
|
|
uint32 _reserved[12];
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2009-12-01 10:58:45 +03:00
|
|
|
bool fReadyToRunCalled;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
2005-06-15 02:12:32 +04:00
|
|
|
// Global Objects
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
extern BApplication* be_app;
|
|
|
|
extern BMessenger be_app_messenger;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
#endif // _APPLICATION_H
|