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