]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/radiobox.cpp
Various changes to make pop up menus work
[wxWidgets.git] / src / motif / radiobox.cpp
index 85c9cb6d198a4dfc7459dc2e0d3c7cf986dd47f3..82baee26db9e7a8d547c7c92dcb8f1c2eddf12cd 100644 (file)
 #pragma implementation "radiobox.h"
 #endif
 
 #pragma implementation "radiobox.h"
 #endif
 
+#ifdef __VMS
+#define XtDisplay XTDISPLAY
+#endif
+
+#include "wx/defs.h"
+
 #include "wx/radiobox.h"
 #include "wx/utils.h"
 
 #include "wx/radiobox.h"
 #include "wx/utils.h"
 
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
 #include <Xm/Label.h>
 #include <Xm/LabelG.h>
 #include <Xm/ToggleB.h>
 #include <Xm/Label.h>
 #include <Xm/LabelG.h>
 #include <Xm/ToggleB.h>
 #include <Xm/RowColumn.h>
 #include <Xm/Form.h>
 #include <Xm/Frame.h>
 #include <Xm/RowColumn.h>
 #include <Xm/Form.h>
 #include <Xm/Frame.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
 
 
-#include <wx/motif/private.h>
+#include "wx/motif/private.h"
 
 void wxRadioBoxCallback (Widget w, XtPointer clientData,
                     XmToggleButtonCallbackStruct * cbs);
 
 
 void wxRadioBoxCallback (Widget w, XtPointer clientData,
                     XmToggleButtonCallbackStruct * cbs);
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
-#endif
 
 // Radio box item
 wxRadioBox::wxRadioBox()
 
 // Radio box item
 wxRadioBox::wxRadioBox()
@@ -88,9 +98,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
 
     wxString label1(wxStripMenuCodes(title));
 
 
     wxString label1(wxStripMenuCodes(title));
 
-    XmString text = XmStringCreateSimple ((char*) (const char*) label1);
-
-    Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
+    Widget formWidget = XtVaCreateManagedWidget (name.c_str(),
                                         xmFormWidgetClass, parentWidget,
                                         XmNmarginHeight, 0,
                                         XmNmarginWidth, 0,
                                         xmFormWidgetClass, parentWidget,
                                         XmNmarginHeight, 0,
                                         XmNmarginWidth, 0,
@@ -101,20 +109,18 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
     XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
     if (label1 != "")
     {
     XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
     if (label1 != "")
     {
-        text = XmStringCreateSimple ((char*) (const char*) label1);
-        Widget labelWidget = XtVaCreateManagedWidget ((char*) (const char*) label1,
+        wxXmString text(label1);
+        (void)XtVaCreateManagedWidget(label1.c_str(),
 #if wxUSE_GADGETS
 #if wxUSE_GADGETS
-                                             style & wxCOLOURED ?
-                                    xmLabelWidgetClass : xmLabelGadgetClass,
+                                             style & wxCOLOURED ? xmLabelWidgetClass
+                                                                : xmLabelGadgetClass,
                                              formWidget,
 #else
                                              xmLabelWidgetClass, formWidget,
 #endif
                                              XmNfontList, fontList,
                                              formWidget,
 #else
                                              xmLabelWidgetClass, formWidget,
 #endif
                                              XmNfontList, fontList,
-                                             XmNlabelString, text,
+                                             XmNlabelString, text(),
                                              NULL);
                                              NULL);
-
-        XmStringFree (text);
     }
 
     Widget frameWidget = XtVaCreateManagedWidget ("frame",
     }
 
     Widget frameWidget = XtVaCreateManagedWidget ("frame",
@@ -128,11 +134,11 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
 
     Arg args[3];
 
 
     Arg args[3];
 
-    majorDim = (n + majorDim - 1) / majorDim;
+    m_majorDim = (n + m_majorDim - 1) / m_majorDim;
 
     XtSetArg (args[0], XmNorientation, ((style & wxHORIZONTAL) == wxHORIZONTAL ?
                                           XmHORIZONTAL : XmVERTICAL));
 
     XtSetArg (args[0], XmNorientation, ((style & wxHORIZONTAL) == wxHORIZONTAL ?
                                           XmHORIZONTAL : XmVERTICAL));
-    XtSetArg (args[1], XmNnumColumns, majorDim);
+    XtSetArg (args[1], XmNnumColumns, m_majorDim);
 
     Widget radioBoxWidget = XmCreateRadioBox (frameWidget, "radioBoxWidget", args, 2);
     m_mainWidget = (WXWidget) radioBoxWidget;
 
     Widget radioBoxWidget = XmCreateRadioBox (frameWidget, "radioBoxWidget", args, 2);
     m_mainWidget = (WXWidget) radioBoxWidget;
@@ -172,8 +178,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
                                     XmNfontList, fontList,
                                                  NULL);
         XtAddCallback ((Widget) m_radioButtons[i], XmNvalueChangedCallback, (XtCallbackProc) wxRadioBoxCallback,
                                     XmNfontList, fontList,
                                                  NULL);
         XtAddCallback ((Widget) m_radioButtons[i], XmNvalueChangedCallback, (XtCallbackProc) wxRadioBoxCallback,
-                     (XtCallbackProc) this);
-
+                     (XtPointer) this);
     }
     SetSelection (0);
 
     }
     SetSelection (0);
 
@@ -481,7 +486,7 @@ void wxRadioBoxCallback (Widget w, XtPointer clientData,
   wxRadioBox *item = (wxRadioBox *) clientData;
   int sel = -1;
   int i;
   wxRadioBox *item = (wxRadioBox *) clientData;
   int sel = -1;
   int i;
-  for (i = 0; i < item->Number(); i++)
+  for (i = 0; i < item->GetCount(); i++)
     if (item->GetRadioButtons() && ((Widget) (item->GetRadioButtons()[i]) == w))
       sel = i;
   item->SetSel(sel);
     if (item->GetRadioButtons() && ((Widget) (item->GetRadioButtons()[i]) == w))
       sel = i;
   item->SetSel(sel);