]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/frame.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFrame class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "frame.h"
19 #include "wx/window.h"
20 #include "wx/toolbar.h"
21 #include "wx/msw/accel.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(void);
58 void SetClientSize(int width
, int height
);
59 void SetClientSize(const wxSize
& sz
) { wxWindow::SetClientSize(sz
); }
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 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
72 virtual void ClientToScreen(int *x
, int *y
) const;
74 virtual void ScreenToClient(int *x
, int *y
) const;
76 virtual bool OnClose(void);
78 void OnSize(wxSizeEvent
& event
);
79 void OnMenuHighlight(wxMenuEvent
& event
);
80 void OnActivate(wxActivateEvent
& event
);
81 void OnIdle(wxIdleEvent
& event
);
82 void OnCloseWindow(wxCloseEvent
& event
);
87 void SetMenuBar(wxMenuBar
*menu_bar
);
88 virtual wxMenuBar
*GetMenuBar(void) const ;
91 void SetTitle(const wxString
& title
);
92 wxString
GetTitle(void) const ;
94 void Centre(int direction
= wxBOTH
);
96 // Call this to simulate a menu command
97 virtual void Command(int id
);
98 virtual void ProcessCommand(int id
);
101 virtual void SetIcon(const wxIcon
& icon
);
103 // Create status line
104 virtual wxStatusBar
* CreateStatusBar(int number
=1, long style
= wxST_SIZEGRIP
, wxWindowID id
= 0,
105 const wxString
& name
= "statusBar");
106 inline wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
107 inline void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
108 virtual void PositionStatusBar(void);
109 virtual wxStatusBar
*OnCreateStatusBar(int number
, long style
, wxWindowID id
,
110 const wxString
& name
);
113 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
| wxTB_HORIZONTAL
| wxTB_FLAT
,
115 const wxString
& name
= wxToolBarNameStr
);
116 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
117 // If made known to the frame, the frame will manage it automatically.
118 virtual inline void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
119 virtual inline wxToolBar
*GetToolBar(void) const { return m_frameToolBar
; }
120 virtual void PositionToolBar(void);
122 // Set status line text
123 virtual void SetStatusText(const wxString
& text
, int number
= 0);
125 // Set status line widths
126 virtual void SetStatusWidths(int n
, const int widths_field
[]);
128 // Hint to tell framework which status bar to use
129 // TODO: should this go into a wxFrameworkSettings class perhaps?
130 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
131 static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar
; };
133 // Fit frame around subwindows
134 virtual void Fit(void);
137 virtual void Iconize(bool iconize
);
139 virtual bool IsIconized(void) const ;
142 virtual bool IsMaximized(void) const ;
145 inline bool Iconized(void) const { return IsIconized(); }
147 virtual void Maximize(bool maximize
);
148 // virtual bool LoadAccelerators(const wxString& table);
150 // Responds to colour changes
151 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
153 // Query app for menu item updates (called from OnIdle)
154 void DoMenuUpdates(void);
155 void DoMenuUpdates(wxMenu
* menu
);
157 WXHMENU
GetWinMenu(void) const ;
159 // Checks if there is a toolbar, and returns the first free client position
160 virtual wxPoint
GetClientAreaOrigin() const;
163 bool MSWOnPaint(void);
164 WXHICON
MSWOnQueryDragIcon(void);
165 void MSWOnSize(int x
, int y
, WXUINT flag
);
166 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
167 bool MSWOnClose(void);
168 void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
169 bool MSWProcessMessage(WXMSG
*msg
);
170 bool MSWTranslateMessage(WXMSG
*msg
);
171 void MSWCreate(int id
, wxWindow
*parent
, const char *WXUNUSED(wclass
), wxWindow
*wx_win
, const char *title
,
172 int x
, int y
, int width
, int height
, long style
);
175 // propagate our state change to all child frames
176 void IconizeChildFrames(bool bIconize
);
178 wxMenuBar
* m_frameMenuBar
;
179 wxStatusBar
* m_frameStatusBar
;
182 WXHICON m_defaultIcon
;
183 static bool m_useNativeStatusBar
;
184 wxToolBar
* m_frameToolBar
;
186 DECLARE_EVENT_TABLE()