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