]>
Commit | Line | Data |
---|---|---|
fb896a32 DE |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/toplevel.h | |
3 | // Purpose: wxTopLevelWindowCocoa is the Cocoa implementation of wxTLW | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2002/12/08 | |
39050120 | 7 | // RCS-ID: $Id$ |
fb896a32 | 8 | // Copyright: (c) 2002 David Elliott |
39050120 | 9 | // Licence: wxWindows licence |
fb896a32 DE |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __WX_COCOA_TOPLEVEL_H__ | |
13 | #define __WX_COCOA_TOPLEVEL_H__ | |
14 | ||
15 | #include "wx/hashmap.h" | |
16 | #include "wx/cocoa/NSWindow.h" | |
17 | ||
33faea0a DE |
18 | class WXDLLEXPORT wxMenuBar; |
19 | ||
fb896a32 DE |
20 | // ======================================================================== |
21 | // wxTopLevelWindowCocoa | |
22 | // ======================================================================== | |
23 | class WXDLLEXPORT wxTopLevelWindowCocoa : public wxTopLevelWindowBase, protected wxCocoaNSWindow | |
24 | { | |
fb896a32 | 25 | DECLARE_EVENT_TABLE(); |
acbf9534 | 26 | DECLARE_NO_COPY_CLASS(wxTopLevelWindowCocoa); |
fb896a32 DE |
27 | // ------------------------------------------------------------------------ |
28 | // initialization | |
29 | // ------------------------------------------------------------------------ | |
30 | public: | |
31 | inline wxTopLevelWindowCocoa() { Init(); } | |
32 | ||
33 | inline wxTopLevelWindowCocoa(wxWindow *parent, | |
34 | wxWindowID winid, | |
35 | const wxString& title, | |
36 | const wxPoint& pos = wxDefaultPosition, | |
37 | const wxSize& size = wxDefaultSize, | |
38 | long style = wxDEFAULT_FRAME_STYLE, | |
39 | const wxString& name = wxFrameNameStr) | |
40 | { | |
41 | Init(); | |
42 | Create(parent, winid, title, pos, size, style, name); | |
43 | } | |
44 | ||
45 | bool Create(wxWindow *parent, | |
46 | wxWindowID winid, | |
47 | const wxString& title, | |
48 | const wxPoint& pos = wxDefaultPosition, | |
49 | const wxSize& size = wxDefaultSize, | |
50 | long style = wxDEFAULT_FRAME_STYLE, | |
51 | const wxString& name = wxFrameNameStr); | |
52 | ||
53 | virtual ~wxTopLevelWindowCocoa(); | |
54 | ||
55 | protected: | |
56 | // common part of all ctors | |
57 | void Init(); | |
58 | ||
59 | // ------------------------------------------------------------------------ | |
60 | // Cocoa specifics | |
61 | // ------------------------------------------------------------------------ | |
62 | public: | |
63 | inline WX_NSWindow GetNSWindow() { return m_cocoaNSWindow; } | |
9692f42b | 64 | virtual void CocoaDelegate_windowWillClose(void); |
aa992c59 DE |
65 | virtual bool CocoaDelegate_windowShouldClose(void); |
66 | virtual void CocoaDelegate_windowDidBecomeKey(void); | |
67 | virtual void CocoaDelegate_windowDidResignKey(void); | |
33faea0a DE |
68 | virtual void CocoaDelegate_windowDidBecomeMain(void); |
69 | virtual void CocoaDelegate_windowDidResignMain(void); | |
8ded703d | 70 | virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); |
39050120 | 71 | static void DeactivatePendingWindow(); |
fb896a32 DE |
72 | protected: |
73 | void SetNSWindow(WX_NSWindow cocoaNSWindow); | |
74 | WX_NSWindow m_cocoaNSWindow; | |
75 | static wxCocoaNSWindowHash sm_cocoaHash; | |
448cbf1d | 76 | virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView); |
080c7d56 | 77 | static unsigned int NSWindowStyleForWxStyle(long style); |
fb896a32 | 78 | |
39050120 | 79 | static wxTopLevelWindowCocoa *sm_cocoaDeactivateWindow; |
fb896a32 DE |
80 | // ------------------------------------------------------------------------ |
81 | // Implementation | |
82 | // ------------------------------------------------------------------------ | |
83 | public: | |
39050120 | 84 | virtual bool Destroy(); |
fb896a32 DE |
85 | // Pure virtuals |
86 | virtual void Maximize(bool maximize = true); | |
87 | virtual bool IsMaximized() const; | |
88 | virtual void Iconize(bool iconize = true); | |
89 | virtual bool IsIconized() const; | |
90 | virtual void Restore(); | |
91 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
92 | virtual bool IsFullScreen() const; | |
93 | // other | |
94 | virtual bool Show( bool show = true ); | |
95 | virtual bool Close( bool force = false ); | |
96 | virtual void OnCloseWindow(wxCloseEvent& event); | |
e08efb8d | 97 | virtual void CocoaSetWxWindowSize(int width, int height); |
fb896a32 DE |
98 | virtual void DoMoveWindow(int x, int y, int width, int height); |
99 | virtual void DoGetSize(int *width, int *height) const; | |
100 | virtual void DoGetPosition(int *x, int *y) const; | |
101 | ||
102 | ||
103 | // Things I may/may not do | |
104 | // virtual void SetIcon(const wxIcon& icon); | |
105 | // virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); } | |
106 | // virtual void Clear() ; | |
107 | // virtual void Raise(); | |
108 | // virtual void Lower(); | |
109 | // virtual void SetTitle( const wxString& title); | |
110 | protected: | |
111 | // is the frame currently iconized? | |
112 | bool m_iconized; | |
113 | // has the frame been closed | |
114 | bool m_closed; | |
115 | // should the frame be maximized when it will be shown? set by Maximize() | |
116 | // when it is called while the frame is hidden | |
117 | bool m_maximizeOnShow; | |
118 | }; | |
119 | ||
120 | // list of all frames and modeless dialogs | |
121 | extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows; | |
122 | ||
123 | #endif // __WX_COCOA_TOPLEVEL_H__ |