wxFrameBase class for wxMSW and wxGTK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-16 21:31:40 +00:00
parent 40779a03e7
commit 7c0ea335c7
22 changed files with 1153 additions and 1120 deletions

View File

@@ -1,20 +1,216 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/frame.h
// Purpose: wxFrame class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 15.11.99
// RCS-ID: $Id$
// Copyright: (c) wxWindows team
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FRAME_H_BASE_
#define _WX_FRAME_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma interface "framebase.h"
#endif
#include "wx/window.h" // the base class
#include "wx/icon.h" // for m_icon
// the default names for various classs
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxStatusBar;
class WXDLLEXPORT wxToolBar;
// ----------------------------------------------------------------------------
// wxFrame is a top-level window with optional menubar, statusbar and toolbar
//
// For each of *bars, a frame may have several of them, but only one is
// managed by the frame, i.e. resized/moved when the frame is and whose size
// is accounted for in client size calculations - all others should be taken
// care of manually. The CreateXXXBar() functions create this, main, XXXBar,
// but the actual creation is done in OnCreateXXXBar() functions which may be
// overridden to create custom objects instead of standard ones when
// CreateXXXBar() is called.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxFrameBase : public wxWindow
{
public:
// construction
wxFrameBase();
wxFrame *New(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
// frame state
// -----------
// maximize = TRUE => maximize, otherwise - restore
virtual void Maximize(bool maximize = TRUE) = 0;
// undo Maximize() or Iconize()
virtual void Restore() = 0;
// iconize = TRUE => iconize, otherwise - restore
virtual void Iconize(bool iconize = TRUE) = 0;
// return TRUE if the frame is maximized
virtual bool IsMaximized() const = 0;
// return TRUE if the frame is iconized
virtual bool IsIconized() const = 0;
// get the frame icon
const wxIcon& GetIcon() const { return m_icon; }
// set the frame icon
virtual void SetIcon(const wxIcon& icon) { m_icon = icon; }
// make the window modal (all other windows unresponsive)
virtual void MakeModal(bool modal = TRUE);
// menu bar functions
// ------------------
virtual void SetMenuBar(wxMenuBar *menubar) = 0;
virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
// call this to simulate a menu command
bool Command(int id) { return ProcessCommand(id); }
// process menu command: returns TRUE if processed
bool ProcessCommand(int id);
// status bar functions
// --------------------
#if wxUSE_STATUSBAR
// create the main status bar by calling OnCreateStatusBar()
virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = wxST_SIZEGRIP,
wxWindowID id = 0,
const wxString& name =
wxStatusLineNameStr);
// return a new status bar
virtual wxStatusBar *OnCreateStatusBar(int number,
long style,
wxWindowID id,
const wxString& name);
// get the main status bar
virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
// sets the main status bar
void SetStatusBar(wxStatusBar *statBar) { m_frameStatusBar = statBar; }
// forward these to status bar
virtual void SetStatusText(const wxString &text, int number = 0);
virtual void SetStatusWidths(int n, const int widths_field[]);
#endif // wxUSE_STATUSBAR
// toolbar functions
// -----------------
#if wxUSE_TOOLBAR
// create main toolbar bycalling OnCreateToolBar()
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL,
wxWindowID id = -1,
const wxString& name = wxToolBarNameStr);
// return a new toolbar
virtual wxToolBar *OnCreateToolBar(long style,
wxWindowID id,
const wxString& name );
// get/set the main toolbar
virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
#endif // wxUSE_TOOLBAR
// old functions, use the new ones instead!
#if WXWIN_COMPATIBILITY_2
bool Iconized() const { return IsIconized(); }
#endif // WXWIN_COMPATIBILITY_2
// implementation only from now on
// -------------------------------
// override some base class virtuals
virtual bool Destroy();
virtual bool IsTopLevel() const { return TRUE; }
// event handlers
void OnIdle(wxIdleEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
void OnSize(wxSizeEvent& event);
// this should go away, but for now it's called from docview.cpp,
// so should be there for all platforms
void OnActivate(wxActivateEvent &WXUNUSED(event)) { }
// send wxUpdateUIEvents for all menu items (called from OnIdle())
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
protected:
// the frame main menu/status/tool bars
// ------------------------------------
// this (non virtual!) function should be called from dtor to delete the
// main menubar, statusbar and toolbar (if any)
void DeleteAllBars();
wxMenuBar *m_frameMenuBar;
#if wxUSE_STATUSBAR
// override to update status bar position (or anything else) when
// something changes
virtual void PositionStatusBar() { }
wxStatusBar *m_frameStatusBar;
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
// override to update status bar position (or anything else) when
// something changes
virtual void PositionToolBar() { }
wxToolBar *m_frameToolBar;
#endif // wxUSE_TOOLBAR
// the frame icon
wxIcon m_icon;
DECLARE_EVENT_TABLE()
};
// include the real class declaration
#if defined(__WXMSW__)
#include "wx/msw/frame.h"
#include "wx/msw/frame.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/frame.h"
#include "wx/motif/frame.h"
#elif defined(__WXGTK__)
#include "wx/gtk/frame.h"
#include "wx/gtk/frame.h"
#elif defined(__WXQT__)
#include "wx/qt/frame.h"
#include "wx/qt/frame.h"
#elif defined(__WXMAC__)
#include "wx/mac/frame.h"
#include "wx/mac/frame.h"
#elif defined(__WXPM__)
#include "wx/os2/frame.h"
#include "wx/os2/frame.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/frame.h"
#include "wx/stubs/frame.h"
#endif
#endif

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: frame.h
// Name: wx/gtk/frame.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
@@ -12,14 +12,9 @@
#define __GTKFRAMEH__
#ifdef __GNUG__
#pragma interface
#pragma interface "frame.h"
#endif
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/window.h"
#include "wx/icon.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
@@ -33,98 +28,78 @@ class wxStatusBar;
class wxFrame;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const wxChar *wxFrameNameStr;
extern const wxChar *wxToolBarNameStr;
//-----------------------------------------------------------------------------
// wxFrame
//-----------------------------------------------------------------------------
class wxFrame: public wxWindow
class wxFrame : public wxFrameBase
{
DECLARE_DYNAMIC_CLASS(wxFrame)
public:
// construction
wxFrame() { Init(); }
wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr );
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 );
~wxFrame();
bool Destroy();
wxFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
Init();
virtual bool Show( bool show );
virtual void Centre( int direction = wxBOTH );
Create(parent, id, title, pos, size, style, name);
}
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);
virtual ~wxFrame();
// implement base class pure virtuals
virtual void Maximize(bool maximize = TRUE);
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
virtual void MakeModal(bool modal = TRUE);
virtual void Restore();
virtual void SetMenuBar( wxMenuBar *menuBar );
#if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
const wxString& name = wxT("statusBar"));
virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id,
const wxString& name );
virtual wxStatusBar *GetStatusBar() const;
inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
virtual void SetStatusText( const wxString &text, int number = 0 );
virtual void SetStatusWidths( int n, const int widths_field[] );
virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = wxST_SIZEGRIP,
wxWindowID id = 0,
const wxString& name = wxStatusLineNameStr);
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1,
const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name );
virtual wxToolBar *GetToolBar() const;
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
wxWindowID id = -1,
const wxString& name = wxToolBarNameStr);
void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR
virtual void SetMenuBar( wxMenuBar *menuBar );
virtual wxMenuBar *GetMenuBar() const;
virtual bool Show(bool show);
virtual void SetTitle( const wxString &title );
virtual wxString GetTitle() const { return m_title; }
// make the window modal (all other windows unresponsive)
virtual void MakeModal(bool modal = TRUE);
virtual void SetIcon( const wxIcon &icon );
bool Iconized() const { return IsIconized(); }
virtual void Maximize( bool maximize );
virtual void Restore();
virtual void Iconize( bool iconize );
virtual bool IsIconized() const;
virtual bool IsTopLevel() const { return TRUE; }
virtual void Command( int id );
void OnCloseWindow( wxCloseEvent& event );
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
void OnIdle( wxIdleEvent &event );
void OnMenuHighlight( wxMenuEvent& event );
// implementation
// implementation from now on
// --------------------------
// GTK callbacks
virtual void GtkOnSize( int x, int y, int width, int height );
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
virtual void OnInternalIdle();
wxMenuBar *m_frameMenuBar;
#if wxUSE_STATUSBAR
wxStatusBar *m_frameStatusBar;
#endif
#if wxUSE_TOOLBAR
wxToolBar *m_frameToolBar;
#endif
wxString m_title;
wxIcon m_icon;
int m_miniEdge,m_miniTitle;
int m_miniEdge,
m_miniTitle;
GtkWidget *m_mainWidget;
bool m_menuBarDetached;
bool m_toolBarDetached;
@@ -133,7 +108,8 @@ public:
protected:
// common part of all ctors
void Init();
// override wxWindow methods to take into account tool/menu/statusbars
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
@@ -142,7 +118,7 @@ protected:
virtual void DoGetClientSize( int *width, int *height ) const;
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxFrame)
};
#endif // __GTKFRAMEH__

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: frame.h
// Name: wx/gtk/frame.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
@@ -12,14 +12,9 @@
#define __GTKFRAMEH__
#ifdef __GNUG__
#pragma interface
#pragma interface "frame.h"
#endif
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/window.h"
#include "wx/icon.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
@@ -33,98 +28,78 @@ class wxStatusBar;
class wxFrame;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const wxChar *wxFrameNameStr;
extern const wxChar *wxToolBarNameStr;
//-----------------------------------------------------------------------------
// wxFrame
//-----------------------------------------------------------------------------
class wxFrame: public wxWindow
class wxFrame : public wxFrameBase
{
DECLARE_DYNAMIC_CLASS(wxFrame)
public:
// construction
wxFrame() { Init(); }
wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr );
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 );
~wxFrame();
bool Destroy();
wxFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
Init();
virtual bool Show( bool show );
virtual void Centre( int direction = wxBOTH );
Create(parent, id, title, pos, size, style, name);
}
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);
virtual ~wxFrame();
// implement base class pure virtuals
virtual void Maximize(bool maximize = TRUE);
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
virtual void MakeModal(bool modal = TRUE);
virtual void Restore();
virtual void SetMenuBar( wxMenuBar *menuBar );
#if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
const wxString& name = wxT("statusBar"));
virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id,
const wxString& name );
virtual wxStatusBar *GetStatusBar() const;
inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
virtual void SetStatusText( const wxString &text, int number = 0 );
virtual void SetStatusWidths( int n, const int widths_field[] );
virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = wxST_SIZEGRIP,
wxWindowID id = 0,
const wxString& name = wxStatusLineNameStr);
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1,
const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name );
virtual wxToolBar *GetToolBar() const;
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
wxWindowID id = -1,
const wxString& name = wxToolBarNameStr);
void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR
virtual void SetMenuBar( wxMenuBar *menuBar );
virtual wxMenuBar *GetMenuBar() const;
virtual bool Show(bool show);
virtual void SetTitle( const wxString &title );
virtual wxString GetTitle() const { return m_title; }
// make the window modal (all other windows unresponsive)
virtual void MakeModal(bool modal = TRUE);
virtual void SetIcon( const wxIcon &icon );
bool Iconized() const { return IsIconized(); }
virtual void Maximize( bool maximize );
virtual void Restore();
virtual void Iconize( bool iconize );
virtual bool IsIconized() const;
virtual bool IsTopLevel() const { return TRUE; }
virtual void Command( int id );
void OnCloseWindow( wxCloseEvent& event );
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
void OnIdle( wxIdleEvent &event );
void OnMenuHighlight( wxMenuEvent& event );
// implementation
// implementation from now on
// --------------------------
// GTK callbacks
virtual void GtkOnSize( int x, int y, int width, int height );
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
virtual void OnInternalIdle();
wxMenuBar *m_frameMenuBar;
#if wxUSE_STATUSBAR
wxStatusBar *m_frameStatusBar;
#endif
#if wxUSE_TOOLBAR
wxToolBar *m_frameToolBar;
#endif
wxString m_title;
wxIcon m_icon;
int m_miniEdge,m_miniTitle;
int m_miniEdge,
m_miniTitle;
GtkWidget *m_mainWidget;
bool m_menuBarDetached;
bool m_toolBarDetached;
@@ -133,7 +108,8 @@ public:
protected:
// common part of all ctors
void Init();
// override wxWindow methods to take into account tool/menu/statusbars
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
@@ -142,7 +118,7 @@ protected:
virtual void DoGetClientSize( int *width, int *height ) const;
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxFrame)
};
#endif // __GTKFRAMEH__

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: frame.h
// Name: wx/msw/frame.h
// Purpose: wxFrame class
// Author: Julian Smart
// Modified by:
@@ -16,37 +16,24 @@
#pragma interface "frame.h"
#endif
#include "wx/window.h"
#include "wx/toolbar.h"
#include "wx/msw/accel.h"
#include "wx/icon.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxStatusBar;
class WXDLLEXPORT wxFrame : public wxWindow
class WXDLLEXPORT wxFrame : public wxFrameBase
{
DECLARE_DYNAMIC_CLASS(wxFrame)
public:
wxFrame();
// construction
wxFrame() { Init(); }
wxFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
Init();
Create(parent, id, title, pos, size, style, name);
}
~wxFrame();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
@@ -55,106 +42,63 @@ public:
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
virtual bool Destroy();
virtual ~wxFrame();
void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event);
void OnIdle(wxIdleEvent& event);
void OnCloseWindow(wxCloseEvent& event);
bool Show(bool show);
void DetachMenuBar();
// Set menu bar
void SetMenuBar(wxMenuBar *menu_bar);
virtual wxMenuBar *GetMenuBar() const;
// Call this to simulate a menu command
bool Command(int id) { return ProcessCommand(id); }
// process menu command: returns TRUE if processed
bool ProcessCommand(int id);
// make the window modal (all other windows unresponsive)
virtual void MakeModal(bool modal = TRUE);
// Set icon
// implement base class pure virtuals
virtual void Maximize(bool maximize = TRUE);
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
virtual void Restore();
virtual void SetMenuBar(wxMenuBar *menubar);
virtual void SetIcon(const wxIcon& icon);
// implementation only from now on
// -------------------------------
// override some more virtuals
virtual bool Show(bool show = TRUE);
// event handlers
void OnActivate(wxActivateEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Toolbar
#if wxUSE_TOOLBAR
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
wxWindowID id = -1,
const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
virtual void PositionToolBar();
#endif // wxUSE_TOOLBAR
#if wxUSE_STATUSBAR
// Status bar
virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = wxST_SIZEGRIP,
wxWindowID id = 0,
const wxString& name = wxStatusLineNameStr);
wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
#if wxUSE_STATUSBAR
virtual wxStatusBar* OnCreateStatusBar(int number = 1,
long style = wxST_SIZEGRIP,
wxWindowID id = 0,
const wxString& name = wxStatusLineNameStr);
virtual void PositionStatusBar();
virtual wxStatusBar *OnCreateStatusBar(int number,
long style,
wxWindowID id,
const wxString& name);
// Set status line text
virtual void SetStatusText(const wxString& text, int number = 0);
// 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
// Set status line widths
virtual void SetStatusWidths(int n, const int widths_field[]);
// Hint to tell framework which status bar to use
// TODO: should this go into a wxFrameworkSettings class perhaps?
static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
static void UseNativeStatusBar(bool useNative)
{ m_useNativeStatusBar = useNative; };
static bool UsesNativeStatusBar()
{ return m_useNativeStatusBar; };
#endif // wxUSE_STATUSBAR
// Iconize
virtual void Iconize(bool iconize);
virtual bool IsIconized() const;
// Is it maximized?
virtual bool IsMaximized() const;
// Compatibility
bool Iconized() const { return IsIconized(); }
virtual bool IsTopLevel() const { return TRUE; }
virtual void Maximize(bool maximize);
// virtual bool LoadAccelerators(const wxString& table);
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Query app for menu item updates (called from OnIdle)
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
WXHMENU GetWinMenu() const { return m_hMenu; }
// Returns the origin of client area (may be different from (0,0) if the
// frame has a toolbar)
virtual wxPoint GetClientAreaOrigin() const;
// Implementation only from here
// event handlers
// event handlers
bool HandlePaint();
bool HandleSize(int x, int y, WXUINT flag);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
@@ -164,13 +108,19 @@ public:
wxWindow *wx_win, const wxChar *title,
int x, int y, int width, int height, long style);
// tooltip management
// tooltip management
#if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
#endif // tooltips
protected:
// common part of all ctors
void Init();
// common part of Iconize(), Maximize() and Restore()
void DoShowWindow(int nShowCmd);
// override base class virtuals
virtual void DoGetClientSize(int *width, int *height) const;
virtual void DoGetSize(int *width, int *height) const;
@@ -181,6 +131,9 @@ protected:
virtual void DoClientToScreen(int *x, int *y) const;
virtual void DoScreenToClient(int *x, int *y) const;
// helper
void DetachMenuBar();
// a plug in for MDI frame classes which need to do something special when
// the menubar is set
virtual void InternalSetMenuBar();
@@ -194,27 +147,20 @@ protected:
// window proc for the frames
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
wxMenuBar * m_frameMenuBar;
wxIcon m_icon;
bool m_iconized;
WXHICON m_defaultIcon;
#if wxUSE_STATUSBAR
wxStatusBar * m_frameStatusBar;
static bool m_useNativeStatusBar;
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
wxToolBar * m_frameToolBar;
#endif // wxUSE_TOOLBAR
private:
#if wxUSE_TOOLTIPS
WXHWND m_hwndToolTip;
#endif // tooltips
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxFrame)
};
#endif

