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