]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/frame.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFrame class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "frame.h"
19 #include "wx/window.h"
20 #include "wx/toolbar.h"
23 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr
;
24 WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr
;
26 class WXDLLEXPORT wxMenuBar
;
27 class WXDLLEXPORT wxStatusBar
;
29 class WXDLLEXPORT wxFrame
: public wxWindow
{
31 DECLARE_DYNAMIC_CLASS(wxFrame
)
35 inline wxFrame(wxWindow
*parent
,
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
)
43 Create(parent
, id
, title
, pos
, size
, style
, name
);
48 bool Create(wxWindow
*parent
,
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
);
56 virtual bool Destroy();
58 void SetClientSize(int width
, int height
);
59 void SetClientSize(const wxSize
& size
) { wxWindow::SetClientSize(size
); }
61 void GetClientSize(int *width
, int *height
) const;
62 wxSize
GetClientSize() const { return wxWindow::GetClientSize(); }
64 void GetSize(int *width
, int *height
) const ;
65 wxSize
GetSize() const { return wxWindow::GetSize(); }
67 void GetPosition(int *x
, int *y
) const ;
68 wxPoint
GetPosition() const { return wxWindow::GetPosition(); }
70 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
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 virtual void SetSize(int width
, int height
) { SetSize(-1, -1, width
, height
, wxSIZE_USE_EXISTING
); }
76 void ClientToScreen(int *x
, int *y
) const;
77 wxPoint
ClientToScreen(const wxPoint
& pt
) const { return wxWindow::ClientToScreen(pt
); }
79 void ScreenToClient(int *x
, int *y
) const;
80 wxPoint
ScreenToClient(const wxPoint
& pt
) const { return wxWindow::ScreenToClient(pt
); }
82 void OnSize(wxSizeEvent
& event
);
83 void OnMenuHighlight(wxMenuEvent
& event
);
84 void OnActivate(wxActivateEvent
& event
);
85 void OnIdle(wxIdleEvent
& event
);
86 void OnCloseWindow(wxCloseEvent
& event
);
91 void SetMenuBar(wxMenuBar
*menu_bar
);
92 virtual wxMenuBar
*GetMenuBar() const ;
95 void SetTitle(const wxString
& title
);
96 inline wxString
GetTitle() const { return m_title
; }
98 void Centre(int direction
= wxBOTH
);
100 // Call this to simulate a menu command
101 virtual void Command(int id
);
102 virtual void ProcessCommand(int id
);
105 virtual void SetIcon(const wxIcon
& icon
);
107 // Create status line
108 virtual wxStatusBar
* CreateStatusBar(int number
=1, long style
= wxST_SIZEGRIP
, wxWindowID id
= 0,
109 const wxString
& name
= "statusBar");
110 inline wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
111 virtual void PositionStatusBar();
112 virtual wxStatusBar
*OnCreateStatusBar(int number
, long style
, wxWindowID id
,
113 const wxString
& name
);
117 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
|wxTB_HORIZONTAL
, wxWindowID id
= -1, const wxString
& name
= wxToolBarNameStr
);
118 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
119 // If made known to the frame, the frame will manage it automatically.
120 virtual void SetToolBar(wxToolBar
*toolbar
) ;
121 virtual wxToolBar
*GetToolBar() const ;
122 virtual void PositionToolBar();
123 #endif // wxUSE_TOOLBAR
125 // Set status line text
126 virtual void SetStatusText(const wxString
& text
, int number
= 0);
128 // Set status line widths
129 virtual void SetStatusWidths(int n
, const int widths_field
[]);
131 // Hint to tell framework which status bar to use
132 // TODO: should this go into a wxFrameworkSettings class perhaps?
133 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
134 static bool UsesNativeStatusBar() { return m_useNativeStatusBar
; };
136 // Fit frame around subwindows
140 virtual void Iconize(bool iconize
);
142 virtual bool IsIconized() const ;
145 inline bool Iconized() const { return IsIconized(); }
147 // Is the frame maximized? Returns FALSE under Motif (but TRUE for
148 // wxMDIChildFrame due to the tabbed implementation).
149 virtual bool IsMaximized(void) const ;
151 virtual void Maximize(bool maximize
);
153 // Responds to colour changes
154 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
156 // Query app for menu item updates (called from OnIdle)
157 void DoMenuUpdates();
158 void DoMenuUpdates(wxMenu
* menu
);
160 // Checks if there is a toolbar, and returns the first free client position
161 virtual wxPoint
GetClientAreaOrigin() const;
163 virtual void Raise();
164 virtual void Lower();
166 virtual void CaptureMouse();
167 virtual void ReleaseMouse();
170 virtual void ChangeFont(bool keepOriginalSize
= TRUE
);
171 virtual void ChangeBackgroundColour();
172 virtual void ChangeForegroundColour();
173 WXWidget
GetMenuBarWidget() const ;
174 inline WXWidget
GetShellWidget() const { return m_frameShell
; }
175 inline WXWidget
GetWorkAreaWidget() const { return m_workArea
; }
176 inline WXWidget
GetClientAreaWidget() const { return m_clientArea
; }
177 inline WXWidget
GetTopWidget() const { return m_frameShell
; }
178 inline WXWidget
GetMainWindowWidget() const { return m_frameWidget
; }
180 // The widget that can have children on it
181 WXWidget
GetClientWidget() const;
182 bool GetVisibleStatus() const { return m_visibleStatus
; }
187 wxMenuBar
* m_frameMenuBar
;
188 wxStatusBar
* m_frameStatusBar
;
191 static bool m_useNativeStatusBar
;
194 wxToolBar
* m_frameToolBar
;
195 #endif // wxUSE_TOOLBAR
199 WXWidget m_frameShell
;
200 WXWidget m_frameWidget
;
202 WXWidget m_clientArea
;
203 // WXWidget m_menuBarWidget;
204 bool m_visibleStatus
;
207 DECLARE_EVENT_TABLE()