1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-11-16 21:31:40 +00:00
|
|
|
// Name: wx/msw/frame.h
|
2001-10-19 20:35:05 +00:00
|
|
|
// Purpose: wxFrame class
|
1998-05-20 14:12:05 +00:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
2003-03-17 10:34:04 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_FRAME_H_
|
|
|
|
#define _WX_FRAME_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2014-09-10 14:50:20 +00:00
|
|
|
#if wxUSE_TASKBARBUTTON
|
2014-09-10 14:54:20 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
|
2014-09-10 14:50:20 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
|
1999-01-31 23:38:10 +00:00
|
|
|
{
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
1999-11-16 21:31:40 +00:00
|
|
|
// construction
|
2001-10-19 20:35:05 +00:00
|
|
|
wxFrame() { Init(); }
|
|
|
|
wxFrame(wxWindow *parent,
|
2005-11-13 11:46:24 +00:00
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
2019-10-22 10:34:29 +00:00
|
|
|
const wxString& name = wxASCII_STR(wxFrameNameStr))
|
1999-01-31 23:38:10 +00:00
|
|
|
{
|
1999-11-16 21:31:40 +00:00
|
|
|
Init();
|
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
2019-10-22 10:34:29 +00:00
|
|
|
const wxString& name = wxASCII_STR(wxFrameNameStr));
|
2014-09-10 14:54:20 +00:00
|
|
|
virtual ~wxFrame();
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// implement base class pure virtuals
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE;
|
1999-05-19 00:53:27 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// event handlers
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
// Toolbar
|
1999-06-13 22:54:04 +00:00
|
|
|
#if wxUSE_TOOLBAR
|
2003-07-10 10:53:00 +00:00
|
|
|
virtual wxToolBar* CreateToolBar(long style = -1,
|
2004-08-25 12:17:55 +00:00
|
|
|
wxWindowID id = wxID_ANY,
|
2019-10-22 10:34:29 +00:00
|
|
|
const wxString& name = wxASCII_STR(wxToolBarNameStr)) wxOVERRIDE;
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_TOOLBAR
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
// Status bar
|
1999-11-16 21:31:40 +00:00
|
|
|
#if wxUSE_STATUSBAR
|
|
|
|
virtual wxStatusBar* OnCreateStatusBar(int number = 1,
|
2009-04-25 12:59:09 +00:00
|
|
|
long style = wxSTB_DEFAULT_STYLE,
|
1999-11-16 21:31:40 +00:00
|
|
|
wxWindowID id = 0,
|
2019-10-22 10:34:29 +00:00
|
|
|
const wxString& name = wxASCII_STR(wxStatusLineNameStr)) wxOVERRIDE;
|
1999-01-31 23:38:10 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// Hint to tell framework which status bar to use: the default is to use
|
|
|
|
// native one for the platforms which support it (Win32), the generic one
|
|
|
|
// otherwise
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
// TODO: should this go into a wxFrameworkSettings class perhaps?
|
1999-11-16 21:31:40 +00:00
|
|
|
static void UseNativeStatusBar(bool useNative)
|
2007-04-14 09:58:37 +00:00
|
|
|
{ m_useNativeStatusBar = useNative; }
|
1999-11-16 21:31:40 +00:00
|
|
|
static bool UsesNativeStatusBar()
|
2007-04-14 09:58:37 +00:00
|
|
|
{ return m_useNativeStatusBar; }
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_STATUSBAR
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// event handlers
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleSize(int x, int y, WXUINT flag);
|
|
|
|
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
// tooltip management
|
1999-01-31 23:38:10 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
1999-05-13 21:21:04 +00:00
|
|
|
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
|
|
|
|
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
|
1999-01-31 23:38:10 +00:00
|
|
|
#endif // tooltips
|
|
|
|
|
2008-07-29 12:32:47 +00:00
|
|
|
// override the base class function to handle iconized/maximized frames
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual void SendSizeEvent(int flags = 0) wxOVERRIDE;
|
2001-03-31 18:43:54 +00:00
|
|
|
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE;
|
2004-08-25 12:17:55 +00:00
|
|
|
|
2006-05-07 01:14:50 +00:00
|
|
|
// override base class version to add menu bar accel processing
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual bool MSWTranslateMessage(WXMSG *msg) wxOVERRIDE
|
2006-05-07 01:14:50 +00:00
|
|
|
{
|
|
|
|
return MSWDoTranslateMessage(this, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
// window proc for the frames
|
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT message,
|
|
|
|
WXWPARAM wParam,
|
2016-09-23 14:59:11 +00:00
|
|
|
WXLPARAM lParam) wxOVERRIDE;
|
2006-05-07 01:14:50 +00:00
|
|
|
|
2009-01-26 23:18:47 +00:00
|
|
|
#if wxUSE_MENUS
|
|
|
|
// get the currently active menu: this is the same as the frame menu for
|
|
|
|
// normal frames but is overridden by wxMDIParentFrame
|
|
|
|
virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; }
|
2013-02-24 13:48:13 +00:00
|
|
|
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu) wxOVERRIDE;
|
|
|
|
virtual bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu) wxOVERRIDE;
|
2014-06-18 12:51:39 +00:00
|
|
|
|
2013-02-24 13:48:13 +00:00
|
|
|
// Look up the menu in the menu bar.
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu) wxOVERRIDE;
|
2009-01-26 23:18:47 +00:00
|
|
|
#endif // wxUSE_MENUS
|
|
|
|
|
2014-09-10 14:50:20 +00:00
|
|
|
#if wxUSE_TASKBARBUTTON
|
|
|
|
// Return the taskbar button of the window.
|
|
|
|
//
|
|
|
|
// The pointer returned by this method belongs to the window and will be
|
|
|
|
// deleted when the window itself is, do not delete it yourself. May return
|
|
|
|
// NULL if the initialization of taskbar button failed.
|
|
|
|
wxTaskBarButton* MSWGetTaskBarButton();
|
|
|
|
#endif // wxUSE_TASKBARBUTTON
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
protected:
|
1999-11-16 21:31:40 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// override base class virtuals
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE;
|
|
|
|
virtual void DoSetClientSize(int width, int height) wxOVERRIDE;
|
1999-05-10 00:42:57 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#if wxUSE_MENUS_NATIVE
|
2001-07-10 12:25:46 +00:00
|
|
|
// perform MSW-specific action when menubar is changed
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual void AttachMenuBar(wxMenuBar *menubar) wxOVERRIDE;
|
2001-07-10 12:25:46 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// a plug in for MDI frame classes which need to do something special when
|
|
|
|
// the menubar is set
|
|
|
|
virtual void InternalSetMenuBar();
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // wxUSE_MENUS_NATIVE
|
1999-05-19 00:53:27 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
// propagate our state change to all child frames
|
|
|
|
void IconizeChildFrames(bool bIconize);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2006-01-23 16:38:07 +00:00
|
|
|
// the real implementation of MSWTranslateMessage(), also used by
|
|
|
|
// wxMDIChildFrame
|
|
|
|
bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg);
|
1999-05-19 00:53:27 +00:00
|
|
|
|
2004-08-25 12:17:55 +00:00
|
|
|
virtual bool IsMDIChild() const { return false; }
|
1999-05-13 21:21:04 +00:00
|
|
|
|
2004-05-23 14:56:36 +00:00
|
|
|
// get default (wxWidgets) icon for the frame
|
2001-09-24 00:34:14 +00:00
|
|
|
virtual WXHICON GetDefaultIcon() const;
|
1999-06-13 22:54:04 +00:00
|
|
|
|
2006-05-07 01:14:50 +00:00
|
|
|
#if wxUSE_TOOLBAR
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual void PositionToolBar() wxOVERRIDE;
|
2006-05-07 01:14:50 +00:00
|
|
|
#endif // wxUSE_TOOLBAR
|
|
|
|
|
1999-06-13 22:54:04 +00:00
|
|
|
#if wxUSE_STATUSBAR
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual void PositionStatusBar() wxOVERRIDE;
|
2006-05-07 01:14:50 +00:00
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
static bool m_useNativeStatusBar;
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_STATUSBAR
|
|
|
|
|
2004-12-19 20:56:38 +00:00
|
|
|
#if wxUSE_MENUS
|
|
|
|
// frame menu, NULL if none
|
|
|
|
WXHMENU m_hMenu;
|
2014-06-18 12:51:39 +00:00
|
|
|
|
|
|
|
// The number of currently opened menus: 0 initially, 1 when a top level
|
|
|
|
// menu is opened, 2 when its submenu is opened and so on.
|
|
|
|
int m_menuDepth;
|
2004-12-19 20:56:38 +00:00
|
|
|
#endif // wxUSE_MENUS
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
private:
|
1999-01-31 23:38:10 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
WXHWND m_hwndToolTip;
|
|
|
|
#endif // tooltips
|
|
|
|
|
2001-11-14 01:26:14 +00:00
|
|
|
// used by IconizeChildFrames(), see comments there
|
|
|
|
bool m_wasMinimized;
|
|
|
|
|
2014-09-10 14:50:20 +00:00
|
|
|
#if wxUSE_TASKBARBUTTON
|
2014-09-10 14:54:20 +00:00
|
|
|
wxTaskBarButton* m_taskBarButton;
|
2014-09-10 14:50:20 +00:00
|
|
|
#endif
|
|
|
|
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame);
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_FRAME_H_
|