]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/app.h
don't draw borders for bitmap buttons with wxBORDER_NONE style
[wxWidgets.git] / include / wx / osx / app.h
CommitLineData
6762286d
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: app.h
3// Purpose: wxApp class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_APP_H_
13#define _WX_APP_H_
14
15#include "wx/defs.h"
16#include "wx/object.h"
17#include "wx/gdicmn.h"
18#include "wx/event.h"
19
20class WXDLLIMPEXP_FWD_CORE wxFrame;
21class WXDLLIMPEXP_FWD_CORE wxWindowMac;
22class WXDLLIMPEXP_FWD_CORE wxApp ;
23class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
24class WXDLLIMPEXP_FWD_BASE wxLog;
25
26// Force an exit from main loop
27void WXDLLIMPEXP_CORE wxExit();
28
29// Yield to other apps/messages
30bool WXDLLIMPEXP_CORE wxYield();
31
32// Represents the application. Derive OnInit and declare
33// a new App object to start application
34class WXDLLIMPEXP_CORE wxApp: public wxAppBase
35{
36 DECLARE_DYNAMIC_CLASS(wxApp)
37
38 wxApp();
39 virtual ~wxApp() {}
40
6762286d
SC
41 virtual void WakeUpIdle();
42
43 virtual void SetPrintMode(int mode) { m_printMode = mode; }
44 virtual int GetPrintMode() const { return m_printMode; }
45
46 // calling OnInit with an auto-release pool ready ...
47 virtual bool CallOnInit();
48#if wxUSE_GUI
49 // setting up all MacOS Specific Event-Handlers etc
50 virtual bool OnInitGui();
51#endif // wxUSE_GUI
52
53 virtual bool ProcessIdle();
54
55 // implementation only
56 void OnIdle(wxIdleEvent& event);
57 void OnEndSession(wxCloseEvent& event);
58 void OnQueryEndSession(wxCloseEvent& event);
59
60protected:
61 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
62
63public:
64
65 static bool sm_isEmbedded;
66 // Implementation
67 virtual bool Initialize(int& argc, wxChar **argv);
68 virtual void CleanUp();
69
70 // the installed application event handler
71 WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
72 WXEVENTHANDLERREF MacGetCurrentEventHandlerCallRef() { return m_macCurrentEventHandlerCallRef ; }
73 void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler )
74 { m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; }
75
76 // adding a CFType object to be released only at the end of the current event cycle (increases the
77 // refcount of the object passed), needed in case we are in the middle of an event concering an object
78 // we want to delete and cannot do it immediately
79 // TODO change semantics to be in line with cocoa (make autrelease NOT increase the count)
80 void MacAddToAutorelease( void* cfrefobj );
81public:
82 static wxWindow* s_captureWindow ;
83 static long s_lastModifiers ;
84
85 int m_nCmdShow;
86
87private:
88 // mac specifics
89 virtual bool DoInitGui();
d48b06bd 90 virtual void DoCleanUp();
6762286d
SC
91
92 WXEVENTHANDLERREF m_macEventHandler ;
93 WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
94 WXEVENTREF m_macCurrentEvent ;
95 CFRunLoopSourceRef m_macEventPosted ;
96
97public:
98 static long s_macAboutMenuItemId ;
99 static long s_macPreferencesMenuItemId ;
100 static long s_macExitMenuItemId ;
101 static wxString s_macHelpMenuTitleName ;
102
103 WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
104
105 // For embedded use. By default does nothing.
106 virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
107
108 bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
109 bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
110 bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
111 void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
112#if wxOSX_USE_CARBON
113 // we only have applescript on these
114 virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
115 virtual short MacHandleAEGURL(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
116 virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
117 virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
118 virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
119 virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
5c6eb3a8 120#endif
6762286d
SC
121 // in response of an open-document apple event
122 virtual void MacOpenFile(const wxString &fileName) ;
123 // in response of a get-url apple event
124 virtual void MacOpenURL(const wxString &url) ;
125 // in response of a print-document apple event
126 virtual void MacPrintFile(const wxString &fileName) ;
127 // in response of a open-application apple event
128 virtual void MacNewFile() ;
129 // in response of a reopen-application apple event
130 virtual void MacReopenApp() ;
131
132 // Hide the application windows the same as the system hide command would do it.
133 void MacHideApp();
134
135 DECLARE_EVENT_TABLE()
136};
137
138#endif
139 // _WX_APP_H_
140