wxTopLevelWindow (only for wxGTK for now)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,14 +17,23 @@
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/containr.h"
|
||||
#include "wx/toplevel.h"
|
||||
|
||||
// FIXME - temporary hack in absence of wxTLW !!
|
||||
#ifndef wxTopLevelWindowNative
|
||||
#include "wx/panel.h"
|
||||
class WXDLLEXPORT wxDialogBase : public wxPanel
|
||||
#else
|
||||
class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
#ifdef __DARWIN__
|
||||
~wxDialogBase() { }
|
||||
#endif
|
||||
wxDialogBase() { Init(); }
|
||||
~wxDialogBase() {}
|
||||
|
||||
void Init();
|
||||
|
||||
// the modal dialogs have a return code - usually the id of the last
|
||||
// pressed button
|
||||
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||
@@ -44,17 +53,22 @@ public:
|
||||
protected:
|
||||
// the return code from modal dialog
|
||||
int m_returnCode;
|
||||
|
||||
// FIXME - temporary hack in absence of wxTLW !!
|
||||
#ifdef wxTopLevelWindowNative
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_CONTROL_CONTAINER();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dialog.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dialog.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dialog.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/dialog.h"
|
||||
// FIXME_MGL -- belongs to wxUniv
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dialog.h"
|
||||
#elif defined(__WXPM__)
|
||||
|
@@ -20,8 +20,7 @@
|
||||
#pragma interface "framebase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h" // the base class
|
||||
#include "wx/icon.h" // for m_icon
|
||||
#include "wx/toplevel.h" // the base class
|
||||
|
||||
// the default names for various classs
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
|
||||
@@ -33,14 +32,6 @@ class WXDLLEXPORT wxMenuBar;
|
||||
class WXDLLEXPORT wxStatusBar;
|
||||
class WXDLLEXPORT wxToolBar;
|
||||
|
||||
// Styles for ShowFullScreen
|
||||
#define wxFULLSCREEN_NOMENUBAR 0x01
|
||||
#define wxFULLSCREEN_NOTOOLBAR 0x02
|
||||
#define wxFULLSCREEN_NOSTATUSBAR 0x04
|
||||
#define wxFULLSCREEN_NOBORDER 0x08
|
||||
#define wxFULLSCREEN_NOCAPTION 0x10
|
||||
#define wxFULLSCREEN_ALL (wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFrame is a top-level window with optional menubar, statusbar and toolbar
|
||||
//
|
||||
@@ -53,7 +44,12 @@ class WXDLLEXPORT wxToolBar;
|
||||
// CreateXXXBar() is called.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFrameBase : public wxWindow
|
||||
// FIXME - temporary hack in absence of wxTLW !!
|
||||
#ifndef wxTopLevelWindowNative
|
||||
class WXDLLEXPORT wxFrameBase : public wxTopLevelWindowBase
|
||||
#else
|
||||
class WXDLLEXPORT wxFrameBase : public wxTopLevelWindow
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
@@ -73,30 +69,6 @@ public:
|
||||
// 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);
|
||||
|
||||
// get the origin of the client area (which may be different from (0, 0)
|
||||
// if the frame has a toolbar) in client coordinates
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
@@ -157,27 +129,12 @@ public:
|
||||
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)) { }
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// send wxUpdateUIEvents for all menu items (called from OnIdle())
|
||||
@@ -231,17 +188,6 @@ protected:
|
||||
wxToolBar *m_frameToolBar;
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
// the frame client to screen translation should take account of the
|
||||
// toolbar which may shift the origin of the client area
|
||||
virtual void DoClientToScreen(int *x, int *y) const;
|
||||
virtual void DoScreenToClient(int *x, int *y) const;
|
||||
|
||||
// send the iconize event, return TRUE if processed
|
||||
bool SendIconizeEvent(bool iconized = TRUE);
|
||||
|
||||
// the frame icon
|
||||
wxIcon m_icon;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -16,8 +16,6 @@
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
@@ -51,63 +49,32 @@ public:
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString &name = wxDialogNameStr );
|
||||
~wxDialog();
|
||||
|
||||
void SetTitle(const wxString& title);
|
||||
wxString GetTitle() const;
|
||||
~wxDialog() {}
|
||||
|
||||
void OnApply( wxCommandEvent &event );
|
||||
void OnCancel( wxCommandEvent &event );
|
||||
void OnOK( wxCommandEvent &event );
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnSize( wxSizeEvent &event );
|
||||
void OnCloseWindow( wxCloseEvent& event );
|
||||
/*
|
||||
void OnCharHook( wxKeyEvent& event );
|
||||
*/
|
||||
|
||||
bool Destroy();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual int ShowModal();
|
||||
virtual void EndModal( int retCode );
|
||||
virtual bool IsModal() const;
|
||||
void SetModal( bool modal );
|
||||
|
||||
virtual void SetIcon( const wxIcon &icon );
|
||||
virtual void Iconize( bool WXUNUSED(iconize)) { }
|
||||
virtual bool IsIconized() const { return FALSE; }
|
||||
bool Iconized() const { return IsIconized(); }
|
||||
virtual void Maximize() { }
|
||||
virtual void Restore() { }
|
||||
|
||||
virtual bool IsTopLevel() const { return TRUE; }
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
// move the window to the specified location and resize it: this is called
|
||||
// from both DoSetSize() and DoSetClientSize()
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
bool m_modalShowing;
|
||||
wxString m_title;
|
||||
wxIcon m_icon;
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// common part of Destroy() and ~wxDialog
|
||||
void CleanUp();
|
||||
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
||||
|
@@ -58,18 +58,6 @@ public:
|
||||
|
||||
virtual ~wxFrameGTK();
|
||||
|
||||
// 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 bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
virtual void PositionStatusBar();
|
||||
|
||||
@@ -86,47 +74,21 @@ public:
|
||||
void SetToolBar(wxToolBar *toolbar);
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// move the window to the specified location and resize it: this is called
|
||||
// from both DoSetSize() and DoSetClientSize()
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
// GTK callbacks
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// do *not* call this to iconize the frame, this is a private function!
|
||||
void SetIconizeState(bool iconic);
|
||||
|
||||
wxString m_title;
|
||||
int m_miniEdge,
|
||||
m_miniTitle;
|
||||
GtkWidget *m_mainWidget;
|
||||
bool m_menuBarDetached;
|
||||
bool m_toolBarDetached;
|
||||
bool m_insertInClientArea; /* not from within OnCreateXXX */
|
||||
|
||||
bool m_fsIsShowing; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
wxRect m_fsSaveFrame;
|
||||
|
||||
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);
|
||||
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
|
||||
@@ -134,9 +96,6 @@ protected:
|
||||
virtual void DetachMenuBar();
|
||||
virtual void AttachMenuBar(wxMenuBar *menubar);
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_isIconized;
|
||||
};
|
||||
|
||||
#endif // __GTKFRAMEH__
|
||||
|
108
include/wx/gtk/toplevel.h
Normal file
108
include/wx/gtk/toplevel.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/toplevel.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __GTKTOPLEVELH__
|
||||
#define __GTKTOPLEVELH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "toplevel.h"
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTopLevelWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxTopLevelWindowGTK : public wxTopLevelWindowBase
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindowGTK() { Init(); }
|
||||
wxTopLevelWindowGTK(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();
|
||||
|
||||
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 ~wxTopLevelWindowGTK();
|
||||
|
||||
// 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 Restore();
|
||||
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// move the window to the specified location and resize it: this is called
|
||||
// from both DoSetSize() and DoSetClientSize()
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
// GTK callbacks
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// do *not* call this to iconize the frame, this is a private function!
|
||||
void SetIconizeState(bool iconic);
|
||||
|
||||
wxString m_title;
|
||||
int m_miniEdge,
|
||||
m_miniTitle;
|
||||
GtkWidget *m_mainWidget;
|
||||
bool m_insertInClientArea; /* not from within OnCreateXXX */
|
||||
|
||||
bool m_fsIsShowing; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
wxRect m_fsSaveFrame;
|
||||
|
||||
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);
|
||||
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_isIconized;
|
||||
};
|
||||
|
||||
#endif // __GTKTOPLEVELH__
|
@@ -16,8 +16,6 @@
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
@@ -51,63 +49,32 @@ public:
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString &name = wxDialogNameStr );
|
||||
~wxDialog();
|
||||
|
||||
void SetTitle(const wxString& title);
|
||||
wxString GetTitle() const;
|
||||
~wxDialog() {}
|
||||
|
||||
void OnApply( wxCommandEvent &event );
|
||||
void OnCancel( wxCommandEvent &event );
|
||||
void OnOK( wxCommandEvent &event );
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnSize( wxSizeEvent &event );
|
||||
void OnCloseWindow( wxCloseEvent& event );
|
||||
/*
|
||||
void OnCharHook( wxKeyEvent& event );
|
||||
*/
|
||||
|
||||
bool Destroy();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual int ShowModal();
|
||||
virtual void EndModal( int retCode );
|
||||
virtual bool IsModal() const;
|
||||
void SetModal( bool modal );
|
||||
|
||||
virtual void SetIcon( const wxIcon &icon );
|
||||
virtual void Iconize( bool WXUNUSED(iconize)) { }
|
||||
virtual bool IsIconized() const { return FALSE; }
|
||||
bool Iconized() const { return IsIconized(); }
|
||||
virtual void Maximize() { }
|
||||
virtual void Restore() { }
|
||||
|
||||
virtual bool IsTopLevel() const { return TRUE; }
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
// move the window to the specified location and resize it: this is called
|
||||
// from both DoSetSize() and DoSetClientSize()
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
bool m_modalShowing;
|
||||
wxString m_title;
|
||||
wxIcon m_icon;
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// common part of Destroy() and ~wxDialog
|
||||
void CleanUp();
|
||||
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
||||
|
@@ -58,18 +58,6 @@ public:
|
||||
|
||||
virtual ~wxFrameGTK();
|
||||
|
||||
// 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 bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
virtual void PositionStatusBar();
|
||||
|
||||
@@ -86,47 +74,21 @@ public:
|
||||
void SetToolBar(wxToolBar *toolbar);
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// move the window to the specified location and resize it: this is called
|
||||
// from both DoSetSize() and DoSetClientSize()
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
// GTK callbacks
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// do *not* call this to iconize the frame, this is a private function!
|
||||
void SetIconizeState(bool iconic);
|
||||
|
||||
wxString m_title;
|
||||
int m_miniEdge,
|
||||
m_miniTitle;
|
||||
GtkWidget *m_mainWidget;
|
||||
bool m_menuBarDetached;
|
||||
bool m_toolBarDetached;
|
||||
bool m_insertInClientArea; /* not from within OnCreateXXX */
|
||||
|
||||
bool m_fsIsShowing; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
wxRect m_fsSaveFrame;
|
||||
|
||||
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);
|
||||
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
|
||||
@@ -134,9 +96,6 @@ protected:
|
||||
virtual void DetachMenuBar();
|
||||
virtual void AttachMenuBar(wxMenuBar *menubar);
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_isIconized;
|
||||
};
|
||||
|
||||
#endif // __GTKFRAMEH__
|
||||
|
108
include/wx/gtk1/toplevel.h
Normal file
108
include/wx/gtk1/toplevel.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/toplevel.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __GTKTOPLEVELH__
|
||||
#define __GTKTOPLEVELH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "toplevel.h"
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTopLevelWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxTopLevelWindowGTK : public wxTopLevelWindowBase
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindowGTK() { Init(); }
|
||||
wxTopLevelWindowGTK(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();
|
||||
|
||||
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 ~wxTopLevelWindowGTK();
|
||||
|
||||
// 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 Restore();
|
||||
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// move the window to the specified location and resize it: this is called
|
||||
// from both DoSetSize() and DoSetClientSize()
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
// GTK callbacks
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// do *not* call this to iconize the frame, this is a private function!
|
||||
void SetIconizeState(bool iconic);
|
||||
|
||||
wxString m_title;
|
||||
int m_miniEdge,
|
||||
m_miniTitle;
|
||||
GtkWidget *m_mainWidget;
|
||||
bool m_insertInClientArea; /* not from within OnCreateXXX */
|
||||
|
||||
bool m_fsIsShowing; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
wxRect m_fsSaveFrame;
|
||||
|
||||
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);
|
||||
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_isIconized;
|
||||
};
|
||||
|
||||
#endif // __GTKTOPLEVELH__
|
84
include/wx/mgl/toplevel.h
Normal file
84
include/wx/mgl/toplevel.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/mgl/toplevel.h
|
||||
// Purpose: Top level window, abstraction of wxFrame and wxDialog
|
||||
// Author: Vaclav Slavik
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __WX_TOPLEVEL_H__
|
||||
#define __WX_TOPLEVEL_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "toplevel.h"
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTopLevelWindowMGL
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxTopLevelWindowMGL : public wxTopLevelWindowBase
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindowMGL() { Init(); }
|
||||
wxTopLevelWindowMGL(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();
|
||||
|
||||
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 ~wxTopLevelWindowMGL();
|
||||
|
||||
// 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 bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; }
|
||||
|
||||
virtual void SetTitle(const wxString &title) { m_title = title; }
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
wxString m_title;
|
||||
bool m_fsIsShowing; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
wxRect m_fsSaveFrame;
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_isIconized;
|
||||
// and maximized?
|
||||
bool m_isMaximized;
|
||||
wxRect m_savedFrame;
|
||||
};
|
||||
|
||||
#endif // __WX_TOPLEVEL_H__
|
@@ -2,33 +2,163 @@
|
||||
// Name: wx/toplevel.h
|
||||
// Purpose: declares wxTopLevelWindow class, the base class for all
|
||||
// top level windows (such as frames and dialogs)
|
||||
// Author: Vadim Zeitlin
|
||||
// Author: Vadim Zeitlin, Vaclav Slavik
|
||||
// Modified by:
|
||||
// Created: 06.08.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Vaclav Slavik <vaclav@wxwindows.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TOPLEVEL_H_
|
||||
#define _WX_TOPLEVEL_H_
|
||||
#ifndef _WX_TOPLEVEL_BASE_H_
|
||||
#define _WX_TOPLEVEL_BASE_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "toplevelbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
// the default names for various classs
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
|
||||
|
||||
class WXDLLEXPORT wxTopLevelWindowBase;
|
||||
|
||||
// Dialogs are created in a special way
|
||||
#define wxTLW_EX_DIALOG 0x00000008
|
||||
|
||||
// Styles for ShowFullScreen
|
||||
// (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and
|
||||
// wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow)
|
||||
#define wxFULLSCREEN_NOMENUBAR 0x01
|
||||
#define wxFULLSCREEN_NOTOOLBAR 0x02
|
||||
#define wxFULLSCREEN_NOSTATUSBAR 0x04
|
||||
#define wxFULLSCREEN_NOBORDER 0x08
|
||||
#define wxFULLSCREEN_NOCAPTION 0x10
|
||||
#define wxFULLSCREEN_ALL (wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTopLevelWindow: a top level (as opposed to child) window
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTopLevelWindow : public wxWindow
|
||||
class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindowBase();
|
||||
|
||||
// top level wnd 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; }
|
||||
|
||||
/*
|
||||
for now we already have them in wxWindow, but this is wrong: these
|
||||
methods really only make sense for wxTopLevelWindow!
|
||||
|
||||
virtual void SetTitle( const wxString& title) = 0;
|
||||
virtual void SetTitle(const wxString& title) = 0;
|
||||
virtual wxString GetTitle() const = 0;
|
||||
*/
|
||||
|
||||
// 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 OnCloseWindow(wxCloseEvent& 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)) { }
|
||||
|
||||
protected:
|
||||
// the frame client to screen translation should take account of the
|
||||
// toolbar which may shift the origin of the client area
|
||||
virtual void DoClientToScreen(int *x, int *y) const;
|
||||
virtual void DoScreenToClient(int *x, int *y) const;
|
||||
|
||||
// send the iconize event, return TRUE if processed
|
||||
bool SendIconizeEvent(bool iconized = TRUE);
|
||||
|
||||
// the frame icon
|
||||
wxIcon m_icon;
|
||||
|
||||
// test whether this window makes part of the frame
|
||||
// (menubar, toolbar and statusbar are excluded from automatic layout)
|
||||
virtual bool IsOneOfBars(const wxWindow *WXUNUSED(win)) const { return FALSE; }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_TOPLEVEL_H_
|
||||
|
||||
// include the real class declaration
|
||||
#if defined(__WXGTK__)
|
||||
#include "wx/gtk/toplevel.h"
|
||||
#define wxTopLevelWindowNative wxTopLevelWindowGTK
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/toplevel.h"
|
||||
#define wxTopLevelWindowNative wxTopLevelWindowMGL
|
||||
#endif
|
||||
|
||||
#ifdef __WXUNIVERSAL__
|
||||
#include "wx/univ/toplevel.h"
|
||||
#else // !__WXUNIVERSAL__
|
||||
#ifdef wxTopLevelWindowNative
|
||||
class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindow() { Init(); }
|
||||
wxTopLevelWindow(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();
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxTopLevelWindow)
|
||||
};
|
||||
#endif // wxTopLevelWindowNative
|
||||
#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__
|
||||
|
||||
|
||||
#endif // _WX_TOPLEVEL_BASE_H_
|
||||
|
0
include/wx/univ/toplevel.h
Normal file
0
include/wx/univ/toplevel.h
Normal file
Reference in New Issue
Block a user