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