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