]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: frame.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | ||
11 | #ifndef __GTKFRAMEH__ | |
12 | #define __GTKFRAMEH__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
19 | #include "wx/object.h" | |
20 | #include "wx/window.h" | |
21 | ||
22 | //----------------------------------------------------------------------------- | |
23 | // classes | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | class wxMDIChildFrame; | |
27 | class wxMDIClientWindow; | |
28 | class wxMenu; | |
29 | class wxMenuBar; | |
30 | class wxToolBar; | |
31 | class wxStatusBar; | |
32 | ||
33 | class wxFrame; | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | // global data | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
39 | extern const char *wxFrameNameStr; | |
40 | extern const char *wxToolBarNameStr; | |
41 | ||
42 | //----------------------------------------------------------------------------- | |
43 | // wxFrame | |
44 | //----------------------------------------------------------------------------- | |
45 | ||
46 | class wxFrame: public wxWindow | |
47 | { | |
48 | DECLARE_DYNAMIC_CLASS(wxFrame) | |
49 | public: | |
50 | ||
51 | wxFrame(); | |
52 | wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, | |
53 | const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, | |
54 | long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); | |
55 | bool Create( wxWindow *parent, wxWindowID id, const wxString &title, | |
56 | const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, | |
57 | long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); | |
58 | ~wxFrame(); | |
59 | bool Destroy(); | |
60 | ||
61 | virtual bool Show( bool show ); | |
62 | virtual void Enable( bool enable ); | |
63 | virtual void Centre( int direction = wxHORIZONTAL ); | |
64 | ||
65 | virtual void GetClientSize( int *width, int *height ) const; | |
66 | virtual void SetClientSize( int const width, int const height ); | |
67 | ||
68 | virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, | |
69 | const wxString& name = "statusBar"); | |
70 | virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id, | |
71 | const wxString& name ); | |
72 | virtual wxStatusBar *GetStatusBar() const; | |
73 | inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } | |
74 | virtual void SetStatusText( const wxString &text, int number = 0 ); | |
75 | virtual void SetStatusWidths( int n, const int widths_field[] ); | |
76 | ||
77 | virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, | |
78 | const wxString& name = wxToolBarNameStr); | |
79 | virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name ); | |
80 | virtual wxToolBar *GetToolBar(void) const; | |
81 | inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } | |
82 | ||
83 | virtual void SetMenuBar( wxMenuBar *menuBar ); | |
84 | virtual wxMenuBar *GetMenuBar() const; | |
85 | ||
86 | virtual void SetTitle( const wxString &title ); | |
87 | virtual wxString GetTitle() const { return m_title; } | |
88 | ||
89 | virtual void SetIcon( const wxIcon &icon ); | |
90 | virtual void Iconize( bool WXUNUSED(iconize)) { } | |
91 | virtual bool IsIconized(void) const { return FALSE; } | |
92 | bool Iconized(void) const { return IsIconized(); } | |
93 | virtual void Maximize(bool WXUNUSED(maximize)) {} | |
94 | virtual void Restore(void) {} | |
95 | ||
96 | void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp | |
97 | void OnSize( wxSizeEvent &event ); | |
98 | void OnCloseWindow( wxCloseEvent& event ); | |
99 | void OnIdle(wxIdleEvent& event); | |
100 | ||
101 | void AddChild( wxWindow *child ); | |
102 | ||
103 | // implementation | |
104 | ||
105 | virtual void GtkOnSize( int x, int y, int width, int height ); | |
106 | ||
107 | private: | |
108 | friend wxWindow; | |
109 | friend wxMDIChildFrame; | |
110 | friend wxMDIClientWindow; | |
111 | ||
112 | // update frame's menus (called from OnIdle) | |
113 | void DoMenuUpdates(); | |
114 | void DoMenuUpdates(wxMenu* menu); | |
115 | virtual void ImplementSetPosition(); | |
116 | ||
117 | GtkWidget *m_mainWindow; | |
118 | wxMenuBar *m_frameMenuBar; | |
119 | wxStatusBar *m_frameStatusBar; | |
120 | wxToolBar *m_frameToolBar; | |
121 | int m_toolBarHeight; | |
122 | bool m_addPrivateChild; // for toolbar (and maybe menubar) | |
123 | wxString m_title; | |
124 | wxIcon m_icon; | |
125 | ||
126 | DECLARE_EVENT_TABLE() | |
127 | }; | |
128 | ||
129 | #endif // __GTKFRAMEH__ |