]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/frame.h
HP-UX compilation fixes (or so I hope)
[wxWidgets.git] / include / wx / motif / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.h
3 // Purpose: wxFrame class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FRAME_H_
13 #define _WX_FRAME_H_
14
15 #ifdef __GNUG__
16 #pragma interface "frame.h"
17 #endif
18
19 #include "wx/window.h"
20 #include "wx/toolbar.h"
21 #include "wx/accel.h"
22
23 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
24 WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
25
26 class WXDLLEXPORT wxMenuBar;
27 class WXDLLEXPORT wxStatusBar;
28
29 class WXDLLEXPORT wxFrame : public wxWindow
30 {
31 DECLARE_DYNAMIC_CLASS(wxFrame)
32
33 public:
34 wxFrame();
35 wxFrame(wxWindow *parent,
36 wxWindowID id,
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = wxDEFAULT_FRAME_STYLE,
41 const wxString& name = wxFrameNameStr)
42 {
43 Create(parent, id, title, pos, size, style, name);
44 }
45
46 ~wxFrame();
47
48 bool Create(wxWindow *parent,
49 wxWindowID id,
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxDEFAULT_FRAME_STYLE,
54 const wxString& name = wxFrameNameStr);
55
56 virtual bool Destroy();
57
58 void GetClientSize(int *width, int *height) const;
59 void GetSize(int *width, int *height) const ;
60 void GetPosition(int *x, int *y) const ;
61
62 wxSize GetSize() const { return wxWindow::GetSize(); }
63 wxPoint GetPosition() const { return wxWindow::GetPosition(); }
64 wxSize GetClientSize() const { return wxWindow::GetClientSize(); }
65
66 void ClientToScreen(int *x, int *y) const;
67 wxPoint ClientToScreen(const wxPoint& pt) const { return wxWindow::ClientToScreen(pt); }
68
69 void ScreenToClient(int *x, int *y) const;
70 wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); }
71
72 void OnSize(wxSizeEvent& event);
73 void OnMenuHighlight(wxMenuEvent& event);
74 void OnActivate(wxActivateEvent& event);
75 void OnIdle(wxIdleEvent& event);
76 void OnCloseWindow(wxCloseEvent& event);
77
78 bool Show(bool show);
79
80 // Set menu bar
81 void SetMenuBar(wxMenuBar *menu_bar);
82 virtual wxMenuBar *GetMenuBar() const ;
83
84 // Set title
85 void SetTitle(const wxString& title);
86 wxString GetTitle() const { return m_title; }
87
88 void Centre(int direction = wxBOTH);
89
90 // Call this to simulate a menu command
91 virtual void Command(int id);
92 virtual void ProcessCommand(int id);
93
94 // Set icon
95 virtual void SetIcon(const wxIcon& icon);
96
97 // Create status line
98 virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
99 const wxString& name = "statusBar");
100 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
101 virtual void PositionStatusBar();
102 virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
103 const wxString& name);
104
105 // Create toolbar
106 #if wxUSE_TOOLBAR
107 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
108 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
109 // If made known to the frame, the frame will manage it automatically.
110 virtual void SetToolBar(wxToolBar *toolbar) ;
111 virtual wxToolBar *GetToolBar() const ;
112 virtual void PositionToolBar();
113 #endif // wxUSE_TOOLBAR
114
115 // Set status line text
116 virtual void SetStatusText(const wxString& text, int number = 0);
117
118 // Set status line widths
119 virtual void SetStatusWidths(int n, const int widths_field[]);
120
121 // Hint to tell framework which status bar to use
122 // TODO: should this go into a wxFrameworkSettings class perhaps?
123 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
124 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
125
126 // Fit frame around subwindows
127 virtual void Fit();
128
129 // Iconize
130 virtual void Iconize(bool iconize);
131
132 virtual bool IsIconized() const ;
133
134 // Compatibility
135 bool Iconized() const { return IsIconized(); }
136
137 // Is the frame maximized? Returns FALSE under Motif (but TRUE for
138 // wxMDIChildFrame due to the tabbed implementation).
139 virtual bool IsMaximized(void) const ;
140
141 virtual void Maximize(bool maximize);
142
143 // Responds to colour changes
144 void OnSysColourChanged(wxSysColourChangedEvent& event);
145
146 // Query app for menu item updates (called from OnIdle)
147 void DoMenuUpdates();
148 void DoMenuUpdates(wxMenu* menu);
149
150 // Checks if there is a toolbar, and returns the first free client position
151 virtual wxPoint GetClientAreaOrigin() const;
152
153 virtual void Raise();
154 virtual void Lower();
155
156 virtual void CaptureMouse();
157 virtual void ReleaseMouse();
158
159 // Implementation
160 virtual void ChangeFont(bool keepOriginalSize = TRUE);
161 virtual void ChangeBackgroundColour();
162 virtual void ChangeForegroundColour();
163 WXWidget GetMenuBarWidget() const ;
164 WXWidget GetShellWidget() const { return m_frameShell; }
165 WXWidget GetWorkAreaWidget() const { return m_workArea; }
166 WXWidget GetClientAreaWidget() const { return m_clientArea; }
167 WXWidget GetTopWidget() const { return m_frameShell; }
168 WXWidget GetMainWindowWidget() const { return m_frameWidget; }
169
170 // The widget that can have children on it
171 WXWidget GetClientWidget() const;
172 bool GetVisibleStatus() const { return m_visibleStatus; }
173
174 bool PreResize();
175
176 protected:
177 wxMenuBar * m_frameMenuBar;
178 wxStatusBar * m_frameStatusBar;
179 wxIcon m_icon;
180 bool m_iconized;
181 static bool m_useNativeStatusBar;
182
183 #if wxUSE_TOOLBAR
184 wxToolBar * m_frameToolBar ;
185 #endif // wxUSE_TOOLBAR
186
187 //// Motif-specific
188
189 WXWidget m_frameShell;
190 WXWidget m_frameWidget;
191 WXWidget m_workArea;
192 WXWidget m_clientArea;
193 // WXWidget m_menuBarWidget;
194 bool m_visibleStatus;
195 wxString m_title;
196
197 virtual void DoSetSize(int x, int y,
198 int width, int height,
199 int sizeFlags = wxSIZE_AUTO);
200
201 virtual void DoSetClientSize(int width, int height);
202
203 private:
204 DECLARE_EVENT_TABLE()
205 };
206
207 #endif
208 // _WX_FRAME_H_