]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/mdi.h
fix MDI child sizing, which was working more or less by accident before I broke it...
[wxWidgets.git] / include / wx / gtk / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/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 _WX_GTK_MDI_H_
11 #define _WX_GTK_MDI_H_
12
13 #include "wx/frame.h"
14
15 //-----------------------------------------------------------------------------
16 // wxMDIParentFrame
17 //-----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame
20 {
21 public:
22 wxMDIParentFrame() { Init(); }
23 wxMDIParentFrame(wxWindow *parent,
24 wxWindowID id,
25 const wxString& title,
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
29 const wxString& name = wxFrameNameStr)
30 {
31 Init();
32
33 (void)Create(parent, id, title, pos, size, style, name);
34 }
35
36 virtual ~wxMDIParentFrame();
37 bool Create( wxWindow *parent,
38 wxWindowID id,
39 const wxString& title,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
43 const wxString& name = wxFrameNameStr );
44
45 wxMDIChildFrame *GetActiveChild() const;
46
47 wxMDIClientWindow *GetClientWindow() const;
48 virtual wxMDIClientWindow *OnCreateClient();
49
50 virtual void Cascade() {}
51 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) {}
52 virtual void ArrangeIcons() {}
53 virtual void ActivateNext();
54 virtual void ActivatePrevious();
55
56 // implementation
57
58 wxMDIClientWindow *m_clientWindow;
59 bool m_justInserted;
60
61 virtual void GtkOnSize();
62 virtual void OnInternalIdle();
63
64 protected:
65 void Init();
66 virtual bool HasVisibleMenubar() const;
67
68 private:
69 friend class wxMDIChildFrame;
70
71 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
72 };
73
74 //-----------------------------------------------------------------------------
75 // wxMDIChildFrame
76 //-----------------------------------------------------------------------------
77
78 class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
79 {
80 public:
81 wxMDIChildFrame();
82 wxMDIChildFrame( wxMDIParentFrame *parent,
83 wxWindowID id,
84 const wxString& title,
85 const wxPoint& pos = wxDefaultPosition,
86 const wxSize& size = wxDefaultSize,
87 long style = wxDEFAULT_FRAME_STYLE,
88 const wxString& name = wxFrameNameStr );
89
90 virtual ~wxMDIChildFrame();
91 bool Create( wxMDIParentFrame *parent,
92 wxWindowID id,
93 const wxString& title,
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize,
96 long style = wxDEFAULT_FRAME_STYLE,
97 const wxString& name = wxFrameNameStr );
98
99 virtual void SetMenuBar( wxMenuBar *menu_bar );
100 virtual wxMenuBar *GetMenuBar() const;
101
102 virtual void AddChild( wxWindowBase *child );
103
104 virtual void Activate();
105
106 #if wxUSE_STATUSBAR
107 // no status bars
108 virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
109 long WXUNUSED(style) = 1,
110 wxWindowID WXUNUSED(id) = 1,
111 const wxString& WXUNUSED(name) = wxEmptyString)
112 { return (wxStatusBar*)NULL; }
113
114 virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
115 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
116 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
117 #endif
118
119 // no size hints
120 virtual void DoSetSizeHints( int WXUNUSED(minW),
121 int WXUNUSED(minH),
122 int WXUNUSED(maxW) = wxDefaultCoord,
123 int WXUNUSED(maxH) = wxDefaultCoord,
124 int WXUNUSED(incW) = wxDefaultCoord,
125 int WXUNUSED(incH) = wxDefaultCoord) {}
126
127 #if wxUSE_TOOLBAR
128 // no toolbar
129 virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
130 wxWindowID WXUNUSED(id),
131 const wxString& WXUNUSED(name) )
132 { return (wxToolBar*)NULL; }
133 virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
134 #endif // wxUSE_TOOLBAR
135
136 // no icon
137 virtual void SetIcons(const wxIconBundle& icons )
138 { wxTopLevelWindowBase::SetIcons(icons); }
139
140 // no title
141 virtual void SetTitle( const wxString &title );
142
143 // no maximize etc
144 virtual void Maximize( bool WXUNUSED(maximize) = true ) { }
145 virtual bool IsMaximized() const { return true; }
146 virtual void Iconize(bool WXUNUSED(iconize) = true) { }
147 virtual bool IsIconized() const { return false; }
148 virtual void Restore() {}
149
150 virtual bool IsTopLevel() const { return false; }
151
152 virtual bool Destroy();
153
154 void OnActivate( wxActivateEvent& event );
155 void OnMenuHighlight( wxMenuEvent& event );
156
157 // implementation
158
159 wxMenuBar *m_menuBar;
160 GtkNotebookPage *m_page;
161 bool m_justInserted;
162
163 protected:
164 // override wxFrame methods to not do anything
165 virtual void DoSetSize(int x, int y,
166 int width, int height,
167 int sizeFlags = wxSIZE_AUTO);
168
169 private:
170 DECLARE_EVENT_TABLE()
171 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
172 };
173
174 //-----------------------------------------------------------------------------
175 // wxMDIClientWindow
176 //-----------------------------------------------------------------------------
177
178 class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
179 {
180 public:
181 wxMDIClientWindow();
182 wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
183 virtual ~wxMDIClientWindow();
184 virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
185
186 private:
187 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
188 };
189
190 #endif // _WX_GTK_MDI_H_