]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/toplevel.h
eb8996a4cd8b8f7a904bf1ce72f13a94dc902e43
[wxWidgets.git] / include / wx / cocoa / toplevel.h
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 {
23 DECLARE_EVENT_TABLE();
24 DECLARE_NO_COPY_CLASS(wxTopLevelWindowCocoa);
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 CocoaNotification_DidBecomeKey(void);
65 virtual void CocoaNotification_DidResignKey(void);
66 protected:
67 void SetNSWindow(WX_NSWindow cocoaNSWindow);
68 WX_NSWindow m_cocoaNSWindow;
69 static wxCocoaNSWindowHash sm_cocoaHash;
70 virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
71
72 // ------------------------------------------------------------------------
73 // Implementation
74 // ------------------------------------------------------------------------
75 public:
76 // Pure virtuals
77 virtual void Maximize(bool maximize = true);
78 virtual bool IsMaximized() const;
79 virtual void Iconize(bool iconize = true);
80 virtual bool IsIconized() const;
81 virtual void Restore();
82 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
83 virtual bool IsFullScreen() const;
84 // other
85 virtual bool Show( bool show = true );
86 virtual bool Close( bool force = false );
87 virtual void OnCloseWindow(wxCloseEvent& event);
88 virtual void CocoaSetWxWindowSize(int width, int height);
89 virtual void DoMoveWindow(int x, int y, int width, int height);
90 virtual void DoGetSize(int *width, int *height) const;
91 virtual void DoGetPosition(int *x, int *y) const;
92
93
94 // Things I may/may not do
95 // virtual void SetIcon(const wxIcon& icon);
96 // virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
97 // virtual void Clear() ;
98 // virtual void Raise();
99 // virtual void Lower();
100 // virtual void SetTitle( const wxString& title);
101 protected:
102 // is the frame currently iconized?
103 bool m_iconized;
104 // has the frame been closed
105 bool m_closed;
106 // should the frame be maximized when it will be shown? set by Maximize()
107 // when it is called while the frame is hidden
108 bool m_maximizeOnShow;
109 };
110
111 // list of all frames and modeless dialogs
112 extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
113
114 #endif // __WX_COCOA_TOPLEVEL_H__