]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/toplevel.h
made wxApp::argv an object convertible to either char** or wchar_t** for better compa...
[wxWidgets.git] / include / wx / cocoa / toplevel.h
CommitLineData
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
65571936 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
b5dbe15d 18class WXDLLIMPEXP_FWD_CORE wxMenuBar;
33faea0a 19
fb896a32
DE
20// ========================================================================
21// wxTopLevelWindowCocoa
22// ========================================================================
23class 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// ------------------------------------------------------------------------
30public:
593b256f
DE
31 inline wxTopLevelWindowCocoa()
32 : wxCocoaNSWindow(this)
33 { Init(); }
fb896a32
DE
34
35 inline wxTopLevelWindowCocoa(wxWindow *parent,
36 wxWindowID winid,
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = wxDEFAULT_FRAME_STYLE,
41 const wxString& name = wxFrameNameStr)
593b256f 42 : wxCocoaNSWindow(this)
fb896a32
DE
43 {
44 Init();
45 Create(parent, winid, title, pos, size, style, name);
46 }
47
48 bool Create(wxWindow *parent,
49 wxWindowID winid,
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxDEFAULT_FRAME_STYLE,
54 const wxString& name = wxFrameNameStr);
55
56 virtual ~wxTopLevelWindowCocoa();
57
58protected:
59 // common part of all ctors
60 void Init();
61
62// ------------------------------------------------------------------------
63// Cocoa specifics
64// ------------------------------------------------------------------------
65public:
66 inline WX_NSWindow GetNSWindow() { return m_cocoaNSWindow; }
9692f42b 67 virtual void CocoaDelegate_windowWillClose(void);
aa992c59
DE
68 virtual bool CocoaDelegate_windowShouldClose(void);
69 virtual void CocoaDelegate_windowDidBecomeKey(void);
70 virtual void CocoaDelegate_windowDidResignKey(void);
33faea0a
DE
71 virtual void CocoaDelegate_windowDidBecomeMain(void);
72 virtual void CocoaDelegate_windowDidResignMain(void);
7dd8b1ea
DE
73 virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem sender);
74 virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem sender);
8ded703d 75 virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
39050120 76 static void DeactivatePendingWindow();
fb896a32
DE
77protected:
78 void SetNSWindow(WX_NSWindow cocoaNSWindow);
79 WX_NSWindow m_cocoaNSWindow;
80 static wxCocoaNSWindowHash sm_cocoaHash;
448cbf1d 81 virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
080c7d56 82 static unsigned int NSWindowStyleForWxStyle(long style);
15f37147 83 static NSRect MakeInitialNSWindowContentRect(const wxPoint& pos, const wxSize& size, unsigned int cocoaStyleMask);
fb896a32 84
39050120 85 static wxTopLevelWindowCocoa *sm_cocoaDeactivateWindow;
fb896a32
DE
86// ------------------------------------------------------------------------
87// Implementation
88// ------------------------------------------------------------------------
89public:
39050120 90 virtual bool Destroy();
fb896a32
DE
91 // Pure virtuals
92 virtual void Maximize(bool maximize = true);
93 virtual bool IsMaximized() const;
94 virtual void Iconize(bool iconize = true);
95 virtual bool IsIconized() const;
96 virtual void Restore();
97 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
98 virtual bool IsFullScreen() const;
99 // other
100 virtual bool Show( bool show = true );
101 virtual bool Close( bool force = false );
102 virtual void OnCloseWindow(wxCloseEvent& event);
e08efb8d 103 virtual void CocoaSetWxWindowSize(int width, int height);
fb896a32
DE
104 virtual void DoMoveWindow(int x, int y, int width, int height);
105 virtual void DoGetSize(int *width, int *height) const;
106 virtual void DoGetPosition(int *x, int *y) const;
8d8d3633
WS
107 virtual void SetTitle( const wxString& title);
108 virtual wxString GetTitle() const;
fb896a32 109
e875c17d
DE
110 // Default button (item)
111 wxWindow *SetDefaultItem(wxWindow *win);
fb896a32
DE
112
113// Things I may/may not do
ea098413 114// virtual void SetIcons(const wxIconBundle& icons);
fb896a32
DE
115// virtual void Clear() ;
116// virtual void Raise();
117// virtual void Lower();
fb896a32
DE
118protected:
119 // is the frame currently iconized?
120 bool m_iconized;
121 // has the frame been closed
122 bool m_closed;
123 // should the frame be maximized when it will be shown? set by Maximize()
124 // when it is called while the frame is hidden
125 bool m_maximizeOnShow;
126};
127
128// list of all frames and modeless dialogs
129extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
130
131#endif // __WX_COCOA_TOPLEVEL_H__