]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/mdi.h
don't crash if (char*)c_str() is used twice in a row on the same string and both...
[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 SetIcons(const wxIconBundle& icons )
159 { wxTopLevelWindowBase::SetIcons(icons); }
160
161 // no title
162 virtual void SetTitle( const wxString &title );
163
164 // no maximize etc
165 virtual void Maximize( bool WXUNUSED(maximize) = true ) { }
166 virtual bool IsMaximized() const { return true; }
167 virtual void Iconize(bool WXUNUSED(iconize) = true) { }
168 virtual bool IsIconized() const { return false; }
169 virtual void Restore() {}
170
171 virtual bool IsTopLevel() const { return false; }
172
173 void OnActivate( wxActivateEvent& event );
174 void OnMenuHighlight( wxMenuEvent& event );
175
176 // implementation
177
178 wxMenuBar *m_menuBar;
179 GtkNotebookPage *m_page;
180 bool m_justInserted;
181
182 protected:
183 // override wxFrame methods to not do anything
184 virtual void DoSetSize(int x, int y,
185 int width, int height,
186 int sizeFlags = wxSIZE_AUTO);
187 virtual void DoSetClientSize(int width, int height);
188 virtual void DoGetClientSize( int *width, int *height ) const;
189
190 private:
191 DECLARE_EVENT_TABLE()
192 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
193 };
194
195 //-----------------------------------------------------------------------------
196 // wxMDIClientWindow
197 //-----------------------------------------------------------------------------
198
199 class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow
200 {
201 public:
202 wxMDIClientWindow();
203 wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
204 virtual ~wxMDIClientWindow();
205 virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
206
207 private:
208 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
209 };
210
211 #endif // __MDIH__