]>
Commit | Line | Data |
---|---|---|
6762286d | 1 | ///////////////////////////////////////////////////////////////////////////// |
233f5738 | 2 | // Name: wx/osx/mdi.h |
6762286d SC |
3 | // Purpose: MDI (Multiple Document Interface) classes. |
4 | // Author: Stefan Csomor | |
5 | // Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes | |
6 | // Created: 1998-01-01 | |
6762286d SC |
7 | // Copyright: (c) Stefan Csomor |
8 | // (c) 2008 Vadim Zeitlin | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_OSX_CARBON_MDI_H_ | |
13 | #define _WX_OSX_CARBON_MDI_H_ | |
14 | ||
15 | class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase | |
16 | { | |
17 | public: | |
18 | wxMDIParentFrame() { Init(); } | |
19 | wxMDIParentFrame(wxWindow *parent, | |
20 | wxWindowID id, | |
21 | const wxString& title, | |
22 | const wxPoint& pos = wxDefaultPosition, | |
23 | const wxSize& size = wxDefaultSize, | |
24 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
25 | const wxString& name = wxFrameNameStr) | |
26 | { | |
27 | Init(); | |
28 | Create(parent, id, title, pos, size, style, name); | |
29 | } | |
30 | ||
31 | bool Create(wxWindow *parent, | |
32 | wxWindowID id, | |
33 | const wxString& title, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
37 | const wxString& name = wxFrameNameStr); | |
38 | ||
39 | virtual ~wxMDIParentFrame(); | |
40 | ||
41 | // implement/override base class [pure] virtuals | |
42 | // --------------------------------------------- | |
43 | ||
44 | static bool IsTDI() { return false; } | |
45 | ||
46 | virtual void AddChild(wxWindowBase *child); | |
47 | virtual void RemoveChild(wxWindowBase *child); | |
48 | ||
49 | virtual void ActivateNext() { /* TODO */ } | |
50 | virtual void ActivatePrevious() { /* TODO */ } | |
51 | ||
52 | virtual bool Show(bool show = true); | |
53 | ||
54 | ||
55 | // Mac-specific implementation from now on | |
56 | // --------------------------------------- | |
57 | ||
58 | // Mac OS activate event | |
59 | virtual void MacActivate(long timestamp, bool activating); | |
60 | ||
61 | // wxWidgets activate event | |
62 | void OnActivate(wxActivateEvent& event); | |
63 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
64 | ||
65 | void SetMenuBar(wxMenuBar *menu_bar); | |
66 | ||
67 | // Get rect to be used to center top-level children | |
68 | virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); | |
69 | ||
70 | protected: | |
71 | // common part of all ctors | |
72 | void Init(); | |
73 | ||
74 | // returns true if this frame has some contents and so should be visible, | |
75 | // false if it's used solely as container for its children | |
76 | bool ShouldBeVisible() const; | |
77 | ||
78 | ||
79 | wxMenu *m_windowMenu; | |
80 | ||
81 | // true if MDI Frame is intercepting commands, not child | |
82 | bool m_parentFrameActive; | |
83 | ||
84 | // true if the frame should be shown but is not because it is empty and | |
85 | // useless otherwise than a container for its children | |
86 | bool m_shouldBeShown; | |
87 | ||
88 | private: | |
89 | friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; | |
90 | ||
91 | DECLARE_EVENT_TABLE() | |
92 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) | |
93 | }; | |
94 | ||
95 | class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase | |
96 | { | |
97 | public: | |
98 | wxMDIChildFrame() { Init(); } | |
99 | wxMDIChildFrame(wxMDIParentFrame *parent, | |
100 | wxWindowID id, | |
101 | const wxString& title, | |
102 | const wxPoint& pos = wxDefaultPosition, | |
103 | const wxSize& size = wxDefaultSize, | |
104 | long style = wxDEFAULT_FRAME_STYLE, | |
105 | const wxString& name = wxFrameNameStr) | |
106 | { | |
107 | Init() ; | |
108 | Create(parent, id, title, pos, size, style, name); | |
109 | } | |
110 | ||
111 | bool Create(wxMDIParentFrame *parent, | |
112 | wxWindowID id, | |
113 | const wxString& title, | |
114 | const wxPoint& pos = wxDefaultPosition, | |
115 | const wxSize& size = wxDefaultSize, | |
116 | long style = wxDEFAULT_FRAME_STYLE, | |
117 | const wxString& name = wxFrameNameStr); | |
118 | ||
119 | virtual ~wxMDIChildFrame(); | |
120 | ||
121 | // un-override the base class override | |
122 | virtual bool IsTopLevel() const { return true; } | |
123 | ||
124 | // implement MDI operations | |
125 | virtual void Activate(); | |
126 | ||
127 | ||
128 | // Mac OS activate event | |
129 | virtual void MacActivate(long timestamp, bool activating); | |
130 | ||
131 | protected: | |
132 | // common part of all ctors | |
133 | void Init(); | |
134 | ||
135 | DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) | |
136 | }; | |
137 | ||
138 | class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase | |
139 | { | |
140 | public: | |
141 | wxMDIClientWindow() { } | |
142 | virtual ~wxMDIClientWindow(); | |
143 | ||
144 | virtual bool CreateClient(wxMDIParentFrame *parent, | |
145 | long style = wxVSCROLL | wxHSCROLL); | |
146 | ||
147 | protected: | |
148 | virtual void DoGetClientSize(int *width, int *height) const; | |
149 | ||
150 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) | |
151 | }; | |
152 | ||
153 | #endif // _WX_OSX_CARBON_MDI_H_ |