]>
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"
21 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr
;
23 class WXDLLEXPORT wxMenuBar
;
24 class WXDLLEXPORT wxStatusBar
;
26 class WXDLLEXPORT wxFrame
: public wxWindow
{
28 DECLARE_DYNAMIC_CLASS(wxFrame
)
32 inline wxFrame(wxWindow
*parent
,
34 const wxString
& title
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
37 const long style
= wxDEFAULT_FRAME_STYLE
,
38 const wxString
& name
= wxFrameNameStr
)
40 Create(parent
, id
, title
, pos
, size
, style
, name
);
45 bool Create(wxWindow
*parent
,
47 const wxString
& title
,
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
50 const long style
= wxDEFAULT_FRAME_STYLE
,
51 const wxString
& name
= wxFrameNameStr
);
53 #if WXWIN_COMPATIBILITY
54 // The default thing is to set the focus for the first child window.
55 // Override for your own behaviour.
56 virtual void OldOnActivate(bool flag
);
58 // Default behaviour is to display a help string for the menu item.
59 virtual void OldOnMenuSelect(int id
);
61 inline virtual void OldOnMenuCommand(int WXUNUSED(id
)) {}; // Called on frame menu command
62 void OldOnSize(int x
, int y
);
65 virtual bool Destroy(void);
66 void SetClientSize(const int width
, const int height
);
67 void GetClientSize(int *width
, int *height
) const;
69 void GetSize(int *width
, int *height
) const ;
70 void GetPosition(int *x
, int *y
) const ;
71 void SetSize(const int x
, const int y
, const int width
, const int height
, const int sizeFlags
= wxSIZE_AUTO
);
73 void OnSize(wxSizeEvent
& event
);
74 void OnMenuHighlight(wxMenuEvent
& event
);
75 void OnActivate(wxActivateEvent
& event
);
76 void OnIdle(wxIdleEvent
& event
);
77 void OnCloseWindow(wxCloseEvent
& event
);
79 bool Show(const bool show
);
82 void SetMenuBar(wxMenuBar
*menu_bar
);
83 virtual wxMenuBar
*GetMenuBar(void) const ;
86 void SetTitle(const wxString
& title
);
87 wxString
GetTitle(void) const ;
89 void Centre(const int direction
= wxBOTH
);
91 // Call this to simulate a menu command
92 virtual void Command(int id
);
93 virtual void ProcessCommand(int id
);
96 virtual void SetIcon(const wxIcon
& icon
);
99 virtual bool CreateStatusBar(const int number
=1);
100 inline wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
102 // Set status line text
103 virtual void SetStatusText(const wxString
& text
, const int number
= 0);
105 // Set status line widths
106 virtual void SetStatusWidths(const int n
, const int *widths_field
);
108 // Hint to tell framework which status bar to use
109 // TODO: should this go into a wxFrameworkSettings class perhaps?
110 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
111 static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar
; };
113 // Fit frame around subwindows
114 virtual void Fit(void);
117 virtual void Iconize(const bool iconize
);
119 virtual bool IsIconized(void) const ;
122 inline bool Iconized(void) const { return IsIconized(); }
124 virtual void Maximize(const bool maximize
);
125 virtual bool LoadAccelerators(const wxString
& table
);
127 virtual void PositionStatusBar(void);
128 virtual wxStatusBar
*OnCreateStatusBar(const int number
);
130 // Query app for menu item updates (called from OnIdle)
131 void DoMenuUpdates(void);
132 void DoMenuUpdates(wxMenu
* menu
);
134 WXHMENU
GetWinMenu(void) const ;
136 // Responds to colour changes
137 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
140 bool MSWOnPaint(void);
141 WXHICON
MSWOnQueryDragIcon(void);
142 void MSWOnSize(const int x
, const int y
, const WXUINT flag
);
143 bool MSWOnCommand(const WXWORD id
, const WXWORD cmd
, const WXHWND control
);
144 bool MSWOnClose(void);
145 void MSWOnMenuHighlight(const WXWORD item
, const WXWORD flags
, const WXHMENU sysmenu
);
146 bool MSWProcessMessage(WXMSG
*msg
);
147 void MSWCreate(const int id
, wxWindow
*parent
, const char *WXUNUSED(wclass
), wxWindow
*wx_win
, const char *title
,
148 const int x
, const int y
, const int width
, const int height
, const long style
);
151 wxMenuBar
* m_frameMenuBar
;
152 wxStatusBar
* m_frameStatusBar
;
155 WXHICON m_defaultIcon
;
156 static bool m_useNativeStatusBar
;
158 DECLARE_EVENT_TABLE()