]>
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);
57 void SetClientSize(int width
, int height
);
58 void GetClientSize(int *width
, int *height
) const;
60 void GetSize(int *width
, int *height
) const ;
61 void GetPosition(int *x
, int *y
) const ;
62 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
63 void ClientToScreen(int *x
, int *y
) const;
64 void ScreenToClient(int *x
, int *y
) const;
66 virtual bool OnClose(void);
68 void OnSize(wxSizeEvent
& event
);
69 void OnMenuHighlight(wxMenuEvent
& event
);
70 void OnActivate(wxActivateEvent
& event
);
71 void OnIdle(wxIdleEvent
& event
);
72 void OnCloseWindow(wxCloseEvent
& event
);
77 void SetMenuBar(wxMenuBar
*menu_bar
);
78 virtual wxMenuBar
*GetMenuBar(void) const ;
81 void SetTitle(const wxString
& title
);
82 wxString
GetTitle(void) const ;
84 void Centre(int direction
= wxBOTH
);
86 // Call this to simulate a menu command
87 virtual void Command(int id
);
88 virtual void ProcessCommand(int id
);
91 virtual void SetIcon(const wxIcon
& icon
);
94 virtual wxStatusBar
* CreateStatusBar(int number
=1, long style
= wxST_SIZEGRIP
, wxWindowID id
= 0,
95 const wxString
& name
= "statusBar");
96 inline wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
97 inline void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
98 virtual void PositionStatusBar(void);
99 virtual wxStatusBar
*OnCreateStatusBar(int number
, long style
, wxWindowID id
,
100 const wxString
& name
);
103 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
|wxTB_HORIZONTAL
, wxWindowID id
= -1, const wxString
& name
= wxToolBarNameStr
);
104 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
105 // If made known to the frame, the frame will manage it automatically.
106 virtual inline void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
107 virtual inline wxToolBar
*GetToolBar(void) const { return m_frameToolBar
; }
108 virtual void PositionToolBar(void);
110 // Set status line text
111 virtual void SetStatusText(const wxString
& text
, int number
= 0);
113 // Set status line widths
114 virtual void SetStatusWidths(int n
, const int widths_field
[]);
116 // Hint to tell framework which status bar to use
117 // TODO: should this go into a wxFrameworkSettings class perhaps?
118 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
119 static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar
; };
121 // Fit frame around subwindows
122 virtual void Fit(void);
125 virtual void Iconize(bool iconize
);
127 virtual bool IsIconized(void) const ;
130 inline bool Iconized(void) const { return IsIconized(); }
132 virtual void Maximize(bool maximize
);
133 // virtual bool LoadAccelerators(const wxString& table);
135 // Responds to colour changes
136 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
138 // Query app for menu item updates (called from OnIdle)
139 void DoMenuUpdates(void);
140 void DoMenuUpdates(wxMenu
* menu
);
142 WXHMENU
GetWinMenu(void) const ;
144 // Checks if there is a toolbar, and returns the first free client position
145 virtual wxPoint
GetClientAreaOrigin() const;
148 bool MSWOnPaint(void);
149 WXHICON
MSWOnQueryDragIcon(void);
150 void MSWOnSize(int x
, int y
, WXUINT flag
);
151 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
152 bool MSWOnClose(void);
153 void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
154 bool MSWProcessMessage(WXMSG
*msg
);
155 bool MSWTranslateMessage(WXMSG
*msg
);
156 void MSWCreate(int id
, wxWindow
*parent
, const char *WXUNUSED(wclass
), wxWindow
*wx_win
, const char *title
,
157 int x
, int y
, int width
, int height
, long style
);
160 // propagate our state change to all child frames
161 void IconizeChildFrames(bool bIconize
);
163 wxMenuBar
* m_frameMenuBar
;
164 wxStatusBar
* m_frameStatusBar
;
167 WXHICON m_defaultIcon
;
168 static bool m_useNativeStatusBar
;
169 wxToolBar
* m_frameToolBar
;
171 DECLARE_EVENT_TABLE()