1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/toplevel.h
3 // Purpose: wxTopLevelWindowCocoa is the Cocoa implementation of wxTLW
4 // Author: David Elliott
8 // Copyright: (c) 2002 David Elliott
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_TOPLEVEL_H__
13 #define __WX_COCOA_TOPLEVEL_H__
15 #include "wx/hashmap.h"
16 #include "wx/cocoa/NSWindow.h"
18 // ========================================================================
19 // wxTopLevelWindowCocoa
20 // ========================================================================
21 class WXDLLEXPORT wxTopLevelWindowCocoa
: public wxTopLevelWindowBase
, protected wxCocoaNSWindow
23 DECLARE_EVENT_TABLE();
24 DECLARE_NO_COPY_CLASS(wxTopLevelWindowCocoa
);
25 // ------------------------------------------------------------------------
27 // ------------------------------------------------------------------------
29 inline wxTopLevelWindowCocoa() { Init(); }
31 inline wxTopLevelWindowCocoa(wxWindow
*parent
,
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
)
40 Create(parent
, winid
, title
, pos
, size
, style
, name
);
43 bool Create(wxWindow
*parent
,
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
);
51 virtual ~wxTopLevelWindowCocoa();
54 // common part of all ctors
57 // ------------------------------------------------------------------------
59 // ------------------------------------------------------------------------
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);
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
);
72 // ------------------------------------------------------------------------
74 // ------------------------------------------------------------------------
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;
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;
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);
102 // is the frame currently iconized?
104 // has the frame been 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
;
111 // list of all frames and modeless dialogs
112 extern WXDLLEXPORT_DATA(wxWindowList
) wxModelessWindows
;
114 #endif // __WX_COCOA_TOPLEVEL_H__