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