my wxMotif fixes (merged with Robert's changes), wxMotif compiles, links

and runs... until you click in the menu, that is.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-06-29 12:34:18 +00:00
parent a641505f0d
commit dfe1eee3bb
28 changed files with 782 additions and 751 deletions

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -15,6 +15,7 @@
#include "wx/button.h"
#include "wx/utils.h"
#include "wx/panel.h"
#include <Xm/PushBG.h>
#include <Xm/PushB.h>
@@ -41,21 +42,21 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_font = parent->GetFont();
parent->AddChild((wxButton *)this);
if (id == -1)
m_windowId = NewControlId();
else
m_windowId = id;
wxString label1(wxStripMenuCodes(label));
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
Widget parentWidget = (Widget) parent->GetClientWidget();
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
/*
* Patch Note (important)
* There is no major reason to put a defaultButtonThickness here.
@@ -72,29 +73,27 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
XmNlabelString, text,
// XmNdefaultButtonShadowThickness, 1, // See comment for wxButton::SetDefault
NULL);
XmStringFree (text);
XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
(XtPointer) this);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
return TRUE;
}
void wxButton::SetDefault()
{
wxWindow *parent = (wxWindow *)GetParent();
/*
TODO
if (parent)
parent->SetDefaultItem(this);
*/
wxWindow *parent = GetParent();
wxPanel *panel = wxDynamicCast(panel, wxPanel);
if ( panel )
panel->SetDefaultItem(this);
// We initially do not set XmNdefaultShadowThickness, to have small buttons.
// Unfortunately, buttons are now mis-aligned. We try to correct this
// now -- setting this ressource to 1 for each button in the same row.
@@ -109,16 +108,16 @@ void wxButton::SetDefault()
bool managed = XtIsManaged((Widget) item->GetMainWidget());
if (managed)
XtUnmanageChild ((Widget) item->GetMainWidget());
XtVaSetValues ((Widget) item->GetMainWidget(),
XmNdefaultButtonShadowThickness, 1,
NULL);
if (managed)
XtManageChild ((Widget) item->GetMainWidget());
}
} // while
} // while
// XtVaSetValues((Widget)handle, XmNshowAsDefault, 1, NULL);
XtVaSetValues ((Widget) parent->GetMainWidget(), XmNdefaultButton, (Widget) GetMainWidget(), NULL);
}
@@ -133,7 +132,7 @@ void wxButtonCallback (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
if (!wxGetWindowFromTable(w))
// Widget has been deleted!
return;
wxButton *item = (wxButton *) clientData;
wxCommandEvent event (wxEVT_COMMAND_BUTTON_CLICKED, item->GetId());
event.SetEventObject(item);