2005-06-15 01:28:56 +04:00
|
|
|
/*
|
2007-10-16 00:13:55 +04:00
|
|
|
* Copyright 2001-2007, Haiku.
|
2005-06-15 01:28:56 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Erik Jaesler (erik@cgsoftware.com)
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _APPLICATION_H
|
|
|
|
#define _APPLICATION_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <AppDefs.h> // For convenience
|
|
|
|
#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:
|
|
|
|
BApplication(const char* signature);
|
2006-04-26 00:12:06 +04:00
|
|
|
BApplication(const char* signature, status_t* error);
|
2002-07-09 16:24:59 +04:00
|
|
|
virtual ~BApplication();
|
|
|
|
|
|
|
|
// Archiving
|
|
|
|
BApplication(BMessage* data);
|
|
|
|
static BArchivable* Instantiate(BMessage* data);
|
|
|
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
|
|
|
// App control and System Message handling
|
|
|
|
virtual thread_id Run();
|
|
|
|
virtual void Quit();
|
|
|
|
virtual bool QuitRequested();
|
|
|
|
virtual void Pulse();
|
|
|
|
virtual void ReadyToRun();
|
|
|
|
virtual void MessageReceived(BMessage* msg);
|
|
|
|
virtual void ArgvReceived(int32 argc, char** argv);
|
|
|
|
virtual void AppActivated(bool active);
|
2002-07-26 23:40:51 +04:00
|
|
|
virtual void RefsReceived(BMessage* message);
|
2002-07-09 16:24:59 +04:00
|
|
|
virtual void AboutRequested();
|
|
|
|
|
|
|
|
// Scripting
|
|
|
|
virtual BHandler* ResolveSpecifier(BMessage* msg,
|
|
|
|
int32 index,
|
|
|
|
BMessage* specifier,
|
|
|
|
int32 form,
|
|
|
|
const char* property);
|
|
|
|
|
|
|
|
// Cursor control, window/looper list, and app info
|
|
|
|
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();
|
|
|
|
|
2002-07-26 23:40:51 +04:00
|
|
|
virtual void DispatchMessage(BMessage* message,
|
2002-07-09 16:24:59 +04:00
|
|
|
BHandler* handler);
|
|
|
|
void SetPulseRate(bigtime_t rate);
|
|
|
|
|
|
|
|
// More scripting
|
|
|
|
virtual status_t GetSupportedSuites(BMessage* data);
|
|
|
|
|
|
|
|
|
2006-03-18 17:43:29 +03:00
|
|
|
// Private or reserved
|
2002-07-09 16:24:59 +04:00
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
|
|
|
|
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;
|
|
|
|
|
2005-06-28 16:55:16 +04:00
|
|
|
BApplication(const char* signature, bool initGUI,
|
|
|
|
status_t* error);
|
2002-07-09 16:24:59 +04:00
|
|
|
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();
|
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
virtual bool ScriptReceived(BMessage* msg, int32 index,
|
|
|
|
BMessage* specifier, int32 form,
|
|
|
|
const char* property);
|
2006-03-18 17:43:29 +03:00
|
|
|
void _InitData(const char* signature, bool initGUI,
|
2005-06-28 16:55:16 +04:00
|
|
|
status_t* error);
|
2002-07-09 16:24:59 +04:00
|
|
|
void BeginRectTracking(BRect r, bool trackWhole);
|
|
|
|
void EndRectTracking();
|
2006-03-18 17:43:29 +03:00
|
|
|
status_t _SetupServerAllocator();
|
2005-06-28 16:55:16 +04:00
|
|
|
status_t _InitGUIContext();
|
2006-03-18 17:43:29 +03:00
|
|
|
status_t _ConnectToServer();
|
|
|
|
/* void send_drag( BMessage* msg,
|
2002-07-09 16:24:59 +04:00
|
|
|
int32 vs_token,
|
|
|
|
BPoint offset,
|
|
|
|
BRect drag_rect,
|
|
|
|
BHandler* reply_to);
|
|
|
|
void send_drag( BMessage* msg,
|
|
|
|
int32 vs_token,
|
|
|
|
BPoint offset,
|
|
|
|
int32 bitmap_token,
|
|
|
|
drawing_mode dragMode,
|
|
|
|
BHandler* reply_to);
|
|
|
|
void write_drag(_BSession_* session, BMessage* a_message);
|
2006-03-18 17:43:29 +03:00
|
|
|
*/ bool _QuitAllWindows(bool force);
|
|
|
|
bool _WindowQuitLoop(bool quitFilePanels, bool force);
|
|
|
|
void _ArgvReceived(BMessage* message);
|
2005-06-15 02:12:32 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
uint32 InitialWorkspace();
|
2006-03-18 17:43:29 +03:00
|
|
|
int32 _CountWindows(bool includeMenus) const;
|
|
|
|
BWindow* _WindowAt(uint32 index, bool includeMenus) const;
|
|
|
|
|
2005-11-30 20:56:56 +03:00
|
|
|
static BResources* sAppResources;
|
|
|
|
static BLocker sAppResourcesLock;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
const char* fAppName;
|
2005-06-15 01:28:56 +04:00
|
|
|
BPrivate::PortLink* fServerLink;
|
2006-03-18 17:43:29 +03:00
|
|
|
BPrivate::ServerMemoryAllocator* fServerAllocator;
|
2005-06-15 02:12:32 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
void* fCursorData;
|
|
|
|
bigtime_t fPulseRate;
|
|
|
|
uint32 fInitialWorkspace;
|
2006-03-18 17:43:29 +03:00
|
|
|
//_drag_data_* fDraggedMessage;
|
2002-07-09 16:24:59 +04:00
|
|
|
BMessageRunner* fPulseRunner;
|
|
|
|
status_t fInitError;
|
2006-04-26 00:12:06 +04:00
|
|
|
void* fServerReadOnlyMemory;
|
|
|
|
uint32 _reserved[12];
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
bool fReadyToRunCalled;
|
|
|
|
};
|
|
|
|
|
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
|