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