]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/mdi.h
use wxString, not wxChar*, in wxDataFormat ctor and SetId() method
[wxWidgets.git] / include / wx / mac / carbon / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mdi.h
3 // Purpose: MDI (Multiple Document Interface) classes.
4 // This doesn't have to be implemented just like Windows,
5 // it could be a tabbed design as in wxGTK.
6 // Author: Stefan Csomor
7 // Modified by:
8 // Created: 1998-01-01
9 // RCS-ID: $Id$
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_MDI_H_
15 #define _WX_MDI_H_
16
17 #include "wx/frame.h"
18
19 WXDLLEXPORT_DATA(extern const wxChar) wxStatusLineNameStr[];
20
21 class WXDLLEXPORT wxMDIClientWindow;
22 class WXDLLEXPORT wxMDIChildFrame;
23
24 class WXDLLEXPORT wxMDIParentFrame: public wxFrame
25 {
26 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
27
28 public:
29
30 wxMDIParentFrame() { Init(); }
31 wxMDIParentFrame(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, // Scrolling refers to client window
37 const wxString& name = wxFrameNameStr)
38 {
39 Init();
40 Create(parent, id, title, pos, size, style, name);
41 }
42
43 virtual ~wxMDIParentFrame();
44
45 bool Create(wxWindow *parent,
46 wxWindowID id,
47 const wxString& title,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
51 const wxString& name = wxFrameNameStr);
52
53 // Mac OS activate event
54 virtual void MacActivate(long timestamp, bool activating);
55
56 // wxWidgets activate event
57 void OnActivate(wxActivateEvent& event);
58 void OnSysColourChanged(wxSysColourChangedEvent& event);
59
60 void SetMenuBar(wxMenuBar *menu_bar);
61
62 // Get the active MDI child window (Windows only)
63 wxMDIChildFrame *GetActiveChild() const ;
64
65 // Get the client window
66 inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
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 // Create the client window class (don't Create the window,
71 // just return a new class)
72 virtual wxMDIClientWindow *OnCreateClient() ;
73
74 // MDI operations
75 virtual void Cascade();
76 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL);
77 virtual void ArrangeIcons();
78 virtual void ActivateNext();
79 virtual void ActivatePrevious();
80
81 virtual bool Show( bool show = true );
82
83 // overridden base clas virtuals
84 virtual void AddChild(wxWindowBase *child);
85 virtual void RemoveChild(wxWindowBase *child);
86
87 protected:
88 // common part of all ctors
89 void Init();
90
91 // returns true if this frame has some contents and so should be visible,
92 // false if it's used solely as container for its children
93 bool ShouldBeVisible() const;
94
95
96 // TODO maybe have this member
97 wxMDIClientWindow *m_clientWindow;
98 wxMDIChildFrame *m_currentChild;
99 wxMenu *m_windowMenu;
100
101 // true if MDI Frame is intercepting commands, not child
102 bool m_parentFrameActive;
103
104 // true if the frame should be shown but is not because it is empty and
105 // useless otherwise than a container for its children
106 bool m_shouldBeShown;
107
108 private:
109 friend class WXDLLEXPORT wxMDIChildFrame;
110 DECLARE_EVENT_TABLE()
111 };
112
113 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
114 {
115 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
116 public:
117
118 wxMDIChildFrame();
119 inline wxMDIChildFrame(wxMDIParentFrame *parent,
120 wxWindowID id,
121 const wxString& title,
122 const wxPoint& pos = wxDefaultPosition,
123 const wxSize& size = wxDefaultSize,
124 long style = wxDEFAULT_FRAME_STYLE,
125 const wxString& name = wxFrameNameStr)
126 {
127 Init() ;
128 Create(parent, id, title, pos, size, style, name);
129 }
130
131 virtual ~wxMDIChildFrame();
132
133 bool Create(wxMDIParentFrame *parent,
134 wxWindowID id,
135 const wxString& title,
136 const wxPoint& pos = wxDefaultPosition,
137 const wxSize& size = wxDefaultSize,
138 long style = wxDEFAULT_FRAME_STYLE,
139 const wxString& name = wxFrameNameStr);
140
141 // Mac OS activate event
142 virtual void MacActivate(long timestamp, bool activating);
143
144 // Set menu bar
145 void SetMenuBar(wxMenuBar *menu_bar);
146
147 // MDI operations
148 virtual void Maximize();
149 virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
150 virtual void Restore();
151 virtual void Activate();
152 protected:
153
154 // common part of all ctors
155 void Init();
156 };
157
158 /* The client window is a child of the parent MDI frame, and itself
159 * contains the child MDI frames.
160 * However, you create the MDI children as children of the MDI parent:
161 * only in the implementation does the client window become the parent
162 * of the children. Phew! So the children are sort of 'adopted'...
163 */
164
165 class WXDLLEXPORT wxMDIClientWindow: public wxWindow
166 {
167 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
168 public:
169
170 wxMDIClientWindow() ;
171 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
172 {
173 CreateClient(parent, style);
174 }
175
176 virtual ~wxMDIClientWindow();
177
178 // Note: this is virtual, to allow overridden behaviour.
179 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
180
181 // Explicitly call default scroll behaviour
182 void OnScroll(wxScrollEvent& event);
183
184 protected:
185 // Gets the size available for subwindows after menu size, toolbar size
186 // and status bar size have been subtracted. If you want to manage your own
187 // toolbar(s), don't call SetToolBar.
188 void DoGetClientSize(int *width, int *height) const;
189
190 DECLARE_EVENT_TABLE()
191 };
192
193 #endif
194 // _WX_MDI_H_