]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/mdi.h
Check that event's IDs range is valid, i.e. that lower bound
[wxWidgets.git] / include / wx / gtk / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/mdi.h
3 // Purpose: TDI-based MDI implementation for wxGTK
4 // Author: Robert Roebling
5 // Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
6 // Id: $Id$
7 // Copyright: (c) 1998 Robert Roebling
8 // (c) 2008 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GTK_MDI_H_
13 #define _WX_GTK_MDI_H_
14
15 #include "wx/frame.h"
16
17 class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
18 class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
19
20 typedef struct _GtkNotebook GtkNotebook;
21
22 //-----------------------------------------------------------------------------
23 // wxMDIParentFrame
24 //-----------------------------------------------------------------------------
25
26 class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
27 {
28 public:
29 wxMDIParentFrame() { Init(); }
30 wxMDIParentFrame(wxWindow *parent,
31 wxWindowID id,
32 const wxString& title,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
36 const wxString& name = wxFrameNameStr)
37 {
38 Init();
39
40 (void)Create(parent, id, title, pos, size, style, name);
41 }
42
43 bool Create(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 // we don't store the active child in m_currentChild unlike the base class
52 // version so override this method to find it dynamically
53 virtual wxMDIChildFrame *GetActiveChild() const;
54
55 // implement base class pure virtuals
56 // ----------------------------------
57
58 virtual void ActivateNext();
59 virtual void ActivatePrevious();
60
61 static bool IsTDI() { return true; }
62
63 // implementation
64
65 bool m_justInserted;
66
67 virtual void OnInternalIdle();
68
69 protected:
70 void Init();
71 virtual void DoGetClientSize(int* width, int* height) const;
72
73 private:
74 friend class wxMDIChildFrame;
75
76 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
77 };
78
79 //-----------------------------------------------------------------------------
80 // wxMDIChildFrame
81 //-----------------------------------------------------------------------------
82
83 class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
84 {
85 public:
86 wxMDIChildFrame() { Init(); }
87 wxMDIChildFrame(wxMDIParentFrame *parent,
88 wxWindowID id,
89 const wxString& title,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
92 long style = wxDEFAULT_FRAME_STYLE,
93 const wxString& name = wxFrameNameStr)
94 {
95 Init();
96
97 Create(parent, id, title, pos, size, style, name);
98 }
99
100 bool Create(wxMDIParentFrame *parent,
101 wxWindowID id,
102 const wxString& title,
103 const wxPoint& pos = wxDefaultPosition,
104 const wxSize& size = wxDefaultSize,
105 long style = wxDEFAULT_FRAME_STYLE,
106 const wxString& name = wxFrameNameStr);
107
108 virtual ~wxMDIChildFrame();
109
110 virtual void SetMenuBar( wxMenuBar *menu_bar );
111 virtual wxMenuBar *GetMenuBar() const;
112
113 virtual void Activate();
114
115 virtual void SetTitle(const wxString& title);
116
117 // implementation
118
119 void OnActivate( wxActivateEvent& event );
120 void OnMenuHighlight( wxMenuEvent& event );
121
122 wxMenuBar *m_menuBar;
123 GtkNotebookPage *m_page;
124 bool m_justInserted;
125
126 private:
127 void Init();
128
129 GtkNotebook *GTKGetNotebook() const;
130
131 DECLARE_EVENT_TABLE()
132 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
133 };
134
135 //-----------------------------------------------------------------------------
136 // wxMDIClientWindow
137 //-----------------------------------------------------------------------------
138
139 class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
140 {
141 public:
142 wxMDIClientWindow() { }
143 ~wxMDIClientWindow();
144
145 virtual bool CreateClient(wxMDIParentFrame *parent,
146 long style = wxVSCROLL | wxHSCROLL);
147
148 private:
149 virtual void AddChildGTK(wxWindowGTK* child);
150
151 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
152 };
153
154 #endif // _WX_GTK_MDI_H_