View File

@@ -19,9 +19,8 @@
// headers
// ----------------------------------------------------------------------------
#ifndef _DYNARRAY_H
#include <wx/dynarray.h>
#endif //_DYNARRAY_H
#include "wx/control.h"
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
// types

View File

@@ -88,7 +88,25 @@ protected:
WXHBITMAP m_hBitmap;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxToolBar95)
};
class WXDLLEXPORT wxToolBar : public wxToolBar95
{
public:
wxToolBar() { }
wxToolBar(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxNO_BORDER | wxTB_HORIZONTAL,
const wxString& name = wxToolBarNameStr)
: wxToolBar95(parent, id, pos, size, style, name)
{
}
private:
DECLARE_DYNAMIC_CLASS(wxToolBar)
};
#endif // wxUSE_TOOLBAR

View File

@@ -119,6 +119,26 @@ DECLARE_EVENT_TABLE()
#define wxTBSTATE_HIDDEN 0x08 // button is hidden
#define wxTBSTATE_INDETERMINATE 0x10 // button is indeterminate
class WXDLLEXPORT wxToolBar : public wxToolBarMSW
{
public:
wxToolBar() { }
wxToolBar(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxNO_BORDER | wxTB_HORIZONTAL,
const wxString& name = wxToolBarNameStr)
: wxToolBarMSW(parent, id, pos, size, style, name)
{
}
private:
DECLARE_DYNAMIC_CLASS(wxToolBar)
};
#endif // wxUSE_TOOL/BUTTONBAR
#endif
// _WX_TBARMSW_H_

View File

@@ -1,16 +1,10 @@
#ifndef _TOOLBAR_H_BASE_
#define _TOOLBAR_H_BASE_
// the application code should use only wxToolBar which is #define'd to be the
// native implementation for each platform
#if defined(__WXMSW__) && defined(__WIN95__)
# include "wx/msw/tbar95.h"
# define wxToolBar wxToolBar95
# define sm_classwxToolBar sm_classwxToolBar95
#elif defined(__WXMSW__)
# include "wx/msw/tbarmsw.h"
# define wxToolBar wxToolBarMSW
# define sm_classwxToolBar sm_classwxToolBarMSW
#elif defined(__WXMOTIF__)
# include "wx/motif/toolbar.h"
#elif defined(__WXGTK__)