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