$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
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
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>
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>
class wxDC;
class wxPaintDC;
class wxMemoryDC;
-class wxToolBarGTK;
+class wxToolBar;
class wxBitmapButton;
class wxStaticBitmap;
friend wxBitmap;
friend wxDC;
friend wxPaintDC;
- friend wxToolBarGTK;
+ friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
friend wxDC;
friend wxPaintDC;
friend wxMemoryDC;
- friend wxToolBarGTK;
+ friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
// classes
//-----------------------------------------------------------------------------
-class wxRadioBox;
+class wxMDIChildFrame;
class wxFrame;
//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;
#include "wx/control.h"
#include "wx/panel.h"
#include "wx/frame.h"
+#include "wx/toolbar.h"
//-----------------------------------------------------------------------------
// classes
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;
+ void GetClientSize(int *width, int *height) const;
+ wxMDIChildFrame *GetActiveChild(void) const;
+
+ virtual void SetToolBar( wxToolBar *toolbar );
+ virtual wxWindow *GetToolBar(void) const;
- wxMDIClientWindow *GetClientWindow(void) const;
- virtual wxMDIClientWindow *OnCreateClient(void);
+ 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);
+ virtual void Cascade(void) {};
+ virtual void Tile(void) {};
+ virtual void ArrangeIcons(void) {};
+ virtual void ActivateNext(void);
+ virtual void ActivatePrevious(void);
+
+ 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 );
- protected:
- wxMDIClientWindow * m_clientWindow;
- wxMDIChildFrame * m_currentChild;
+ private:
+
+ wxMDIClientWindow *m_clientWindow;
bool m_parentFrameActive;
+ wxMenuBar *m_mdiMenuBar;
+ wxToolBar *m_toolBar;
-// DECLARE_EVENT_TABLE()
+ DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
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()
};
//-----------------------------------------------------------------------------
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;
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
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 );
/////////////////////////////////////////////////////////////////////////////
-// Name: tabctrl.h
-// Purpose: wxTabCtrl class
+// Name: notebook.h
+// Purpose: wxNotebook class
// Author: Robert Roebling
// Modified by:
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-#ifndef __TABCTRLH__
-#define __TABCTRLH__
+#ifndef __NOTEBOOKH__
+#define __NOTEBOOKH__
#ifdef __GNUG__
#pragma interface "notebook.h"
},
#endif
- // __TABCTRLH__
+ // __NOTEBOOKH__
//-----------------------------------------------------------------------------
class wxToolBarTool;
-class wxToolBarGTK;
+class wxToolBar;
//-----------------------------------------------------------------------------
// constants
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 = "");
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,
class wxDC;
class wxPaintDC;
class wxMemoryDC;
-class wxToolBarGTK;
+class wxToolBar;
class wxBitmapButton;
class wxStaticBitmap;
friend wxBitmap;
friend wxDC;
friend wxPaintDC;
- friend wxToolBarGTK;
+ friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
friend wxDC;
friend wxPaintDC;
friend wxMemoryDC;
- friend wxToolBarGTK;
+ friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
// classes
//-----------------------------------------------------------------------------
-class wxRadioBox;
+class wxMDIChildFrame;
class wxFrame;
//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;
#include "wx/control.h"
#include "wx/panel.h"
#include "wx/frame.h"
+#include "wx/toolbar.h"
//-----------------------------------------------------------------------------
// classes
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;
+ void GetClientSize(int *width, int *height) const;
+ wxMDIChildFrame *GetActiveChild(void) const;
+
+ virtual void SetToolBar( wxToolBar *toolbar );
+ virtual wxWindow *GetToolBar(void) const;
- wxMDIClientWindow *GetClientWindow(void) const;
- virtual wxMDIClientWindow *OnCreateClient(void);
+ 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);
+ virtual void Cascade(void) {};
+ virtual void Tile(void) {};
+ virtual void ArrangeIcons(void) {};
+ virtual void ActivateNext(void);
+ virtual void ActivatePrevious(void);
+
+ 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 );
- protected:
- wxMDIClientWindow * m_clientWindow;
- wxMDIChildFrame * m_currentChild;
+ private:
+
+ wxMDIClientWindow *m_clientWindow;
bool m_parentFrameActive;
+ wxMenuBar *m_mdiMenuBar;
+ wxToolBar *m_toolBar;
-// DECLARE_EVENT_TABLE()
+ DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
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()
};
//-----------------------------------------------------------------------------
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;
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
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 );
/////////////////////////////////////////////////////////////////////////////
-// Name: tabctrl.h
-// Purpose: wxTabCtrl class
+// Name: notebook.h
+// Purpose: wxNotebook class
// Author: Robert Roebling
// Modified by:
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-#ifndef __TABCTRLH__
-#define __TABCTRLH__
+#ifndef __NOTEBOOKH__
+#define __NOTEBOOKH__
#ifdef __GNUG__
#pragma interface "notebook.h"
},
#endif
- // __TABCTRLH__
+ // __NOTEBOOKH__
//-----------------------------------------------------------------------------
class wxToolBarTool;
-class wxToolBarGTK;
+class wxToolBar;
//-----------------------------------------------------------------------------
// constants
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 = "");
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,
# define classwxToolBar classwxToolBarMSW
#elif defined(__WXGTK__)
# include "wx/gtk/tbargtk.h"
-# define classwxToolBar wxToolBarGTK
#endif
#endif
#endif
#endif
+#ifdef __WXGTK__
+//#include "list.xpm"
+//#include "folder.xpm"
+#endif
+
#include "mdi.h"
MyFrame *frame = NULL;
}
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
// 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,
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
- EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_SIZE(wxFrame::OnSize)
+ EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_IDLE(wxFrame::OnIdle)
END_EVENT_TABLE()
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)
}
};
-void SetInvokingWindow( wxMenu *menu, wxWindow *win )
+static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
wxNode *node = menu->m_items.First();
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 )
#endif
#include "wx/mdi.h"
+#include "wx/gtk/win_gtk.h"
+
+//-----------------------------------------------------------------------------
+
+extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// wxMDIParentFrame
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,
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
+ m_toolBar = NULL;
Create( parent, id, title, pos, size, style, name );
};
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 )
+{
+ 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
{
+ wxFrame::GetClientSize( width, height );
};
-void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
+void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar )
{
- wxFrame::SetMenuBar( menu_bar );
+ m_toolBar = toolbar;
};
-void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
+wxWindow *wxMDIParentFrame::GetToolBar(void) const
{
- wxFrame::GetClientSize( width, height );
+ return m_toolBar;
};
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
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) )
{
};
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,
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,
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)
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 );
void wxMDIClientWindow::AddChild( wxWindow *child )
{
- m_children.Append( child );
-
- wxString s;
-
- if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
+ if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
{
- wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
- s = mdi_child->m_title;
+ wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
+ return;
};
+ m_children.Append( child );
+
+ wxString s;
+ wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
+ s = mdi_child->m_title;
if (s.IsNull()) s = "MDI child";
GtkWidget *label_widget;
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 );
};
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)
{
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
//-----------------------------------------------------------------------------
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 )
return -1;
};
-void wxMenu::Check( int WXUNUSED(id), bool WXUNUSED(Flag) )
+wxMenuItem* wxMenu::FindItemForId( int id ) const
+{
+ 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 )
{
- // I'm just too lazy
+ wxMenuItem* item = FindItemForId( id );
+ if (item) item->Check(Flag);
};
void wxMenu::Enable( int id, bool enable )
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",
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 )
};
//-----------------------------------------------------------------------------
-// wxToolBarGTK
+// wxToolBar
//-----------------------------------------------------------------------------
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
//-----------------------------------------------------------------------------
-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 )
{
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);
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);
GetEventHandler()->ProcessEvent(event);
};
-void wxToolBarGTK::OnMouseEnter( int toolIndex )
+void wxToolBar::OnMouseEnter( int toolIndex )
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
event.SetEventObject(this);
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 )
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)
{
};
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
- EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_SIZE(wxFrame::OnSize)
+ EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_IDLE(wxFrame::OnIdle)
END_EVENT_TABLE()
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)
}
};
-void SetInvokingWindow( wxMenu *menu, wxWindow *win )
+static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
wxNode *node = menu->m_items.First();
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 )
#endif
#include "wx/mdi.h"
+#include "wx/gtk/win_gtk.h"
+
+//-----------------------------------------------------------------------------
+
+extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// wxMDIParentFrame
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,
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
+ m_toolBar = NULL;
Create( parent, id, title, pos, size, style, name );
};
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 )
+{
+ 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
{
+ wxFrame::GetClientSize( width, height );
};
-void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
+void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar )
{
- wxFrame::SetMenuBar( menu_bar );
+ m_toolBar = toolbar;
};
-void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
+wxWindow *wxMDIParentFrame::GetToolBar(void) const
{
- wxFrame::GetClientSize( width, height );
+ return m_toolBar;
};
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
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) )
{
};
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,
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,
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)
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 );
void wxMDIClientWindow::AddChild( wxWindow *child )
{
- m_children.Append( child );
-
- wxString s;
-
- if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
+ if (!child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
{
- wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
- s = mdi_child->m_title;
+ wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
+ return;
};
+ m_children.Append( child );
+
+ wxString s;
+ wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
+ s = mdi_child->m_title;
if (s.IsNull()) s = "MDI child";
GtkWidget *label_widget;
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 );
};
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)
{
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
//-----------------------------------------------------------------------------
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 )
return -1;
};
-void wxMenu::Check( int WXUNUSED(id), bool WXUNUSED(Flag) )
+wxMenuItem* wxMenu::FindItemForId( int id ) const
+{
+ 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 )
{
- // I'm just too lazy
+ wxMenuItem* item = FindItemForId( id );
+ if (item) item->Check(Flag);
};
void wxMenu::Enable( int id, bool enable )
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",
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 )
};
//-----------------------------------------------------------------------------
-// wxToolBarGTK
+// wxToolBar
//-----------------------------------------------------------------------------
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
//-----------------------------------------------------------------------------
-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 )
{
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);
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);
GetEventHandler()->ProcessEvent(event);
};
-void wxToolBarGTK::OnMouseEnter( int toolIndex )
+void wxToolBar::OnMouseEnter( int toolIndex )
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
event.SetEventObject(this);
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 )
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)
{
};
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;
void OnTreeSelected( wxTreeEvent &event );
void OnTreeKeyDown( wxTreeEvent &event );
- wxToolBarGTK *m_tb;
+ wxToolBar *m_tb;
wxSplitterWindow *m_splitter;
wxFileCtrl *m_rightFile;
wxFileCtrl *m_leftFile;
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 );
void OnAbout( wxCommandEvent &event );
void OnQuit( wxCommandEvent &event );
- wxToolBarGTK *m_tb;
+ wxToolBar *m_tb;
MyCanvas *m_canvas;
MyTimer m_timer;