]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/mdi.h
warning for 2.5.3
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 #pragma interface "mdi.h"
19 #endif
20
21 #include "wx/frame.h"
22
23 WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
24 WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
25
26 class WXDLLEXPORT wxMDIClientWindow;
27 class WXDLLEXPORT wxMDIChildFrame;
28
29 class WXDLLEXPORT wxMDIParentFrame: public wxFrame
30 {
31 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
32
33 public:
34
35 wxMDIParentFrame();
36 inline wxMDIParentFrame(wxWindow *parent,
37 wxWindowID id,
38 const wxString& title,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
42 const wxString& name = wxFrameNameStr)
43 {
44 Create(parent, id, title, pos, size, style, name);
45 }
46
47 ~wxMDIParentFrame();
48
49 bool Create(wxWindow *parent,
50 wxWindowID id,
51 const wxString& title,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
55 const wxString& name = wxFrameNameStr);
56
57 // Mac OS activate event
58 virtual void MacActivate(long timestamp, bool activating);
59
60 // wxWidgets activate event
61 void OnActivate(wxActivateEvent& event);
62 void OnSysColourChanged(wxSysColourChangedEvent& event);
63
64 void SetMenuBar(wxMenuBar *menu_bar);
65
66 // Get the active MDI child window (Windows only)
67 wxMDIChildFrame *GetActiveChild() const ;
68
69 // Get the client window
70 inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
71
72 // Create the client window class (don't Create the window,
73 // just return a new class)
74 virtual wxMDIClientWindow *OnCreateClient() ;
75
76 // MDI operations
77 virtual void Cascade();
78 virtual void Tile();
79 virtual void ArrangeIcons();
80 virtual void ActivateNext();
81 virtual void ActivatePrevious();
82
83 virtual bool Show( bool show = true );
84
85 protected:
86
87 // TODO maybe have this member
88 wxMDIClientWindow *m_clientWindow;
89 wxMDIChildFrame * m_currentChild;
90 wxMenu* m_windowMenu;
91
92 // TRUE if MDI Frame is intercepting commands, not child
93 bool m_parentFrameActive;
94
95 private:
96 friend class WXDLLEXPORT wxMDIChildFrame;
97 DECLARE_EVENT_TABLE()
98 };
99
100 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
101 {
102 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
103 public:
104
105 wxMDIChildFrame();
106 inline wxMDIChildFrame(wxMDIParentFrame *parent,
107 wxWindowID id,
108 const wxString& title,
109 const wxPoint& pos = wxDefaultPosition,
110 const wxSize& size = wxDefaultSize,
111 long style = wxDEFAULT_FRAME_STYLE,
112 const wxString& name = wxFrameNameStr)
113 {
114 Init() ;
115 Create(parent, id, title, pos, size, style, name);
116 }
117
118 ~wxMDIChildFrame();
119
120 bool Create(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 // Mac OS activate event
129 virtual void MacActivate(long timestamp, bool activating);
130
131 // Set menu bar
132 void SetMenuBar(wxMenuBar *menu_bar);
133
134 // MDI operations
135 virtual void Maximize();
136 virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
137 virtual void Restore();
138 virtual void Activate();
139 protected:
140
141 // common part of all ctors
142 void Init();
143 };
144
145 /* The client window is a child of the parent MDI frame, and itself
146 * contains the child MDI frames.
147 * However, you create the MDI children as children of the MDI parent:
148 * only in the implementation does the client window become the parent
149 * of the children. Phew! So the children are sort of 'adopted'...
150 */
151
152 class WXDLLEXPORT wxMDIClientWindow: public wxWindow
153 {
154 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
155 public:
156
157 wxMDIClientWindow() ;
158 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
159 {
160 CreateClient(parent, style);
161 }
162
163 ~wxMDIClientWindow();
164
165 // Note: this is virtual, to allow overridden behaviour.
166 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
167
168 // Gets the size available for subwindows after menu size, toolbar size
169 // and status bar size have been subtracted. If you want to manage your own
170 // toolbar(s), don't call SetToolBar.
171 void DoGetClientSize(int *width, int *height) const;
172
173 // Explicitly call default scroll behaviour
174 void OnScroll(wxScrollEvent& event);
175
176 protected:
177
178 DECLARE_EVENT_TABLE()
179 };
180
181 #endif
182 // _WX_MDI_H_