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