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
|
|
|
|
// RCS-ID: $Id$
|
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
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-05-19 00:53:27 +00:00
|
|
|
#pragma interface "frame.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
2001-10-19 20:35:05 +00:00
|
|
|
class WXDLLEXPORT 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,
|
2001-06-26 20:59:19 +00:00
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = 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,
|
|
|
|
const wxString& name = wxFrameNameStr);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2001-10-19 20:35:05 +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
|
2000-02-08 19:14:50 +00:00
|
|
|
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
2001-09-24 00:34:14 +00:00
|
|
|
virtual void Raise();
|
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,
|
1999-01-31 23:38:10 +00:00
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxString& name = wxToolBarNameStr);
|
|
|
|
|
|
|
|
virtual void PositionToolBar();
|
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,
|
|
|
|
long style = wxST_SIZEGRIP,
|
|
|
|
wxWindowID id = 0,
|
|
|
|
const wxString& name = wxStatusLineNameStr);
|
1999-01-31 23:38:10 +00:00
|
|
|
|
|
|
|
virtual void PositionStatusBar();
|
1999-02-14 21:59:48 +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)
|
|
|
|
{ m_useNativeStatusBar = useNative; };
|
|
|
|
static bool UsesNativeStatusBar()
|
|
|
|
{ return m_useNativeStatusBar; };
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_STATUSBAR
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
WXHMENU GetWinMenu() const { return m_hMenu; }
|
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 HandlePaint();
|
|
|
|
bool HandleSize(int x, int y, WXUINT flag);
|
|
|
|
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
|
|
|
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
|
2002-02-23 23:16:32 +00:00
|
|
|
bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup);
|
1999-05-19 00:53:27 +00:00
|
|
|
|
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
|
|
|
|
|
2001-03-31 18:43:54 +00:00
|
|
|
// a MSW only function which sends a size event to the window using its
|
|
|
|
// current size - this has an effect of refreshing the window layout
|
2002-08-22 17:03:38 +00:00
|
|
|
virtual void SendSizeEvent();
|
2001-03-31 18:43:54 +00:00
|
|
|
|
2004-05-28 19:15:09 +00:00
|
|
|
virtual wxPoint GetClientAreaOrigin() const;
|
|
|
|
|
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
|
|
|
|
virtual void DoGetClientSize(int *width, int *height) const;
|
|
|
|
virtual void DoSetClientSize(int width, int height);
|
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
|
|
|
|
virtual void AttachMenuBar(wxMenuBar *menubar);
|
|
|
|
|
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
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// we add menu bar accel processing
|
|
|
|
bool MSWTranslateMessage(WXMSG* pMsg);
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// window proc for the frames
|
2004-02-25 10:45:02 +00:00
|
|
|
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
2001-05-08 01:09:21 +00:00
|
|
|
|
2003-07-12 23:09:04 +00:00
|
|
|
// handle WM_INITMENUPOPUP message
|
|
|
|
bool HandleInitMenuPopup(WXHMENU hMenu);
|
2003-07-09 10:15:21 +00:00
|
|
|
|
2000-11-25 23:13:29 +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
|
|
|
|
|
|
|
#if wxUSE_STATUSBAR
|
1999-01-31 23:38:10 +00:00
|
|
|
static bool m_useNativeStatusBar;
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_STATUSBAR
|
|
|
|
|
2000-02-08 19:14:50 +00:00
|
|
|
// Data to save/restore when calling ShowFullScreen
|
|
|
|
int m_fsStatusBarFields; // 0 for no status bar
|
|
|
|
int m_fsStatusBarHeight;
|
|
|
|
int m_fsToolBarHeight;
|
|
|
|
|
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;
|
|
|
|
|
1999-01-31 23:38:10 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_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_
|