]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/mdi.h
reintroducing direct access, cleanup
[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
17#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18#pragma interface "mdi.h"
19#endif
20
21#include "wx/frame.h"
22
23WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
24WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
25
26class WXDLLEXPORT wxMDIClientWindow;
27class WXDLLEXPORT wxMDIChildFrame;
28
29class WXDLLEXPORT wxMDIParentFrame: public wxFrame
30{
31 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
32
33public:
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
77ffb593 60 // wxWidgets activate event
8cf73271
SC
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; };
0bba37f5
DE
71 // Get rect to be used to center top-level children
72 virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
8cf73271
SC
73
74 // Create the client window class (don't Create the window,
75 // just return a new class)
76 virtual wxMDIClientWindow *OnCreateClient() ;
77
78 // MDI operations
79 virtual void Cascade();
80 virtual void Tile();
81 virtual void ArrangeIcons();
82 virtual void ActivateNext();
83 virtual void ActivatePrevious();
84
29e92efb
VZ
85 virtual bool Show( bool show = true );
86
8cf73271
SC
87protected:
88
89 // TODO maybe have this member
90 wxMDIClientWindow *m_clientWindow;
91 wxMDIChildFrame * m_currentChild;
92 wxMenu* m_windowMenu;
93
94 // TRUE if MDI Frame is intercepting commands, not child
95 bool m_parentFrameActive;
96
97private:
98 friend class WXDLLEXPORT wxMDIChildFrame;
99DECLARE_EVENT_TABLE()
100};
101
102class WXDLLEXPORT wxMDIChildFrame: public wxFrame
103{
104DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
105public:
106
107 wxMDIChildFrame();
108 inline wxMDIChildFrame(wxMDIParentFrame *parent,
109 wxWindowID id,
110 const wxString& title,
111 const wxPoint& pos = wxDefaultPosition,
112 const wxSize& size = wxDefaultSize,
113 long style = wxDEFAULT_FRAME_STYLE,
114 const wxString& name = wxFrameNameStr)
115 {
116 Init() ;
117 Create(parent, id, title, pos, size, style, name);
118 }
119
120 ~wxMDIChildFrame();
121
122 bool Create(wxMDIParentFrame *parent,
123 wxWindowID id,
124 const wxString& title,
125 const wxPoint& pos = wxDefaultPosition,
126 const wxSize& size = wxDefaultSize,
127 long style = wxDEFAULT_FRAME_STYLE,
128 const wxString& name = wxFrameNameStr);
129
130 // Mac OS activate event
131 virtual void MacActivate(long timestamp, bool activating);
132
133 // Set menu bar
134 void SetMenuBar(wxMenuBar *menu_bar);
135
136 // MDI operations
137 virtual void Maximize();
138 virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
139 virtual void Restore();
140 virtual void Activate();
141protected:
142
143 // common part of all ctors
144 void Init();
145};
146
147/* The client window is a child of the parent MDI frame, and itself
148 * contains the child MDI frames.
149 * However, you create the MDI children as children of the MDI parent:
150 * only in the implementation does the client window become the parent
151 * of the children. Phew! So the children are sort of 'adopted'...
152 */
153
154class WXDLLEXPORT wxMDIClientWindow: public wxWindow
155{
156 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
157 public:
158
159 wxMDIClientWindow() ;
160 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
161 {
162 CreateClient(parent, style);
163 }
164
165 ~wxMDIClientWindow();
166
167 // Note: this is virtual, to allow overridden behaviour.
168 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
169
170 // Gets the size available for subwindows after menu size, toolbar size
171 // and status bar size have been subtracted. If you want to manage your own
172 // toolbar(s), don't call SetToolBar.
173 void DoGetClientSize(int *width, int *height) const;
174
175 // Explicitly call default scroll behaviour
176 void OnScroll(wxScrollEvent& event);
177
178protected:
179
180DECLARE_EVENT_TABLE()
181};
182
183#endif
184 // _WX_MDI_H_