]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/mdi.h
Move wxMulDivInt32 to common math.
[wxWidgets.git] / include / wx / gtk1 / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/mdi.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __MDIH__
11 #define __MDIH__
12
13 #include "wx/defs.h"
14 #include "wx/object.h"
15 #include "wx/list.h"
16 #include "wx/control.h"
17 #include "wx/panel.h"
18 #include "wx/frame.h"
19 #include "wx/toolbar.h"
20
21 //-----------------------------------------------------------------------------
22 // classes
23 //-----------------------------------------------------------------------------
24
25 class WXDLLIMPEXP_CORE wxMDIParentFrame;
26 class WXDLLIMPEXP_CORE wxMDIClientWindow;
27 class WXDLLIMPEXP_CORE wxMDIChildFrame;
28
29 //-----------------------------------------------------------------------------
30 // global data
31 //-----------------------------------------------------------------------------
32
33 extern WXDLLIMPEXP_CORE const wxChar* wxFrameNameStr;
34 extern WXDLLIMPEXP_CORE const wxChar* wxStatusLineNameStr;
35
36 //-----------------------------------------------------------------------------
37 // wxMDIParentFrame
38 //-----------------------------------------------------------------------------
39
40 class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
41 {
42 public:
43 wxMDIParentFrame() { Init(); }
44 wxMDIParentFrame(wxWindow *parent,
45 wxWindowID id,
46 const wxString& title,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
50 const wxString& name = wxFrameNameStr)
51 {
52 Init();
53
54 (void)Create(parent, id, title, pos, size, style, name);
55 }
56
57 ~wxMDIParentFrame();
58 bool Create( wxWindow *parent,
59 wxWindowID id,
60 const wxString& title,
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize,
63 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
64 const wxString& name = wxFrameNameStr );
65
66 wxMDIChildFrame *GetActiveChild() const;
67
68 wxMDIClientWindow *GetClientWindow() const;
69 virtual wxMDIClientWindow *OnCreateClient();
70
71 virtual void Cascade() {}
72 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) {}
73 virtual void ArrangeIcons() {}
74 virtual void ActivateNext();
75 virtual void ActivatePrevious();
76
77 // implementation
78
79 wxMDIClientWindow *m_clientWindow;
80 bool m_justInserted;
81
82 virtual void GtkOnSize( int x, int y, int width, int height );
83 virtual void OnInternalIdle();
84
85 protected:
86 void Init();
87
88 virtual void DoGetClientSize(int *width, int *height) const;
89
90 private:
91 friend class wxMDIChildFrame;
92
93 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
94 };
95
96 //-----------------------------------------------------------------------------
97 // wxMDIChildFrame
98 //-----------------------------------------------------------------------------
99
100 class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
101 {
102 public:
103 wxMDIChildFrame();
104 wxMDIChildFrame( wxMDIParentFrame *parent,
105 wxWindowID id,
106 const wxString& title,
107 const wxPoint& pos = wxDefaultPosition,
108 const wxSize& size = wxDefaultSize,
109 long style = wxDEFAULT_FRAME_STYLE,
110 const wxString& name = wxFrameNameStr );
111
112 virtual ~wxMDIChildFrame();
113 bool Create( wxMDIParentFrame *parent,
114 wxWindowID id,
115 const wxString& title,
116 const wxPoint& pos = wxDefaultPosition,
117 const wxSize& size = wxDefaultSize,
118 long style = wxDEFAULT_FRAME_STYLE,
119 const wxString& name = wxFrameNameStr );
120
121 virtual void SetMenuBar( wxMenuBar *menu_bar );
122 virtual wxMenuBar *GetMenuBar() const;
123
124 virtual void AddChild( wxWindowBase *child );
125
126 virtual void Activate();
127
128 #if wxUSE_STATUSBAR
129 // no status bars
130 virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
131 long WXUNUSED(style) = 1,
132 wxWindowID WXUNUSED(id) = 1,
133 const wxString& WXUNUSED(name) = wxEmptyString)
134 { return (wxStatusBar*)NULL; }
135
136 virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
137 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
138 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
139 #endif
140
141 // no size hints
142 virtual void DoSetSizeHints( int WXUNUSED(minW),
143 int WXUNUSED(minH),
144 int WXUNUSED(maxW) = -1,
145 int WXUNUSED(maxH) = -1,
146 int WXUNUSED(incW) = -1,
147 int WXUNUSED(incH) = -1) {}
148
149 #if wxUSE_TOOLBAR
150 // no toolbar
151 virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
152 wxWindowID WXUNUSED(id),
153 const wxString& WXUNUSED(name) )
154 { return (wxToolBar*)NULL; }
155 virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
156 #endif // wxUSE_TOOLBAR
157
158 // no icon
159 virtual void SetIcon(const wxIcon& icon)
160 { wxTopLevelWindowBase::SetIcon(icon); }
161 virtual void SetIcons(const wxIconBundle& icons )
162 { wxTopLevelWindowBase::SetIcons(icons); }
163
164 // no title
165 void SetTitle( const wxString &title );
166 wxString GetTitle() const { return m_title; }
167
168 // no maximize etc
169 virtual void Maximize( bool WXUNUSED(maximize) = true ) { }
170 virtual bool IsMaximized() const { return true; }
171 virtual void Iconize(bool WXUNUSED(iconize) = true) { }
172 virtual bool IsIconized() const { return false; }
173 virtual void Restore() {}
174
175 virtual bool IsTopLevel() const { return false; }
176
177 void OnActivate( wxActivateEvent& event );
178 void OnMenuHighlight( wxMenuEvent& event );
179
180 // implementation
181
182 wxMenuBar *m_menuBar;
183 GtkNotebookPage *m_page;
184 bool m_justInserted;
185
186 protected:
187 // override wxFrame methods to not do anything
188 virtual void DoSetSize(int x, int y,
189 int width, int height,
190 int sizeFlags = wxSIZE_AUTO);
191 virtual void DoSetClientSize(int width, int height);
192 virtual void DoGetClientSize( int *width, int *height ) const;
193
194 private:
195 DECLARE_EVENT_TABLE()
196 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
197 };
198
199 //-----------------------------------------------------------------------------
200 // wxMDIClientWindow
201 //-----------------------------------------------------------------------------
202
203 class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
204 {
205 public:
206 wxMDIClientWindow();
207 wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
208 ~wxMDIClientWindow();
209 virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
210
211 private:
212 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
213 };
214
215 #endif // __MDIH__
216