| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/gtk1/mdi.h |
| 3 | // Purpose: TDI-based MDI implementation for wxGTK1 |
| 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_GTK1_MDI_H_ |
| 13 | #define _WX_GTK1_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 GtkOnSize( int x, int y, int width, int height ); |
| 68 | virtual void OnInternalIdle(); |
| 69 | |
| 70 | private: |
| 71 | void Init(); |
| 72 | |
| 73 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) |
| 74 | }; |
| 75 | |
| 76 | //----------------------------------------------------------------------------- |
| 77 | // wxMDIChildFrame |
| 78 | //----------------------------------------------------------------------------- |
| 79 | |
| 80 | class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame |
| 81 | { |
| 82 | public: |
| 83 | wxMDIChildFrame() { Init(); } |
| 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 | Init(); |
| 93 | |
| 94 | Create(parent, id, title, pos, size, style, name); |
| 95 | } |
| 96 | |
| 97 | bool Create(wxMDIParentFrame *parent, |
| 98 | wxWindowID id, |
| 99 | const wxString& title, |
| 100 | const wxPoint& pos = wxDefaultPosition, |
| 101 | const wxSize& size = wxDefaultSize, |
| 102 | long style = wxDEFAULT_FRAME_STYLE, |
| 103 | const wxString& name = wxFrameNameStr); |
| 104 | |
| 105 | virtual ~wxMDIChildFrame(); |
| 106 | |
| 107 | virtual void SetMenuBar( wxMenuBar *menu_bar ); |
| 108 | virtual wxMenuBar *GetMenuBar() const; |
| 109 | |
| 110 | virtual void Activate(); |
| 111 | |
| 112 | virtual void SetTitle(const wxString& title); |
| 113 | |
| 114 | // implementation |
| 115 | |
| 116 | void OnActivate( wxActivateEvent& event ); |
| 117 | void OnMenuHighlight( wxMenuEvent& event ); |
| 118 | |
| 119 | wxMenuBar *m_menuBar; |
| 120 | GtkNotebookPage *m_page; |
| 121 | bool m_justInserted; |
| 122 | |
| 123 | private: |
| 124 | void Init(); |
| 125 | |
| 126 | GtkNotebook *GTKGetNotebook() const; |
| 127 | |
| 128 | DECLARE_EVENT_TABLE() |
| 129 | DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) |
| 130 | }; |
| 131 | |
| 132 | //----------------------------------------------------------------------------- |
| 133 | // wxMDIClientWindow |
| 134 | //----------------------------------------------------------------------------- |
| 135 | |
| 136 | class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase |
| 137 | { |
| 138 | public: |
| 139 | wxMDIClientWindow() { } |
| 140 | |
| 141 | virtual bool CreateClient(wxMDIParentFrame *parent, |
| 142 | long style = wxVSCROLL | wxHSCROLL); |
| 143 | |
| 144 | private: |
| 145 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) |
| 146 | }; |
| 147 | |
| 148 | #endif // _WX_GTK1_MDI_H_ |