]>
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 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) 2002 David Elliott | |
9 | // Licence: wxWindows license | |
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 | ||
18 | // ======================================================================== | |
19 | // wxTopLevelWindowCocoa | |
20 | // ======================================================================== | |
21 | class WXDLLEXPORT wxTopLevelWindowCocoa : public wxTopLevelWindowBase, protected wxCocoaNSWindow | |
22 | { | |
fb896a32 | 23 | DECLARE_EVENT_TABLE(); |
acbf9534 | 24 | DECLARE_NO_COPY_CLASS(wxTopLevelWindowCocoa); |
fb896a32 DE |
25 | // ------------------------------------------------------------------------ |
26 | // initialization | |
27 | // ------------------------------------------------------------------------ | |
28 | public: | |
29 | inline wxTopLevelWindowCocoa() { Init(); } | |
30 | ||
31 | inline wxTopLevelWindowCocoa(wxWindow *parent, | |
32 | wxWindowID winid, | |
33 | const wxString& title, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | long style = wxDEFAULT_FRAME_STYLE, | |
37 | const wxString& name = wxFrameNameStr) | |
38 | { | |
39 | Init(); | |
40 | Create(parent, winid, title, pos, size, style, name); | |
41 | } | |
42 | ||
43 | bool Create(wxWindow *parent, | |
44 | wxWindowID winid, | |
45 | const wxString& title, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = wxDEFAULT_FRAME_STYLE, | |
49 | const wxString& name = wxFrameNameStr); | |
50 | ||
51 | virtual ~wxTopLevelWindowCocoa(); | |
52 | ||
53 | protected: | |
54 | // common part of all ctors | |
55 | void Init(); | |
56 | ||
57 | // ------------------------------------------------------------------------ | |
58 | // Cocoa specifics | |
59 | // ------------------------------------------------------------------------ | |
60 | public: | |
61 | inline WX_NSWindow GetNSWindow() { return m_cocoaNSWindow; } | |
62 | virtual void Cocoa_close(void); | |
63 | virtual bool Cocoa_windowShouldClose(void); | |
64 | virtual void Cocoa_wxMenuItemAction(wxMenuItem& item); | |
65 | protected: | |
66 | void SetNSWindow(WX_NSWindow cocoaNSWindow); | |
67 | WX_NSWindow m_cocoaNSWindow; | |
68 | static wxCocoaNSWindowHash sm_cocoaHash; | |
448cbf1d | 69 | virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView); |
fb896a32 DE |
70 | |
71 | // ------------------------------------------------------------------------ | |
72 | // Implementation | |
73 | // ------------------------------------------------------------------------ | |
74 | public: | |
75 | // Pure virtuals | |
76 | virtual void Maximize(bool maximize = true); | |
77 | virtual bool IsMaximized() const; | |
78 | virtual void Iconize(bool iconize = true); | |
79 | virtual bool IsIconized() const; | |
80 | virtual void Restore(); | |
81 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
82 | virtual bool IsFullScreen() const; | |
83 | // other | |
84 | virtual bool Show( bool show = true ); | |
85 | virtual bool Close( bool force = false ); | |
86 | virtual void OnCloseWindow(wxCloseEvent& event); | |
e08efb8d | 87 | virtual void CocoaSetWxWindowSize(int width, int height); |
fb896a32 DE |
88 | virtual void DoMoveWindow(int x, int y, int width, int height); |
89 | virtual void DoGetSize(int *width, int *height) const; | |
90 | virtual void DoGetPosition(int *x, int *y) const; | |
91 | ||
92 | ||
93 | // Things I may/may not do | |
94 | // virtual void SetIcon(const wxIcon& icon); | |
95 | // virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); } | |
96 | // virtual void Clear() ; | |
97 | // virtual void Raise(); | |
98 | // virtual void Lower(); | |
99 | // virtual void SetTitle( const wxString& title); | |
100 | protected: | |
101 | // is the frame currently iconized? | |
102 | bool m_iconized; | |
103 | // has the frame been closed | |
104 | bool m_closed; | |
105 | // should the frame be maximized when it will be shown? set by Maximize() | |
106 | // when it is called while the frame is hidden | |
107 | bool m_maximizeOnShow; | |
108 | }; | |
109 | ||
110 | // list of all frames and modeless dialogs | |
111 | extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows; | |
112 | ||
113 | #endif // __WX_COCOA_TOPLEVEL_H__ |