diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index b14cb20955..61f2bb2708 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -130,6 +130,7 @@ class wxBitmap: public wxObject friend wxFrame; friend wxDialog; friend wxTreeCtrl; + friend wxNotebook; GdkPixmap *GetPixmap() const; GdkBitmap *GetBitmap() const; diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index b14cb20955..61f2bb2708 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -130,6 +130,7 @@ class wxBitmap: public wxObject friend wxFrame; friend wxDialog; friend wxTreeCtrl; + friend wxNotebook; GdkPixmap *GetPixmap() const; GdkBitmap *GetBitmap() const; diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index 94b4fc302b..f94ac448f8 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -109,7 +109,6 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL); InitToolBar(GetToolBar()); -#ifdef __WXMSW__ // Accelerators wxAcceleratorEntry entries[3]; entries[0].Set(wxACCEL_CTRL, (int) 'N', MDI_NEW_WINDOW); @@ -117,7 +116,6 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c entries[2].Set(wxACCEL_CTRL, (int) 'A', MDI_ABOUT); wxAcceleratorTable accel(3, entries); SetAcceleratorTable(accel); -#endif } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) ) diff --git a/src/gtk.inc b/src/gtk.inc index 26c2accec9..76e934d2ce 100644 --- a/src/gtk.inc +++ b/src/gtk.inc @@ -33,6 +33,7 @@ LIB_CPP_SRC=\ common/memory.cpp \ common/module.cpp \ common/object.cpp \ + common/odbc.cpp \ common/postscrp.cpp \ common/prntbase.cpp \ common/resource.cpp \ diff --git a/src/gtk/accel.cpp b/src/gtk/accel.cpp index 08b5436b34..8288d870da 100644 --- a/src/gtk/accel.cpp +++ b/src/gtk/accel.cpp @@ -13,6 +13,8 @@ #include "wx/accel.h" +#include + //----------------------------------------------------------------------------- // wxAcceleratorTable //----------------------------------------------------------------------------- @@ -22,13 +24,24 @@ class wxAccelRefData: public wxObjectRefData public: wxAccelRefData(void); + ~wxAccelRefData(void); wxList m_accels; }; wxAccelRefData::wxAccelRefData(void) { - m_accels.DeleteContents( TRUE ); +} + +wxAccelRefData::~wxAccelRefData(void) +{ + wxNode *node = m_accels.First(); + while (node) + { + wxAcceleratorEntry *entry = (wxAcceleratorEntry *)node->Data(); + delete entry; + node = node->Next(); + } } //----------------------------------------------------------------------------- @@ -47,8 +60,11 @@ wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) m_refData = new wxAccelRefData(); for (int i = 0; i < n; i++) { - M_ACCELDATA->m_accels.Append( (wxObject*) - new wxAcceleratorEntry( entries[n].GetFlags(), entries[n].GetKeyCode(), entries[n].GetCommand() ) ); + int flag = entries[i].GetFlags(); + int keycode = entries[i].GetKeyCode(); + int command = entries[i].GetCommand(); + if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); + M_ACCELDATA->m_accels.Append( (wxObject*) new wxAcceleratorEntry( flag, keycode, command ) ); } } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index dba832d740..2ca9ce464e 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -193,11 +193,17 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e if (!ret) { - int command = win->GetAcceleratorTable()->GetCommand( event ); - if (command != -1) - { - wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); - ret = win->GetEventHandler()->ProcessEvent( command_event ); + wxWindow *ancestor = win; + while (ancestor) + { + int command = ancestor->GetAcceleratorTable()->GetCommand( event ); + if (command != -1) + { + wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); + ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); + break; + } + ancestor = ancestor->GetParent(); } } @@ -1404,7 +1410,7 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y, if (theFont) fontToUse = *theFont; GdkFont *font = fontToUse.GetInternalFont( 1.0 ); - if (x) (*y) = gdk_string_width( font, string ); + if (x) (*x) = gdk_string_width( font, string ); if (y) (*y) = font->ascent + font->descent; if (descent) (*descent) = font->descent; if (externalLeading) (*externalLeading) = 0; // ?? diff --git a/src/gtk1/accel.cpp b/src/gtk1/accel.cpp index 08b5436b34..8288d870da 100644 --- a/src/gtk1/accel.cpp +++ b/src/gtk1/accel.cpp @@ -13,6 +13,8 @@ #include "wx/accel.h" +#include + //----------------------------------------------------------------------------- // wxAcceleratorTable //----------------------------------------------------------------------------- @@ -22,13 +24,24 @@ class wxAccelRefData: public wxObjectRefData public: wxAccelRefData(void); + ~wxAccelRefData(void); wxList m_accels; }; wxAccelRefData::wxAccelRefData(void) { - m_accels.DeleteContents( TRUE ); +} + +wxAccelRefData::~wxAccelRefData(void) +{ + wxNode *node = m_accels.First(); + while (node) + { + wxAcceleratorEntry *entry = (wxAcceleratorEntry *)node->Data(); + delete entry; + node = node->Next(); + } } //----------------------------------------------------------------------------- @@ -47,8 +60,11 @@ wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) m_refData = new wxAccelRefData(); for (int i = 0; i < n; i++) { - M_ACCELDATA->m_accels.Append( (wxObject*) - new wxAcceleratorEntry( entries[n].GetFlags(), entries[n].GetKeyCode(), entries[n].GetCommand() ) ); + int flag = entries[i].GetFlags(); + int keycode = entries[i].GetKeyCode(); + int command = entries[i].GetCommand(); + if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); + M_ACCELDATA->m_accels.Append( (wxObject*) new wxAcceleratorEntry( flag, keycode, command ) ); } } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index dba832d740..2ca9ce464e 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -193,11 +193,17 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e if (!ret) { - int command = win->GetAcceleratorTable()->GetCommand( event ); - if (command != -1) - { - wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); - ret = win->GetEventHandler()->ProcessEvent( command_event ); + wxWindow *ancestor = win; + while (ancestor) + { + int command = ancestor->GetAcceleratorTable()->GetCommand( event ); + if (command != -1) + { + wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); + ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); + break; + } + ancestor = ancestor->GetParent(); } } @@ -1404,7 +1410,7 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y, if (theFont) fontToUse = *theFont; GdkFont *font = fontToUse.GetInternalFont( 1.0 ); - if (x) (*y) = gdk_string_width( font, string ); + if (x) (*x) = gdk_string_width( font, string ); if (y) (*y) = font->ascent + font->descent; if (descent) (*descent) = font->descent; if (externalLeading) (*externalLeading) = 0; // ??