mdi private menus
Chris's check menu additions frame fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
47fa796902
commit
716b736420
@ -1,9 +1,9 @@
|
||||
$Id$
|
||||
<br>
|
||||
<H1>Proposal for a wxQt project</H1>
|
||||
<H1>Proposal for a port of wxWindows to Qt - wxQt</H1>
|
||||
<p>
|
||||
Following the recent discussions
|
||||
and flamewars about KDE vs Gnome, I got worried that we see a
|
||||
and flamewars about KDE vs Gnome, we got worried that we'll see a
|
||||
repetition of the same damaging infighting from which Unix has
|
||||
suffered before. Competition is a good thing, but the current
|
||||
situation leaves application developers with a difficult decision to
|
||||
@ -16,10 +16,10 @@
|
||||
|
||||
The people on the wxWindows developers team thought that we might have
|
||||
a solution for this problem, if we can get some outside help to get it
|
||||
done. Let me explain: wxWindows is a cross-platform development
|
||||
done. Let us explain: wxWindows is a cross-platform development
|
||||
toolkit, a library of C++ classes which provide GUI concepts as well
|
||||
as other cross-platform issues such as container classes, debug
|
||||
features or configuration management. It has been around since 1992G
|
||||
features or configuration management. It has been around since 1992
|
||||
and started by supporting Motif, XView and MS-Windows, with a direct
|
||||
X11/Xt port added later. Last year, a major rewrite was started and we
|
||||
now have a much advanced library, available for MS Windows, with a
|
||||
@ -37,10 +37,10 @@
|
||||
operating systems (a MacOS port is under construction, too), it could
|
||||
easily bridge the gap between KDE and Gnome. The quick evolution of
|
||||
wxGTK has shown that a new port based on an existing widget set or
|
||||
toolkit can easily be created by a small team within few
|
||||
toolkit can easily be created by a small team within a few
|
||||
months. Therefore, we would like to start a project for a Qt/Harmony
|
||||
based wxWindow library, wxQt. It would then be possible for
|
||||
application developers to write the same source and copile it either
|
||||
application developers to write the same source and compile it either
|
||||
for KDE, Gnome or even any of the other supported systems.
|
||||
<p>
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
code from the other ports.
|
||||
|
||||
Please, join us in this effort and, if you feel that you could
|
||||
contribute, join the wxWindows developers mainling list for further
|
||||
contribute, join the wxWindows developers mailing list for further
|
||||
discussions. Just send a mail containing "<tt>subscribe</tt>" to
|
||||
<tt>wxwin-developers-request@x.dent.med.uni-muenchen.de</tt>
|
||||
<p>
|
||||
|
@ -28,7 +28,7 @@
|
||||
class wxDC;
|
||||
class wxPaintDC;
|
||||
class wxMemoryDC;
|
||||
class wxToolBarGTK;
|
||||
class wxToolBar;
|
||||
class wxBitmapButton;
|
||||
class wxStaticBitmap;
|
||||
|
||||
@ -56,7 +56,7 @@ class wxMask: public wxObject
|
||||
friend wxBitmap;
|
||||
friend wxDC;
|
||||
friend wxPaintDC;
|
||||
friend wxToolBarGTK;
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
|
||||
@ -116,7 +116,7 @@ class wxBitmap: public wxObject
|
||||
friend wxDC;
|
||||
friend wxPaintDC;
|
||||
friend wxMemoryDC;
|
||||
friend wxToolBarGTK;
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxRadioBox;
|
||||
class wxMDIChildFrame;
|
||||
|
||||
class wxFrame;
|
||||
|
||||
@ -73,16 +73,18 @@ class wxFrame: public wxWindow
|
||||
|
||||
//private:
|
||||
|
||||
void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
void DoMenuUpdates(void);
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend wxWindow;
|
||||
friend wxMDIChildFrame;
|
||||
|
||||
GtkWidget *m_mainWindow;
|
||||
wxMenuBar *m_frameMenuBar;
|
||||
GtkWidget *m_mainWindow;
|
||||
wxStatusBar *m_frameStatusBar;
|
||||
bool m_doingOnSize;
|
||||
wxString m_title;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "wx/control.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/toolbar.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
@ -63,30 +64,40 @@ class wxMDIParentFrame: public wxFrame
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
|
||||
void OnSize( wxSizeEvent& event );
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
|
||||
void SetMenuBar( wxMenuBar *menu_bar );
|
||||
void GetClientSize(int *width, int *height) const;
|
||||
wxMDIChildFrame *GetActiveChild(void) const;
|
||||
|
||||
wxMDIClientWindow *GetClientWindow(void) const;
|
||||
virtual wxMDIClientWindow *OnCreateClient(void);
|
||||
|
||||
virtual void Cascade(void) {};
|
||||
virtual void Tile(void) {};
|
||||
virtual void ArrangeIcons(void) {};
|
||||
virtual void ActivateNext(void);
|
||||
virtual void ActivatePrevious(void);
|
||||
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
void GetClientSize(int *width, int *height) const;
|
||||
wxMDIChildFrame *GetActiveChild(void) const;
|
||||
|
||||
protected:
|
||||
wxMDIClientWindow * m_clientWindow;
|
||||
wxMDIChildFrame * m_currentChild;
|
||||
bool m_parentFrameActive;
|
||||
virtual void SetToolBar( wxToolBar *toolbar );
|
||||
virtual wxWindow *GetToolBar(void) const;
|
||||
|
||||
wxMDIClientWindow *GetClientWindow(void) const;
|
||||
virtual wxMDIClientWindow *OnCreateClient(void);
|
||||
|
||||
virtual void Cascade(void) {};
|
||||
virtual void Tile(void) {};
|
||||
virtual void ArrangeIcons(void) {};
|
||||
virtual void ActivateNext(void);
|
||||
virtual void ActivatePrevious(void);
|
||||
|
||||
// DECLARE_EVENT_TABLE()
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void OnSysColourChanged( wxSysColourChangedEvent& event );
|
||||
|
||||
//private:
|
||||
|
||||
wxMDIChildFrame *m_currentChild;
|
||||
|
||||
void SetMDIMenuBar( wxMenuBar *menu_bar );
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
|
||||
private:
|
||||
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
bool m_parentFrameActive;
|
||||
wxMenuBar *m_mdiMenuBar;
|
||||
wxToolBar *m_toolBar;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -120,9 +131,19 @@ class wxMDIChildFrame: public wxPanel
|
||||
virtual void Restore(void) {};
|
||||
virtual void Activate(void);
|
||||
|
||||
bool Destroy(void);
|
||||
void OnCloseWindow( wxCloseEvent& event );
|
||||
|
||||
public:
|
||||
|
||||
wxString m_title;
|
||||
wxString m_title;
|
||||
wxMenuBar *m_menuBar;
|
||||
|
||||
// private:
|
||||
|
||||
GtkNotebookPage *m_page;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -48,6 +48,9 @@ class wxMenuBar: public wxWindow
|
||||
wxMenuBar(void);
|
||||
void Append( wxMenu *menu, const wxString &title );
|
||||
int FindMenuItem( const wxString &menuString, const wxString &itemString ) const;
|
||||
wxMenuItem* FindMenuItemById( int id ) const;
|
||||
bool IsChecked( int id ) const;
|
||||
bool IsEnabled( int id ) const;
|
||||
|
||||
wxList m_menus;
|
||||
GtkWidget *m_menubar;
|
||||
@ -76,14 +79,16 @@ class wxMenuItem: public wxObject
|
||||
|
||||
GtkWidget *m_menuItem; // GtkMenuItem
|
||||
|
||||
bool IsSeparator() const { return m_id == ID_SEPARATOR; }
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
bool IsChecked() const { return m_checked; }
|
||||
|
||||
int GetId() const { return m_id; }
|
||||
const wxString& GetHelp() const { return m_helpStr; }
|
||||
wxMenu *GetSubMenu() const { return m_subMenu; }
|
||||
|
||||
bool IsCheckable() const { return m_isCheckMenu; }
|
||||
bool IsSeparator() const { return m_id == ID_SEPARATOR; }
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
int GetId() const { return m_id; }
|
||||
const wxString& GetHelp() const { return m_helpStr; }
|
||||
wxMenu *GetSubMenu() const { return m_subMenu; }
|
||||
|
||||
void Check( bool check );
|
||||
bool IsChecked() const;
|
||||
void Enable( bool enable );
|
||||
};
|
||||
|
||||
class wxMenu: public wxEvtHandler
|
||||
@ -99,6 +104,7 @@ class wxMenu: public wxEvtHandler
|
||||
void Append( int id, const wxString &item,
|
||||
wxMenu *subMenu, const wxString &helpStr = "" );
|
||||
int FindItem( const wxString itemString ) const;
|
||||
wxMenuItem* FindItemForId( int id ) const;
|
||||
void Break(void) {};
|
||||
void Check(int id, bool Flag);
|
||||
void Enable( int id, bool enable );
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tabctrl.h
|
||||
// Purpose: wxTabCtrl class
|
||||
// Name: notebook.h
|
||||
// Purpose: wxNotebook class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// RCS-ID: $Id$
|
||||
@ -8,8 +8,8 @@
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __TABCTRLH__
|
||||
#define __TABCTRLH__
|
||||
#ifndef __NOTEBOOKH__
|
||||
#define __NOTEBOOKH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "notebook.h"
|
||||
@ -186,4 +186,4 @@ typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
|
||||
},
|
||||
|
||||
#endif
|
||||
// __TABCTRLH__
|
||||
// __NOTEBOOKH__
|
||||
|
@ -24,7 +24,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToolBarTool;
|
||||
class wxToolBarGTK;
|
||||
class wxToolBar;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constants
|
||||
@ -50,7 +50,7 @@ class wxToolBarTool: public wxObject
|
||||
public:
|
||||
|
||||
wxToolBarTool(void) {};
|
||||
wxToolBarTool( wxToolBarGTK *owner, int theIndex = 0,
|
||||
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
||||
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
||||
bool toggle = FALSE, wxObject *clientData = NULL,
|
||||
const wxString& shortHelpString = "", const wxString& longHelpString = "");
|
||||
@ -70,24 +70,24 @@ class wxToolBarTool: public wxObject
|
||||
bool m_isMenuCommand;
|
||||
wxString m_shortHelpString;
|
||||
wxString m_longHelpString;
|
||||
wxToolBarGTK *m_owner;
|
||||
wxToolBar *m_owner;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolBarGTK
|
||||
// wxToolBar
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToolBarGTK: public wxControl
|
||||
class wxToolBar: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBarGTK)
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||
|
||||
public:
|
||||
|
||||
wxToolBarGTK(void);
|
||||
wxToolBarGTK( wxWindow *parent, wxWindowID id,
|
||||
wxToolBar(void);
|
||||
wxToolBar( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxToolBarNameStr );
|
||||
~wxToolBarGTK(void);
|
||||
~wxToolBar(void);
|
||||
|
||||
bool Create( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
|
@ -28,7 +28,7 @@
|
||||
class wxDC;
|
||||
class wxPaintDC;
|
||||
class wxMemoryDC;
|
||||
class wxToolBarGTK;
|
||||
class wxToolBar;
|
||||
class wxBitmapButton;
|
||||
class wxStaticBitmap;
|
||||
|
||||
@ -56,7 +56,7 @@ class wxMask: public wxObject
|
||||
friend wxBitmap;
|
||||
friend wxDC;
|
||||
friend wxPaintDC;
|
||||
friend wxToolBarGTK;
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
|
||||
@ -116,7 +116,7 @@ class wxBitmap: public wxObject
|
||||
friend wxDC;
|
||||
friend wxPaintDC;
|
||||
friend wxMemoryDC;
|
||||
friend wxToolBarGTK;
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxRadioBox;
|
||||
class wxMDIChildFrame;
|
||||
|
||||
class wxFrame;
|
||||
|
||||
@ -73,16 +73,18 @@ class wxFrame: public wxWindow
|
||||
|
||||
//private:
|
||||
|
||||
void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
void DoMenuUpdates(void);
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend wxWindow;
|
||||
friend wxMDIChildFrame;
|
||||
|
||||
GtkWidget *m_mainWindow;
|
||||
wxMenuBar *m_frameMenuBar;
|
||||
GtkWidget *m_mainWindow;
|
||||
wxStatusBar *m_frameStatusBar;
|
||||
bool m_doingOnSize;
|
||||
wxString m_title;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "wx/control.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/toolbar.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
@ -63,30 +64,40 @@ class wxMDIParentFrame: public wxFrame
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr );
|
||||
|
||||
void OnSize( wxSizeEvent& event );
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
|
||||
void SetMenuBar( wxMenuBar *menu_bar );
|
||||
void GetClientSize(int *width, int *height) const;
|
||||
wxMDIChildFrame *GetActiveChild(void) const;
|
||||
|
||||
wxMDIClientWindow *GetClientWindow(void) const;
|
||||
virtual wxMDIClientWindow *OnCreateClient(void);
|
||||
|
||||
virtual void Cascade(void) {};
|
||||
virtual void Tile(void) {};
|
||||
virtual void ArrangeIcons(void) {};
|
||||
virtual void ActivateNext(void);
|
||||
virtual void ActivatePrevious(void);
|
||||
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
void GetClientSize(int *width, int *height) const;
|
||||
wxMDIChildFrame *GetActiveChild(void) const;
|
||||
|
||||
protected:
|
||||
wxMDIClientWindow * m_clientWindow;
|
||||
wxMDIChildFrame * m_currentChild;
|
||||
bool m_parentFrameActive;
|
||||
virtual void SetToolBar( wxToolBar *toolbar );
|
||||
virtual wxWindow *GetToolBar(void) const;
|
||||
|
||||
wxMDIClientWindow *GetClientWindow(void) const;
|
||||
virtual wxMDIClientWindow *OnCreateClient(void);
|
||||
|
||||
virtual void Cascade(void) {};
|
||||
virtual void Tile(void) {};
|
||||
virtual void ArrangeIcons(void) {};
|
||||
virtual void ActivateNext(void);
|
||||
virtual void ActivatePrevious(void);
|
||||
|
||||
// DECLARE_EVENT_TABLE()
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void OnSysColourChanged( wxSysColourChangedEvent& event );
|
||||
|
||||
//private:
|
||||
|
||||
wxMDIChildFrame *m_currentChild;
|
||||
|
||||
void SetMDIMenuBar( wxMenuBar *menu_bar );
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
|
||||
private:
|
||||
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
bool m_parentFrameActive;
|
||||
wxMenuBar *m_mdiMenuBar;
|
||||
wxToolBar *m_toolBar;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -120,9 +131,19 @@ class wxMDIChildFrame: public wxPanel
|
||||
virtual void Restore(void) {};
|
||||
virtual void Activate(void);
|
||||
|
||||
bool Destroy(void);
|
||||
void OnCloseWindow( wxCloseEvent& event );
|
||||
|
||||
public:
|
||||
|
||||
wxString m_title;
|
||||
wxString m_title;
|
||||
wxMenuBar *m_menuBar;
|
||||
|
||||
// private:
|
||||
|
||||
GtkNotebookPage *m_page;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -48,6 +48,9 @@ class wxMenuBar: public wxWindow
|
||||
wxMenuBar(void);
|
||||
void Append( wxMenu *menu, const wxString &title );
|
||||
int FindMenuItem( const wxString &menuString, const wxString &itemString ) const;
|
||||
wxMenuItem* FindMenuItemById( int id ) const;
|
||||
bool IsChecked( int id ) const;
|
||||
bool IsEnabled( int id ) const;
|
||||
|
||||
wxList m_menus;
|
||||
GtkWidget *m_menubar;
|
||||
@ -76,14 +79,16 @@ class wxMenuItem: public wxObject
|
||||
|
||||
GtkWidget *m_menuItem; // GtkMenuItem
|
||||
|
||||
bool IsSeparator() const { return m_id == ID_SEPARATOR; }
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
bool IsChecked() const { return m_checked; }
|
||||
|
||||
int GetId() const { return m_id; }
|
||||
const wxString& GetHelp() const { return m_helpStr; }
|
||||
wxMenu *GetSubMenu() const { return m_subMenu; }
|
||||
|
||||
bool IsCheckable() const { return m_isCheckMenu; }
|
||||
bool IsSeparator() const { return m_id == ID_SEPARATOR; }
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
int GetId() const { return m_id; }
|
||||
const wxString& GetHelp() const { return m_helpStr; }
|
||||
wxMenu *GetSubMenu() const { return m_subMenu; }
|
||||
|
||||
void Check( bool check );
|
||||
bool IsChecked() const;
|
||||
void Enable( bool enable );
|
||||
};
|
||||
|
||||
class wxMenu: public wxEvtHandler
|
||||
@ -99,6 +104,7 @@ class wxMenu: public wxEvtHandler
|
||||
void Append( int id, const wxString &item,
|
||||
wxMenu *subMenu, const wxString &helpStr = "" );
|
||||
int FindItem( const wxString itemString ) const;
|
||||
wxMenuItem* FindItemForId( int id ) const;
|
||||
void Break(void) {};
|
||||
void Check(int id, bool Flag);
|
||||
void Enable( int id, bool enable );
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tabctrl.h
|
||||
// Purpose: wxTabCtrl class
|
||||
// Name: notebook.h
|
||||
// Purpose: wxNotebook class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// RCS-ID: $Id$
|
||||
@ -8,8 +8,8 @@
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __TABCTRLH__
|
||||
#define __TABCTRLH__
|
||||
#ifndef __NOTEBOOKH__
|
||||
#define __NOTEBOOKH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "notebook.h"
|
||||
@ -186,4 +186,4 @@ typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
|
||||
},
|
||||
|
||||
#endif
|
||||
// __TABCTRLH__
|
||||
// __NOTEBOOKH__
|
||||
|
@ -24,7 +24,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToolBarTool;
|
||||
class wxToolBarGTK;
|
||||
class wxToolBar;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constants
|
||||
@ -50,7 +50,7 @@ class wxToolBarTool: public wxObject
|
||||
public:
|
||||
|
||||
wxToolBarTool(void) {};
|
||||
wxToolBarTool( wxToolBarGTK *owner, int theIndex = 0,
|
||||
wxToolBarTool( wxToolBar *owner, int theIndex = 0,
|
||||
const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
||||
bool toggle = FALSE, wxObject *clientData = NULL,
|
||||
const wxString& shortHelpString = "", const wxString& longHelpString = "");
|
||||
@ -70,24 +70,24 @@ class wxToolBarTool: public wxObject
|
||||
bool m_isMenuCommand;
|
||||
wxString m_shortHelpString;
|
||||
wxString m_longHelpString;
|
||||
wxToolBarGTK *m_owner;
|
||||
wxToolBar *m_owner;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolBarGTK
|
||||
// wxToolBar
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxToolBarGTK: public wxControl
|
||||
class wxToolBar: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBarGTK)
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||
|
||||
public:
|
||||
|
||||
wxToolBarGTK(void);
|
||||
wxToolBarGTK( wxWindow *parent, wxWindowID id,
|
||||
wxToolBar(void);
|
||||
wxToolBar( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxToolBarNameStr );
|
||||
~wxToolBarGTK(void);
|
||||
~wxToolBar(void);
|
||||
|
||||
bool Create( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
|
@ -11,7 +11,6 @@
|
||||
# define classwxToolBar classwxToolBarMSW
|
||||
#elif defined(__WXGTK__)
|
||||
# include "wx/gtk/tbargtk.h"
|
||||
# define classwxToolBar wxToolBarGTK
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -29,6 +29,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
//#include "list.xpm"
|
||||
//#include "folder.xpm"
|
||||
#endif
|
||||
|
||||
#include "mdi.h"
|
||||
|
||||
MyFrame *frame = NULL;
|
||||
@ -85,10 +90,10 @@ bool MyApp::OnInit(void)
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
|
||||
EVT_MENU(MDI_QUIT, MyFrame::OnQuit)
|
||||
EVT_MENU(MDI_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(MDI_NEW_WINDOW, MyFrame::OnNewWindow)
|
||||
EVT_SIZE(MyFrame::OnSize)
|
||||
EVT_MENU(MDI_QUIT, MyFrame::OnQuit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define my frame constructor
|
||||
@ -270,8 +275,8 @@ void MyFrame::OnSize(wxSizeEvent& event)
|
||||
// duplicate event handlers here.
|
||||
|
||||
BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
|
||||
EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
|
||||
EVT_SIZE( MyChild::OnSize)
|
||||
EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
|
@ -65,8 +65,8 @@ bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
|
||||
EVT_CLOSE(wxFrame::OnCloseWindow)
|
||||
EVT_SIZE(wxFrame::OnSize)
|
||||
EVT_CLOSE(wxFrame::OnCloseWindow)
|
||||
EVT_IDLE(wxFrame::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@ -172,9 +172,12 @@ void wxFrame::Enable( bool enable )
|
||||
gtk_widget_set_sensitive( m_mainWindow, enable );
|
||||
};
|
||||
|
||||
void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) )
|
||||
void wxFrame::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
this->Destroy();
|
||||
if ( GetEventHandler()->OnClose() || event.GetForce())
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
bool wxFrame::Destroy(void)
|
||||
@ -290,7 +293,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
}
|
||||
};
|
||||
|
||||
void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
{
|
||||
menu->SetInvokingWindow( win );
|
||||
wxNode *node = menu->m_items.First();
|
||||
@ -305,18 +308,24 @@ void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
||||
{
|
||||
m_frameMenuBar = menuBar;
|
||||
|
||||
wxNode *node = m_frameMenuBar->m_menus.First();
|
||||
while (node)
|
||||
|
||||
if (m_frameMenuBar)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
SetInvokingWindow( menu, this );
|
||||
node = node->Next();
|
||||
};
|
||||
|
||||
m_frameMenuBar->m_parent = this;
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||
if (m_frameMenuBar->m_parent != this)
|
||||
{
|
||||
wxNode *node = m_frameMenuBar->m_menus.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
SetInvokingWindow( menu, this );
|
||||
node = node->Next();
|
||||
};
|
||||
|
||||
m_frameMenuBar->m_parent = this;
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool wxFrame::CreateStatusBar( int number )
|
||||
|
173
src/gtk/mdi.cpp
173
src/gtk/mdi.cpp
@ -13,6 +13,11 @@
|
||||
#endif
|
||||
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern wxList wxPendingDelete;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
@ -31,15 +36,40 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
||||
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
||||
};
|
||||
|
||||
// page change callback
|
||||
static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
||||
GtkNotebookPage *page,
|
||||
gint WXUNUSED(nPage),
|
||||
wxMDIClientWindow *client_win )
|
||||
{
|
||||
wxNode *node = client_win->m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
||||
if (child_frame->m_page == page)
|
||||
{
|
||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)client_win->m_parent;
|
||||
mdi_frame->m_currentChild = child_frame;
|
||||
mdi_frame->SetMDIMenuBar( child_frame->m_menuBar );
|
||||
return;
|
||||
};
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame(void)
|
||||
{
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
m_parentFrameActive = TRUE;
|
||||
m_toolBar = NULL;
|
||||
};
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
|
||||
@ -50,6 +80,7 @@ wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
m_parentFrameActive = TRUE;
|
||||
m_toolBar = NULL;
|
||||
Create( parent, id, title, pos, size, style, name );
|
||||
};
|
||||
|
||||
@ -69,18 +100,31 @@ bool wxMDIParentFrame::Create( wxWindow *parent,
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::OnSize( wxSizeEvent& event )
|
||||
void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
{
|
||||
wxFrame::OnSize( event );
|
||||
wxFrame::GtkOnSize( x, y, width, height );
|
||||
|
||||
if (m_mdiMenuBar)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GetClientSize( &x, &y );
|
||||
m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
|
||||
}
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
||||
void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
||||
{
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
|
||||
{
|
||||
wxFrame::SetMenuBar( menu_bar );
|
||||
if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
|
||||
m_mdiMenuBar = menu_bar;
|
||||
if (m_mdiMenuBar)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GetClientSize( &x, &y );
|
||||
m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
|
||||
m_mdiMenuBar->Show( TRUE );
|
||||
}
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
||||
@ -88,6 +132,16 @@ void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
||||
wxFrame::GetClientSize( width, height );
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar )
|
||||
{
|
||||
m_toolBar = toolbar;
|
||||
};
|
||||
|
||||
wxWindow *wxMDIParentFrame::GetToolBar(void) const
|
||||
{
|
||||
return m_toolBar;
|
||||
};
|
||||
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
|
||||
{
|
||||
return m_currentChild;
|
||||
@ -106,9 +160,17 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
|
||||
|
||||
void wxMDIParentFrame::ActivateNext(void)
|
||||
{
|
||||
if (m_clientWindow)
|
||||
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::ActivatePrevious(void)
|
||||
{
|
||||
if (m_clientWindow)
|
||||
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
||||
{
|
||||
};
|
||||
|
||||
@ -122,8 +184,14 @@ void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(eve
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
|
||||
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame(void)
|
||||
{
|
||||
m_menuBar = NULL;
|
||||
m_page = NULL;
|
||||
};
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
@ -131,11 +199,23 @@ wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
const wxPoint& WXUNUSED(pos), const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
m_menuBar = NULL;
|
||||
m_page = NULL;
|
||||
Create( parent, id, title, wxDefaultPosition, size, style, name );
|
||||
};
|
||||
|
||||
wxMDIChildFrame::~wxMDIChildFrame(void)
|
||||
{
|
||||
if (m_menuBar)
|
||||
{
|
||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
|
||||
if (mdi_frame->m_currentChild == this)
|
||||
{
|
||||
mdi_frame->SetMDIMenuBar( NULL );
|
||||
mdi_frame->m_currentChild = NULL;
|
||||
};
|
||||
delete m_menuBar;
|
||||
}
|
||||
};
|
||||
|
||||
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||
@ -147,8 +227,59 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||
return wxPanel::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
|
||||
};
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) )
|
||||
void wxMDIChildFrame::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
if ( GetEventHandler()->OnClose() || event.GetForce())
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
bool wxMDIChildFrame::Destroy(void)
|
||||
{
|
||||
if (!wxPendingDelete.Member(this))
|
||||
wxPendingDelete.Append(this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
{
|
||||
menu->SetInvokingWindow( win );
|
||||
wxNode *node = menu->m_items.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
|
||||
if (menuitem->m_isSubMenu) SetInvokingWindow( menuitem->m_subMenu, win );
|
||||
node = node->Next();
|
||||
};
|
||||
};
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
||||
{
|
||||
m_menuBar = menu_bar;
|
||||
|
||||
if (m_menuBar)
|
||||
{
|
||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
|
||||
|
||||
if (m_menuBar->m_parent != this)
|
||||
{
|
||||
wxNode *node = m_menuBar->m_menus.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
SetInvokingWindow( menu, this );
|
||||
node = node->Next();
|
||||
};
|
||||
|
||||
m_menuBar->m_parent = mdi_frame;
|
||||
}
|
||||
mdi_frame->SetMDIMenuBar( m_menuBar );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWindow),
|
||||
m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y );
|
||||
}
|
||||
};
|
||||
|
||||
void wxMDIChildFrame::Activate(void)
|
||||
@ -182,6 +313,11 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||
|
||||
m_widget = gtk_notebook_new();
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
|
||||
GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this );
|
||||
|
||||
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
||||
|
||||
PostCreation();
|
||||
|
||||
Show( TRUE );
|
||||
@ -191,16 +327,17 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||
|
||||
void wxMDIClientWindow::AddChild( wxWindow *child )
|
||||
{
|
||||
if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||
{
|
||||
wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
|
||||
return;
|
||||
};
|
||||
|
||||
m_children.Append( child );
|
||||
|
||||
wxString s;
|
||||
|
||||
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||
{
|
||||
wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
|
||||
s = mdi_child->m_title;
|
||||
};
|
||||
|
||||
wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
|
||||
s = mdi_child->m_title;
|
||||
if (s.IsNull()) s = "MDI child";
|
||||
|
||||
GtkWidget *label_widget;
|
||||
@ -211,6 +348,10 @@ void wxMDIClientWindow::AddChild( wxWindow *child )
|
||||
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
||||
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
|
||||
|
||||
mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
|
||||
|
||||
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), m_children.Number()-1 );
|
||||
};
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
||||
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu );
|
||||
};
|
||||
|
||||
int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
|
||||
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
|
||||
{
|
||||
if (menu->m_title == menuString)
|
||||
{
|
||||
@ -91,7 +91,48 @@ int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemStr
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
||||
// Find a wxMenuItem using its id. Recurses down into sub-menus
|
||||
static wxMenuItem* FindMenuItemByIdRecursive( const wxMenu* menu, int id )
|
||||
{
|
||||
wxMenuItem* result = menu->FindItemForId( id );
|
||||
|
||||
wxNode *node = menu->m_items.First();
|
||||
while (node && result == 0)
|
||||
{
|
||||
wxMenuItem *item = (wxMenuItem*)node->Data();
|
||||
if (item->m_subMenu) result = FindMenuItemByIdRecursive( item->m_subMenu, id );
|
||||
node = node->Next();
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const
|
||||
{
|
||||
wxMenuItem* result = 0;
|
||||
wxNode *node = m_menus.First();
|
||||
while (node && result == 0)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
result = FindMenuItemByIdRecursive( menu, id );
|
||||
node = node->Next();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool wxMenuBar::IsChecked( int id ) const
|
||||
{
|
||||
wxMenuItem* item = FindMenuItemById( id );
|
||||
if (item) return item->IsChecked();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxMenuBar::IsEnabled( int id ) const
|
||||
{
|
||||
wxMenuItem* item = FindMenuItemById( id );
|
||||
if (item) return item->IsEnabled();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -124,6 +165,29 @@ wxMenuItem::wxMenuItem(void)
|
||||
m_menuItem = NULL;
|
||||
};
|
||||
|
||||
void wxMenuItem::Check( bool check )
|
||||
{
|
||||
if ( IsCheckable() )
|
||||
{
|
||||
m_checked = check;
|
||||
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
||||
}
|
||||
}
|
||||
|
||||
bool wxMenuItem::IsChecked() const
|
||||
{
|
||||
if ( IsCheckable() )
|
||||
{
|
||||
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
m_isEnabled = enable;
|
||||
}
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
|
||||
|
||||
wxMenu::wxMenu( const wxString &title )
|
||||
@ -219,9 +283,22 @@ int wxMenu::FindItem( const wxString itemString ) const
|
||||
return -1;
|
||||
};
|
||||
|
||||
void wxMenu::Check( int WXUNUSED(id), bool WXUNUSED(Flag) )
|
||||
wxMenuItem* wxMenu::FindItemForId( int id ) const
|
||||
{
|
||||
// I'm just too lazy
|
||||
wxNode *node = m_items.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem *item = (wxMenuItem*)node->Data();
|
||||
if (item->m_id == id) return item;
|
||||
node = node->Next();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxMenu::Check( int id, bool Flag )
|
||||
{
|
||||
wxMenuItem* item = FindItemForId( id );
|
||||
if (item) item->Check(Flag);
|
||||
};
|
||||
|
||||
void wxMenu::Enable( int id, bool enable )
|
||||
|
@ -153,6 +153,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_widget = gtk_notebook_new();
|
||||
|
||||
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
||||
|
||||
m_idHandler = gtk_signal_connect
|
||||
(
|
||||
GTK_OBJECT(m_widget), "switch_page",
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
|
||||
|
||||
wxToolBarTool::wxToolBarTool( wxToolBarGTK *owner, int theIndex,
|
||||
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
||||
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
||||
bool toggle, wxObject *clientData,
|
||||
const wxString& shortHelpString, const wxString& longHelpString )
|
||||
@ -45,7 +45,7 @@ wxToolBarTool::~wxToolBarTool(void)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolBarGTK
|
||||
// wxToolBar
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
|
||||
@ -59,27 +59,27 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *to
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarGTK,wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxToolBarGTK, wxControl)
|
||||
BEGIN_EVENT_TABLE(wxToolBar, wxControl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxToolBarGTK::wxToolBarGTK(void)
|
||||
wxToolBar::wxToolBar(void)
|
||||
{
|
||||
};
|
||||
|
||||
wxToolBarGTK::wxToolBarGTK( wxWindow *parent, wxWindowID id,
|
||||
wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
Create( parent, id, pos, size, style, name );
|
||||
};
|
||||
|
||||
wxToolBarGTK::~wxToolBarGTK(void)
|
||||
wxToolBar::~wxToolBar(void)
|
||||
{
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::Create( wxWindow *parent, wxWindowID id,
|
||||
bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
@ -104,7 +104,7 @@ bool wxToolBarGTK::Create( wxWindow *parent, wxWindowID id,
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::OnLeftClick( int toolIndex, bool toggleDown )
|
||||
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex);
|
||||
event.SetEventObject(this);
|
||||
@ -115,7 +115,7 @@ bool wxToolBarGTK::OnLeftClick( int toolIndex, bool toggleDown )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxToolBarGTK::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
||||
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex);
|
||||
event.SetEventObject(this);
|
||||
@ -123,7 +123,7 @@ void wxToolBarGTK::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSE
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
void wxToolBarGTK::OnMouseEnter( int toolIndex )
|
||||
void wxToolBar::OnMouseEnter( int toolIndex )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
|
||||
event.SetEventObject(this);
|
||||
@ -131,7 +131,7 @@ void wxToolBarGTK::OnMouseEnter( int toolIndex )
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
wxToolBarTool *wxToolBarGTK::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||
wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||
const wxBitmap& pushedBitmap, bool toggle,
|
||||
float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
|
||||
const wxString& helpString1, const wxString& helpString2 )
|
||||
@ -160,48 +160,48 @@ wxToolBarTool *wxToolBarGTK::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||
return tool;
|
||||
};
|
||||
|
||||
void wxToolBarGTK::AddSeparator(void)
|
||||
void wxToolBar::AddSeparator(void)
|
||||
{
|
||||
gtk_toolbar_append_space( m_toolbar );
|
||||
};
|
||||
|
||||
void wxToolBarGTK::ClearTools(void)
|
||||
void wxToolBar::ClearTools(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::EnableTool(int toolIndex, bool enable)
|
||||
void wxToolBar::EnableTool(int toolIndex, bool enable)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::ToggleTool(int toolIndex, bool toggle)
|
||||
void wxToolBar::ToggleTool(int toolIndex, bool toggle)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetToggle(int toolIndex, bool toggle)
|
||||
void wxToolBar::SetToggle(int toolIndex, bool toggle)
|
||||
{
|
||||
};
|
||||
|
||||
wxObject *wxToolBarGTK::GetToolClientData(int index) const
|
||||
wxObject *wxToolBar::GetToolClientData(int index) const
|
||||
{
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::GetToolState(int toolIndex) const
|
||||
bool wxToolBar::GetToolState(int toolIndex) const
|
||||
{
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::GetToolEnabled(int toolIndex) const
|
||||
bool wxToolBar::GetToolEnabled(int toolIndex) const
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetMargins(int x, int y)
|
||||
void wxToolBar::SetMargins(int x, int y)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetToolPacking(int packing)
|
||||
void wxToolBar::SetToolPacking(int packing)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetToolSeparation(int separation)
|
||||
void wxToolBar::SetToolSeparation(int separation)
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -65,8 +65,8 @@ bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
|
||||
EVT_CLOSE(wxFrame::OnCloseWindow)
|
||||
EVT_SIZE(wxFrame::OnSize)
|
||||
EVT_CLOSE(wxFrame::OnCloseWindow)
|
||||
EVT_IDLE(wxFrame::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@ -172,9 +172,12 @@ void wxFrame::Enable( bool enable )
|
||||
gtk_widget_set_sensitive( m_mainWindow, enable );
|
||||
};
|
||||
|
||||
void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) )
|
||||
void wxFrame::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
this->Destroy();
|
||||
if ( GetEventHandler()->OnClose() || event.GetForce())
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
bool wxFrame::Destroy(void)
|
||||
@ -290,7 +293,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
}
|
||||
};
|
||||
|
||||
void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
{
|
||||
menu->SetInvokingWindow( win );
|
||||
wxNode *node = menu->m_items.First();
|
||||
@ -305,18 +308,24 @@ void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
||||
{
|
||||
m_frameMenuBar = menuBar;
|
||||
|
||||
wxNode *node = m_frameMenuBar->m_menus.First();
|
||||
while (node)
|
||||
|
||||
if (m_frameMenuBar)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
SetInvokingWindow( menu, this );
|
||||
node = node->Next();
|
||||
};
|
||||
|
||||
m_frameMenuBar->m_parent = this;
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||
if (m_frameMenuBar->m_parent != this)
|
||||
{
|
||||
wxNode *node = m_frameMenuBar->m_menus.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
SetInvokingWindow( menu, this );
|
||||
node = node->Next();
|
||||
};
|
||||
|
||||
m_frameMenuBar->m_parent = this;
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
|
||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool wxFrame::CreateStatusBar( int number )
|
||||
|
173
src/gtk1/mdi.cpp
173
src/gtk1/mdi.cpp
@ -13,6 +13,11 @@
|
||||
#endif
|
||||
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern wxList wxPendingDelete;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
@ -31,15 +36,40 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
||||
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
||||
};
|
||||
|
||||
// page change callback
|
||||
static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
||||
GtkNotebookPage *page,
|
||||
gint WXUNUSED(nPage),
|
||||
wxMDIClientWindow *client_win )
|
||||
{
|
||||
wxNode *node = client_win->m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
||||
if (child_frame->m_page == page)
|
||||
{
|
||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)client_win->m_parent;
|
||||
mdi_frame->m_currentChild = child_frame;
|
||||
mdi_frame->SetMDIMenuBar( child_frame->m_menuBar );
|
||||
return;
|
||||
};
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame(void)
|
||||
{
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
m_parentFrameActive = TRUE;
|
||||
m_toolBar = NULL;
|
||||
};
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
|
||||
@ -50,6 +80,7 @@ wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
|
||||
m_clientWindow = NULL;
|
||||
m_currentChild = NULL;
|
||||
m_parentFrameActive = TRUE;
|
||||
m_toolBar = NULL;
|
||||
Create( parent, id, title, pos, size, style, name );
|
||||
};
|
||||
|
||||
@ -69,18 +100,31 @@ bool wxMDIParentFrame::Create( wxWindow *parent,
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::OnSize( wxSizeEvent& event )
|
||||
void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
{
|
||||
wxFrame::OnSize( event );
|
||||
wxFrame::GtkOnSize( x, y, width, height );
|
||||
|
||||
if (m_mdiMenuBar)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GetClientSize( &x, &y );
|
||||
m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
|
||||
}
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
||||
void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
||||
{
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
|
||||
{
|
||||
wxFrame::SetMenuBar( menu_bar );
|
||||
if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
|
||||
m_mdiMenuBar = menu_bar;
|
||||
if (m_mdiMenuBar)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GetClientSize( &x, &y );
|
||||
m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
|
||||
m_mdiMenuBar->Show( TRUE );
|
||||
}
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
||||
@ -88,6 +132,16 @@ void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
||||
wxFrame::GetClientSize( width, height );
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar )
|
||||
{
|
||||
m_toolBar = toolbar;
|
||||
};
|
||||
|
||||
wxWindow *wxMDIParentFrame::GetToolBar(void) const
|
||||
{
|
||||
return m_toolBar;
|
||||
};
|
||||
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
|
||||
{
|
||||
return m_currentChild;
|
||||
@ -106,9 +160,17 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
|
||||
|
||||
void wxMDIParentFrame::ActivateNext(void)
|
||||
{
|
||||
if (m_clientWindow)
|
||||
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::ActivatePrevious(void)
|
||||
{
|
||||
if (m_clientWindow)
|
||||
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
||||
};
|
||||
|
||||
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
||||
{
|
||||
};
|
||||
|
||||
@ -122,8 +184,14 @@ void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(eve
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
|
||||
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame(void)
|
||||
{
|
||||
m_menuBar = NULL;
|
||||
m_page = NULL;
|
||||
};
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
@ -131,11 +199,23 @@ wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
|
||||
const wxPoint& WXUNUSED(pos), const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
m_menuBar = NULL;
|
||||
m_page = NULL;
|
||||
Create( parent, id, title, wxDefaultPosition, size, style, name );
|
||||
};
|
||||
|
||||
wxMDIChildFrame::~wxMDIChildFrame(void)
|
||||
{
|
||||
if (m_menuBar)
|
||||
{
|
||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
|
||||
if (mdi_frame->m_currentChild == this)
|
||||
{
|
||||
mdi_frame->SetMDIMenuBar( NULL );
|
||||
mdi_frame->m_currentChild = NULL;
|
||||
};
|
||||
delete m_menuBar;
|
||||
}
|
||||
};
|
||||
|
||||
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||
@ -147,8 +227,59 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
|
||||
return wxPanel::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
|
||||
};
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) )
|
||||
void wxMDIChildFrame::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
if ( GetEventHandler()->OnClose() || event.GetForce())
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
bool wxMDIChildFrame::Destroy(void)
|
||||
{
|
||||
if (!wxPendingDelete.Member(this))
|
||||
wxPendingDelete.Append(this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
||||
{
|
||||
menu->SetInvokingWindow( win );
|
||||
wxNode *node = menu->m_items.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
|
||||
if (menuitem->m_isSubMenu) SetInvokingWindow( menuitem->m_subMenu, win );
|
||||
node = node->Next();
|
||||
};
|
||||
};
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
||||
{
|
||||
m_menuBar = menu_bar;
|
||||
|
||||
if (m_menuBar)
|
||||
{
|
||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
|
||||
|
||||
if (m_menuBar->m_parent != this)
|
||||
{
|
||||
wxNode *node = m_menuBar->m_menus.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
SetInvokingWindow( menu, this );
|
||||
node = node->Next();
|
||||
};
|
||||
|
||||
m_menuBar->m_parent = mdi_frame;
|
||||
}
|
||||
mdi_frame->SetMDIMenuBar( m_menuBar );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWindow),
|
||||
m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y );
|
||||
}
|
||||
};
|
||||
|
||||
void wxMDIChildFrame::Activate(void)
|
||||
@ -182,6 +313,11 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||
|
||||
m_widget = gtk_notebook_new();
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
|
||||
GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this );
|
||||
|
||||
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
||||
|
||||
PostCreation();
|
||||
|
||||
Show( TRUE );
|
||||
@ -191,16 +327,17 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
||||
|
||||
void wxMDIClientWindow::AddChild( wxWindow *child )
|
||||
{
|
||||
if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||
{
|
||||
wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
|
||||
return;
|
||||
};
|
||||
|
||||
m_children.Append( child );
|
||||
|
||||
wxString s;
|
||||
|
||||
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||
{
|
||||
wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
|
||||
s = mdi_child->m_title;
|
||||
};
|
||||
|
||||
wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
|
||||
s = mdi_child->m_title;
|
||||
if (s.IsNull()) s = "MDI child";
|
||||
|
||||
GtkWidget *label_widget;
|
||||
@ -211,6 +348,10 @@ void wxMDIClientWindow::AddChild( wxWindow *child )
|
||||
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
||||
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
|
||||
|
||||
mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
|
||||
|
||||
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), m_children.Number()-1 );
|
||||
};
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
||||
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu );
|
||||
};
|
||||
|
||||
int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
|
||||
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
|
||||
{
|
||||
if (menu->m_title == menuString)
|
||||
{
|
||||
@ -91,7 +91,48 @@ int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemStr
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
||||
// Find a wxMenuItem using its id. Recurses down into sub-menus
|
||||
static wxMenuItem* FindMenuItemByIdRecursive( const wxMenu* menu, int id )
|
||||
{
|
||||
wxMenuItem* result = menu->FindItemForId( id );
|
||||
|
||||
wxNode *node = menu->m_items.First();
|
||||
while (node && result == 0)
|
||||
{
|
||||
wxMenuItem *item = (wxMenuItem*)node->Data();
|
||||
if (item->m_subMenu) result = FindMenuItemByIdRecursive( item->m_subMenu, id );
|
||||
node = node->Next();
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const
|
||||
{
|
||||
wxMenuItem* result = 0;
|
||||
wxNode *node = m_menus.First();
|
||||
while (node && result == 0)
|
||||
{
|
||||
wxMenu *menu = (wxMenu*)node->Data();
|
||||
result = FindMenuItemByIdRecursive( menu, id );
|
||||
node = node->Next();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool wxMenuBar::IsChecked( int id ) const
|
||||
{
|
||||
wxMenuItem* item = FindMenuItemById( id );
|
||||
if (item) return item->IsChecked();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxMenuBar::IsEnabled( int id ) const
|
||||
{
|
||||
wxMenuItem* item = FindMenuItemById( id );
|
||||
if (item) return item->IsEnabled();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -124,6 +165,29 @@ wxMenuItem::wxMenuItem(void)
|
||||
m_menuItem = NULL;
|
||||
};
|
||||
|
||||
void wxMenuItem::Check( bool check )
|
||||
{
|
||||
if ( IsCheckable() )
|
||||
{
|
||||
m_checked = check;
|
||||
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
||||
}
|
||||
}
|
||||
|
||||
bool wxMenuItem::IsChecked() const
|
||||
{
|
||||
if ( IsCheckable() )
|
||||
{
|
||||
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
m_isEnabled = enable;
|
||||
}
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
|
||||
|
||||
wxMenu::wxMenu( const wxString &title )
|
||||
@ -219,9 +283,22 @@ int wxMenu::FindItem( const wxString itemString ) const
|
||||
return -1;
|
||||
};
|
||||
|
||||
void wxMenu::Check( int WXUNUSED(id), bool WXUNUSED(Flag) )
|
||||
wxMenuItem* wxMenu::FindItemForId( int id ) const
|
||||
{
|
||||
// I'm just too lazy
|
||||
wxNode *node = m_items.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem *item = (wxMenuItem*)node->Data();
|
||||
if (item->m_id == id) return item;
|
||||
node = node->Next();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxMenu::Check( int id, bool Flag )
|
||||
{
|
||||
wxMenuItem* item = FindItemForId( id );
|
||||
if (item) item->Check(Flag);
|
||||
};
|
||||
|
||||
void wxMenu::Enable( int id, bool enable )
|
||||
|
@ -153,6 +153,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_widget = gtk_notebook_new();
|
||||
|
||||
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
||||
|
||||
m_idHandler = gtk_signal_connect
|
||||
(
|
||||
GTK_OBJECT(m_widget), "switch_page",
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
|
||||
|
||||
wxToolBarTool::wxToolBarTool( wxToolBarGTK *owner, int theIndex,
|
||||
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
||||
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
||||
bool toggle, wxObject *clientData,
|
||||
const wxString& shortHelpString, const wxString& longHelpString )
|
||||
@ -45,7 +45,7 @@ wxToolBarTool::~wxToolBarTool(void)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolBarGTK
|
||||
// wxToolBar
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
|
||||
@ -59,27 +59,27 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *to
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarGTK,wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxToolBarGTK, wxControl)
|
||||
BEGIN_EVENT_TABLE(wxToolBar, wxControl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxToolBarGTK::wxToolBarGTK(void)
|
||||
wxToolBar::wxToolBar(void)
|
||||
{
|
||||
};
|
||||
|
||||
wxToolBarGTK::wxToolBarGTK( wxWindow *parent, wxWindowID id,
|
||||
wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
Create( parent, id, pos, size, style, name );
|
||||
};
|
||||
|
||||
wxToolBarGTK::~wxToolBarGTK(void)
|
||||
wxToolBar::~wxToolBar(void)
|
||||
{
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::Create( wxWindow *parent, wxWindowID id,
|
||||
bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
@ -104,7 +104,7 @@ bool wxToolBarGTK::Create( wxWindow *parent, wxWindowID id,
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::OnLeftClick( int toolIndex, bool toggleDown )
|
||||
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex);
|
||||
event.SetEventObject(this);
|
||||
@ -115,7 +115,7 @@ bool wxToolBarGTK::OnLeftClick( int toolIndex, bool toggleDown )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxToolBarGTK::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
||||
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex);
|
||||
event.SetEventObject(this);
|
||||
@ -123,7 +123,7 @@ void wxToolBarGTK::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSE
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
void wxToolBarGTK::OnMouseEnter( int toolIndex )
|
||||
void wxToolBar::OnMouseEnter( int toolIndex )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
|
||||
event.SetEventObject(this);
|
||||
@ -131,7 +131,7 @@ void wxToolBarGTK::OnMouseEnter( int toolIndex )
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
wxToolBarTool *wxToolBarGTK::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||
wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||
const wxBitmap& pushedBitmap, bool toggle,
|
||||
float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
|
||||
const wxString& helpString1, const wxString& helpString2 )
|
||||
@ -160,48 +160,48 @@ wxToolBarTool *wxToolBarGTK::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||
return tool;
|
||||
};
|
||||
|
||||
void wxToolBarGTK::AddSeparator(void)
|
||||
void wxToolBar::AddSeparator(void)
|
||||
{
|
||||
gtk_toolbar_append_space( m_toolbar );
|
||||
};
|
||||
|
||||
void wxToolBarGTK::ClearTools(void)
|
||||
void wxToolBar::ClearTools(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::EnableTool(int toolIndex, bool enable)
|
||||
void wxToolBar::EnableTool(int toolIndex, bool enable)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::ToggleTool(int toolIndex, bool toggle)
|
||||
void wxToolBar::ToggleTool(int toolIndex, bool toggle)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetToggle(int toolIndex, bool toggle)
|
||||
void wxToolBar::SetToggle(int toolIndex, bool toggle)
|
||||
{
|
||||
};
|
||||
|
||||
wxObject *wxToolBarGTK::GetToolClientData(int index) const
|
||||
wxObject *wxToolBar::GetToolClientData(int index) const
|
||||
{
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::GetToolState(int toolIndex) const
|
||||
bool wxToolBar::GetToolState(int toolIndex) const
|
||||
{
|
||||
};
|
||||
|
||||
bool wxToolBarGTK::GetToolEnabled(int toolIndex) const
|
||||
bool wxToolBar::GetToolEnabled(int toolIndex) const
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetMargins(int x, int y)
|
||||
void wxToolBar::SetMargins(int x, int y)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetToolPacking(int packing)
|
||||
void wxToolBar::SetToolPacking(int packing)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBarGTK::SetToolSeparation(int separation)
|
||||
void wxToolBar::SetToolSeparation(int separation)
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -129,7 +129,7 @@ MyFrame::MyFrame(void) :
|
||||
SetStatusText( "Welcome", 0 );
|
||||
SetStatusText( "wxFile v0.2 by Robert Roebling.", 1 );
|
||||
|
||||
m_tb = new wxToolBarGTK( this, ID_TOOLBAR, wxPoint(2,60), wxSize(300-4,26) );
|
||||
m_tb = new wxToolBar( this, ID_TOOLBAR, wxPoint(2,60), wxSize(300-4,26) );
|
||||
m_tb->SetMargins( 2, 2 );
|
||||
|
||||
wxBitmap *bm;
|
||||
|
@ -63,7 +63,7 @@ class MyFrame: public wxFrame
|
||||
void OnTreeSelected( wxTreeEvent &event );
|
||||
void OnTreeKeyDown( wxTreeEvent &event );
|
||||
|
||||
wxToolBarGTK *m_tb;
|
||||
wxToolBar *m_tb;
|
||||
wxSplitterWindow *m_splitter;
|
||||
wxFileCtrl *m_rightFile;
|
||||
wxFileCtrl *m_leftFile;
|
||||
|
@ -470,7 +470,7 @@ MyFrame::MyFrame(void) :
|
||||
m_canvas = new MyCanvas( this, -1, wxPoint(2,62), wxSize(300-4,120-4) );
|
||||
m_canvas->SetScrollbars( 10, 10, 50, 50 );
|
||||
|
||||
m_tb = new wxToolBarGTK( this, -1, wxPoint(2,60), wxSize(300-4,26) );
|
||||
m_tb = new wxToolBar( this, -1, wxPoint(2,60), wxSize(300-4,26) );
|
||||
m_tb->SetMargins( 2, 2 );
|
||||
|
||||
wxBitmap *bm = new wxBitmap( list_xpm );
|
||||
|
@ -141,7 +141,7 @@ class MyFrame: public wxFrame
|
||||
void OnAbout( wxCommandEvent &event );
|
||||
void OnQuit( wxCommandEvent &event );
|
||||
|
||||
wxToolBarGTK *m_tb;
|
||||
wxToolBar *m_tb;
|
||||
MyCanvas *m_canvas;
|
||||
|
||||
MyTimer m_timer;
|
||||
|
Loading…
Reference in New Issue
Block a user