]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/frame.h
GetSize() and GetClientSize() changes
[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 SetClientSize(int width, int height);
59 void GetClientSize(int *width, int *height) const;
60 void GetSize(int *width, int *height) const ;
61 void GetPosition(int *x, int *y) const ;
62
63 void ClientToScreen(int *x, int *y) const;
64 wxPoint ClientToScreen(const wxPoint& pt) const { return wxWindow::ClientToScreen(pt); }
65
66 void ScreenToClient(int *x, int *y) const;
67 wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); }
68
69 void OnSize(wxSizeEvent& event);
70 void OnMenuHighlight(wxMenuEvent& event);
71 void OnActivate(wxActivateEvent& event);
72 void OnIdle(wxIdleEvent& event);
73 void OnCloseWindow(wxCloseEvent& event);
74
75 bool Show(bool show);
76
77 // Set menu bar
78 void SetMenuBar(wxMenuBar *menu_bar);
79 virtual wxMenuBar *GetMenuBar() const ;
80
81 // Set title
82 void SetTitle(const wxString& title);
83 wxString GetTitle() const { return m_title; }
84
85 void Centre(int direction = wxBOTH);
86
87 // Call this to simulate a menu command
88 virtual void Command(int id);
89 virtual void ProcessCommand(int id);
90
91 // Set icon
92 virtual void SetIcon(const wxIcon& icon);
93
94 // Create status line
95 virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
96 const wxString& name = "statusBar");
97 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
98 virtual void PositionStatusBar();
99 virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
100 const wxString& name);
101
102 // Create toolbar
103 #if wxUSE_TOOLBAR
104 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
105 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
106 // If made known to the frame, the frame will manage it automatically.
107 virtual void SetToolBar(wxToolBar *toolbar) ;
108 virtual wxToolBar *GetToolBar() const ;
109 virtual void PositionToolBar();
110 #endif // wxUSE_TOOLBAR
111
112 // Set status line text
113 virtual void SetStatusText(const wxString& text, int number = 0);
114
115 // Set status line widths
116 virtual void SetStatusWidths(int n, const int widths_field[]);
117
118 // Hint to tell framework which status bar to use
119 // TODO: should this go into a wxFrameworkSettings class perhaps?
120 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
121 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
122
123 // Fit frame around subwindows
124 virtual void Fit();
125
126 // Iconize
127 virtual void Iconize(bool iconize);
128
129 virtual bool IsIconized() const ;
130
131 // Compatibility
132 bool Iconized() const { return IsIconized(); }
133
134 // Is the frame maximized? Returns FALSE under Motif (but TRUE for
135 // wxMDIChildFrame due to the tabbed implementation).
136 virtual bool IsMaximized(void) const ;
137
138 virtual void Maximize(bool maximize);
139
140 // Responds to colour changes
141 void OnSysColourChanged(wxSysColourChangedEvent& event);
142
143 // Query app for menu item updates (called from OnIdle)
144 void DoMenuUpdates();
145 void DoMenuUpdates(wxMenu* menu);
146
147 // Checks if there is a toolbar, and returns the first free client position
148 virtual wxPoint GetClientAreaOrigin() const;
149
150 virtual void Raise();
151 virtual void Lower();
152
153 virtual void CaptureMouse();
154 virtual void ReleaseMouse();
155
156 // Implementation
157 virtual void ChangeFont(bool keepOriginalSize = TRUE);
158 virtual void ChangeBackgroundColour();
159 virtual void ChangeForegroundColour();
160 WXWidget GetMenuBarWidget() const ;
161 WXWidget GetShellWidget() const { return m_frameShell; }
162 WXWidget GetWorkAreaWidget() const { return m_workArea; }
163 WXWidget GetClientAreaWidget() const { return m_clientArea; }
164 WXWidget GetTopWidget() const { return m_frameShell; }
165 WXWidget GetMainWindowWidget() const { return m_frameWidget; }
166
167 // The widget that can have children on it
168 WXWidget GetClientWidget() const;
169 bool GetVisibleStatus() const { return m_visibleStatus; }
170
171 bool PreResize();
172
173 protected:
174 wxMenuBar * m_frameMenuBar;
175 wxStatusBar * m_frameStatusBar;
176 wxIcon m_icon;
177 bool m_iconized;
178 static bool m_useNativeStatusBar;
179
180 #if wxUSE_TOOLBAR
181 wxToolBar * m_frameToolBar ;
182 #endif // wxUSE_TOOLBAR
183
184 //// Motif-specific
185
186 WXWidget m_frameShell;
187 WXWidget m_frameWidget;
188 WXWidget m_workArea;
189 WXWidget m_clientArea;
190 // WXWidget m_menuBarWidget;
191 bool m_visibleStatus;
192 wxString m_title;
193
194 virtual void DoSetSize(int x, int y,
195 int width, int height,
196 int sizeFlags = wxSIZE_AUTO);
197
198 virtual void DoSetClientSize(int width, int height);
199
200 private:
201 DECLARE_EVENT_TABLE()
202 };
203
204 #endif
205 // _WX_FRAME_H_