From 33caefb37762ff21b139ef943d1b614dc3b237db Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 23 Jun 1999 19:33:49 +0000 Subject: [PATCH 1/1] Motif things. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2883 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/controls/controls.cpp | 9 +-------- src/motif/dcclient.cpp | 12 ++++++------ src/motif/window.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 4df2c078f7..284420de19 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -164,18 +164,11 @@ bool MyApp::OnInit() frame->SetIcon( wxICON(mondrian) ); - // submenu - wxMenu *sub_menu = new wxMenu( wxMENU_TEAROFF ); - sub_menu->Append(MINIMAL_ABOUT, "&About", "About this sample"); - sub_menu->Append(MINIMAL_ABOUT, "&About", "About this sample"); - sub_menu->Append(MINIMAL_ABOUT, "&About", "About this sample"); - wxMenu *file_menu = new wxMenu; file_menu->Append(MINIMAL_ABOUT, "&About\tF1"); file_menu->Append(MINIMAL_QUIT, "E&xit\tAlt-X", "Quit controls sample"); - file_menu->Append( 0, "&Submenu", sub_menu ); - wxMenuBar *menu_bar = new wxMenuBar( wxMB_DOCKABLE ); + wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, "&File"); #if wxUSE_TOOLTIPS diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 7e2c71d1c8..1d4cca6560 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -1180,8 +1180,8 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh // TODO: this should be an error log function wxFAIL_MSG("set a valid font before calling GetTextExtent!"); - *width = -1; - *height = -1; + if (width) *width = -1; + if (height) *height = -1; return; } @@ -1207,8 +1207,8 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh XTextExtents((XFontStruct*) pFontStruct, (char*) (const char*) string, slen, &direction, &ascent, &descent2, &overall); - *width = XDEV2LOGREL (overall.width); - *height = YDEV2LOGREL (ascent + descent2); + if (width) *width = XDEV2LOGREL (overall.width); + if (height) *height = YDEV2LOGREL (ascent + descent2); if (descent) *descent = descent2; if (externalLeading) @@ -1992,7 +1992,7 @@ void wxWindowDC::SetDCClipping() void wxWindowDC::DoSetClippingRegion( long x, long y, long width, long height ) { - wxDC::SetClippingRegion( x, y, width, height ); + wxDC::DoSetClippingRegion( x, y, width, height ); if (m_userRegion) XDestroyRegion ((Region) m_userRegion); @@ -2023,7 +2023,7 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region ) { wxRect box = region.GetBox(); - wxDC::SetClippingRegion( box.x, box.y, box.width, box.height ); + wxDC::DoSetClippingRegion( box.x, box.y, box.width, box.height ); if (m_userRegion) XDestroyRegion ((Region) m_userRegion); diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 0cae0d05d1..c8537834bf 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -36,7 +36,7 @@ #include "wx/msgdlg.h" #include "wx/frame.h" #include "wx/scrolwin.h" - +#include "wx/module.h" #include "wx/menuitem.h" #include "wx/log.h" @@ -68,7 +68,7 @@ static const int SCROLL_MARGIN = 4; // global variables for this module // ---------------------------------------------------------------------------- -static wxHashTable *gs_wxWidgetHashTable; +extern wxHashTable *wxWidgetHashTable; // ---------------------------------------------------------------------------- // private functions @@ -1588,26 +1588,26 @@ bool wxWindow::ProcessAccelerator(wxKeyEvent& event) bool wxAddWindowToTable(Widget w, wxWindow *win) { wxWindow *oldItem = NULL; - if ((oldItem = (wxWindow *)gs_wxWidgetHashTable->Get ((long) w))) + if ((oldItem = (wxWindow *)wxWidgetHashTable->Get ((long) w))) { wxLogDebug("Widget table clash: new widget is %ld, %s", (long)w, win->GetClassInfo()->GetClassName()); return FALSE; } - gs_wxWidgetHashTable->Put((long) w, win); + wxWidgetHashTable->Put((long) w, win); return TRUE; } wxWindow *wxGetWindowFromTable(Widget w) { - return (wxWindow *)gs_wxWidgetHashTable->Get((long) w); + return (wxWindow *)wxWidgetHashTable->Get((long) w); } void wxDeleteWindowFromTable(Widget w) { - gs_wxWidgetHashTable->Delete((long)w); + wxWidgetHashTable->Delete((long)w); } // ---------------------------------------------------------------------------- -- 2.45.2