]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/mdi.h
Avoid conflict between new transparency API and old background support.
[wxWidgets.git] / include / wx / gtk1 / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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 WXDLLEXPORT_DATA(const wxChar) wxFrameNameStr[];
34 extern WXDLLEXPORT_DATA(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) = wxDefaultCoord,
145 int WXUNUSED(maxH) = wxDefaultCoord,
146 int WXUNUSED(incW) = wxDefaultCoord,
147 int WXUNUSED(incH) = wxDefaultCoord) {}
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 virtual void SetTitle( const wxString &title );
166
167 // no maximize etc
168 virtual void Maximize( bool WXUNUSED(maximize) = true ) { }
169 virtual bool IsMaximized() const { return true; }
170 virtual void Iconize(bool WXUNUSED(iconize) = true) { }
171 virtual bool IsIconized() const { return false; }
172 virtual void Restore() {}
173
174 virtual bool IsTopLevel() const { return false; }
175
176 void OnActivate( wxActivateEvent& event );
177 void OnMenuHighlight( wxMenuEvent& event );
178
179 // implementation
180
181 wxMenuBar *m_menuBar;
182 GtkNotebookPage *m_page;
183 bool m_justInserted;
184
185 protected:
186 // override wxFrame methods to not do anything
187 virtual void DoSetSize(int x, int y,
188 int width, int height,
189 int sizeFlags = wxSIZE_AUTO);
190 virtual void DoSetClientSize(int width, int height);
191 virtual void DoGetClientSize( int *width, int *height ) const;
192
193 private:
194 DECLARE_EVENT_TABLE()
195 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
196 };
197
198 //-----------------------------------------------------------------------------
199 // wxMDIClientWindow
200 //-----------------------------------------------------------------------------
201
202 class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
203 {
204 public:
205 wxMDIClientWindow();
206 wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
207 ~wxMDIClientWindow();
208 virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
209
210 private:
211 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
212 };
213
214 #endif // __MDIH__