X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e025aa20625c8724a2250b9455a8007fb86337e..82ec1f703513f5a09edfea7403481c23fe7b4d1e:/src/motif/button.cpp diff --git a/src/motif/button.cpp b/src/motif/button.cpp index 65349d549d..77ce5c0242 100644 --- a/src/motif/button.cpp +++ b/src/motif/button.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: button.cpp +// Name: src/motif/button.cpp // Purpose: wxButton // Author: Julian Smart // Modified by: @@ -9,10 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "button.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -20,8 +16,6 @@ #define XtDisplay XTDISPLAY #endif -#include "wx/defs.h" - #include "wx/button.h" #ifdef __VMS__ @@ -33,6 +27,11 @@ #pragma message enable nosimpint #endif + +#ifndef WX_PRECOMP + #include "wx/toplevel.h" +#endif + #include "wx/stockitem.h" #include "wx/motif/private.h" #include "wx/sysopt.h" @@ -55,12 +54,11 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, wxString label(lbl); if (label.empty() && wxIsStockID(id)) label = wxGetStockLabel(id); - + if( !CreateControl( parent, id, pos, size, style, validator, name ) ) return false; - wxString label1(wxStripMenuCodes(label)); - wxXmString text( label1 ); + wxXmString text( GetLabelText(label) ); Widget parentWidget = (Widget) parent->GetClientWidget(); @@ -80,7 +78,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, XmNlabelString, text(), XmNrecomputeSize, False, // See comment for wxButton::SetDefault - // XmNdefaultButtonShadowThickness, 1, + // XmNdefaultButtonShadowThickness, 1, NULL); XtAddCallback ((Widget) m_mainWidget, @@ -129,9 +127,9 @@ void wxButton::SetDefaultShadowThicknessAndResize() void wxButton::SetDefault() { - wxWindow *parent = GetParent(); - if ( parent ) - parent->SetDefaultItem(this); + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( tlw ) + tlw->SetDefaultItem(this); // We initially do not set XmNdefaultShadowThickness, to have // small buttons. Unfortunately, buttons are now mis-aligned. We @@ -140,6 +138,7 @@ void wxButton::SetDefault() // wxButton in the same row, correction is straighforward: we set // resource for all wxButton in this parent (but not sub panels) + wxWindow *parent = GetParent(); for (wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst (); node; node = node->GetNext ()) {