]>
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
;
25 WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr
;
27 class WXDLLEXPORT wxMenuBar
;
28 class WXDLLEXPORT wxStatusBar
;
30 class WXDLLEXPORT wxFrame
: public wxWindow
{
32 DECLARE_DYNAMIC_CLASS(wxFrame
)
36 inline wxFrame(wxWindow
*parent
,
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
)
44 Create(parent
, id
, title
, pos
, size
, style
, name
);
49 bool Create(wxWindow
*parent
,
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
);
57 virtual bool Destroy(void);
59 void SetClientSize(int width
, int height
);
60 void SetClientSize(const wxSize
& sz
) { wxWindow::SetClientSize(sz
); }
62 void GetClientSize(int *width
, int *height
) const;
63 wxSize
GetClientSize() const { return wxWindow::GetClientSize(); }
65 void GetSize(int *width
, int *height
) const ;
66 wxSize
GetSize() const { return wxWindow::GetSize(); }
68 void GetPosition(int *x
, int *y
) const ;
69 wxPoint
GetPosition() const { return wxWindow::GetPosition(); }
71 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
73 virtual void ClientToScreen(int *x
, int *y
) const;
75 virtual void ScreenToClient(int *x
, int *y
) const;
77 virtual bool OnClose(void);
79 void OnSize(wxSizeEvent
& event
);
80 void OnMenuHighlight(wxMenuEvent
& event
);
81 void OnActivate(wxActivateEvent
& event
);
82 void OnIdle(wxIdleEvent
& event
);
83 void OnCloseWindow(wxCloseEvent
& event
);
88 void SetMenuBar(wxMenuBar
*menu_bar
);
89 virtual wxMenuBar
*GetMenuBar(void) const ;
92 void SetTitle(const wxString
& title
);
93 wxString
GetTitle(void) const ;
95 void Centre(int direction
= wxBOTH
);
97 // Call this to simulate a menu command
98 virtual void Command(int id
);
99 virtual void ProcessCommand(int id
);
102 virtual void SetIcon(const wxIcon
& icon
);
104 // Create status line
105 virtual wxStatusBar
* CreateStatusBar(int number
=1, long style
= wxST_SIZEGRIP
, wxWindowID id
= 0,
106 const wxString
& name
= wxStatusLineNameStr
);
107 inline wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
108 inline void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
109 virtual void PositionStatusBar(void);
110 virtual wxStatusBar
*OnCreateStatusBar(int number
, long style
, wxWindowID id
,
111 const wxString
& name
);
114 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
| wxTB_HORIZONTAL
| wxTB_FLAT
,
116 const wxString
& name
= wxToolBarNameStr
);
117 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
118 // If made known to the frame, the frame will manage it automatically.
119 virtual inline void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
120 virtual inline wxToolBar
*GetToolBar(void) const { return m_frameToolBar
; }
121 virtual void PositionToolBar(void);
123 // Set status line text
124 virtual void SetStatusText(const wxString
& text
, int number
= 0);
126 // Set status line widths
127 virtual void SetStatusWidths(int n
, const int widths_field
[]);
129 // Hint to tell framework which status bar to use
130 // TODO: should this go into a wxFrameworkSettings class perhaps?
131 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
132 static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar
; };
134 // Fit frame around subwindows
135 virtual void Fit(void);
138 virtual void Iconize(bool iconize
);
140 virtual bool IsIconized(void) const ;
143 virtual bool IsMaximized(void) const ;
146 inline bool Iconized(void) const { return IsIconized(); }
148 virtual void Maximize(bool maximize
);
149 // virtual bool LoadAccelerators(const wxString& table);
151 // Responds to colour changes
152 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
154 // Query app for menu item updates (called from OnIdle)
155 void DoMenuUpdates(void);
156 void DoMenuUpdates(wxMenu
* menu
);
158 WXHMENU
GetWinMenu(void) const ;
160 // Checks if there is a toolbar, and returns the first free client position
161 virtual wxPoint
GetClientAreaOrigin() const;
164 bool MSWOnPaint(void);
165 WXHICON
MSWOnQueryDragIcon(void);
166 void MSWOnSize(int x
, int y
, WXUINT flag
);
167 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
168 bool MSWOnClose(void);
169 void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
170 bool MSWProcessMessage(WXMSG
*msg
);
171 bool MSWTranslateMessage(WXMSG
*msg
);
172 void MSWCreate(int id
, wxWindow
*parent
, const char *WXUNUSED(wclass
), wxWindow
*wx_win
, const char *title
,
173 int x
, int y
, int width
, int height
, long style
);
176 // propagate our state change to all child frames
177 void IconizeChildFrames(bool bIconize
);
179 wxMenuBar
* m_frameMenuBar
;
180 wxStatusBar
* m_frameStatusBar
;
183 WXHICON m_defaultIcon
;
184 static bool m_useNativeStatusBar
;
185 wxToolBar
* m_frameToolBar
;
187 DECLARE_EVENT_TABLE()