]>
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"
22 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr
;
23 WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr
;
25 class WXDLLEXPORT wxMenuBar
;
26 class WXDLLEXPORT wxStatusBar
;
28 class WXDLLEXPORT wxFrame
: public wxWindow
{
30 DECLARE_DYNAMIC_CLASS(wxFrame
)
34 inline wxFrame(wxWindow
*parent
,
36 const wxString
& title
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
39 long style
= wxDEFAULT_FRAME_STYLE
,
40 const wxString
& name
= wxFrameNameStr
)
42 Create(parent
, id
, title
, pos
, size
, style
, name
);
47 bool Create(wxWindow
*parent
,
49 const wxString
& title
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
52 long style
= wxDEFAULT_FRAME_STYLE
,
53 const wxString
& name
= wxFrameNameStr
);
55 virtual bool Destroy(void);
56 void SetClientSize(int width
, int height
);
57 void GetClientSize(int *width
, int *height
) const;
59 void GetSize(int *width
, int *height
) const ;
60 void GetPosition(int *x
, int *y
) const ;
61 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
63 virtual bool OnClose(void);
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
);
74 void SetMenuBar(wxMenuBar
*menu_bar
);
75 virtual wxMenuBar
*GetMenuBar(void) const ;
78 void SetTitle(const wxString
& title
);
79 wxString
GetTitle(void) const ;
81 void Centre(int direction
= wxBOTH
);
83 // Call this to simulate a menu command
84 virtual void Command(int id
);
85 virtual void ProcessCommand(int id
);
88 virtual void SetIcon(const wxIcon
& icon
);
91 virtual wxStatusBar
* CreateStatusBar(int number
=1, long style
= wxST_SIZEGRIP
, wxWindowID id
= 0,
92 const wxString
& name
= "statusBar");
93 inline wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
94 virtual void PositionStatusBar(void);
95 virtual wxStatusBar
*OnCreateStatusBar(int number
, long style
, wxWindowID id
,
96 const wxString
& name
);
99 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
|wxTB_HORIZONTAL
, wxWindowID id
= -1, const wxString
& name
= wxToolBarNameStr
);
100 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
101 // If made known to the frame, the frame will manage it automatically.
102 virtual inline void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
103 virtual inline wxToolBar
*GetToolBar(void) const { return m_frameToolBar
; }
104 virtual void PositionToolBar(void);
106 // Set status line text
107 virtual void SetStatusText(const wxString
& text
, int number
= 0);
109 // Set status line widths
110 virtual void SetStatusWidths(int n
, const int widths_field
[]);
112 // Hint to tell framework which status bar to use
113 // TODO: should this go into a wxFrameworkSettings class perhaps?
114 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
115 static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar
; };
117 // Fit frame around subwindows
118 virtual void Fit(void);
121 virtual void Iconize(bool iconize
);
123 virtual bool IsIconized(void) const ;
126 inline bool Iconized(void) const { return IsIconized(); }
128 virtual void Maximize(bool maximize
);
129 virtual bool LoadAccelerators(const wxString
& table
);
131 // Responds to colour changes
132 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
134 // Query app for menu item updates (called from OnIdle)
135 void DoMenuUpdates(void);
136 void DoMenuUpdates(wxMenu
* menu
);
138 WXHMENU
GetWinMenu(void) const ;
140 // Checks if there is a toolbar, and returns the first free client position
141 virtual wxPoint
GetClientAreaOrigin() const;
144 bool MSWOnPaint(void);
145 WXHICON
MSWOnQueryDragIcon(void);
146 void MSWOnSize(int x
, int y
, WXUINT flag
);
147 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
148 bool MSWOnClose(void);
149 void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
150 bool MSWProcessMessage(WXMSG
*msg
);
151 void MSWCreate(int id
, wxWindow
*parent
, const char *WXUNUSED(wclass
), wxWindow
*wx_win
, const char *title
,
152 int x
, int y
, int width
, int height
, long style
);
155 wxMenuBar
* m_frameMenuBar
;
156 wxStatusBar
* m_frameStatusBar
;
159 WXHICON m_defaultIcon
;
160 static bool m_useNativeStatusBar
;
161 wxToolBar
* m_frameToolBar
;
163 DECLARE_EVENT_TABLE()