]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/listbox.cpp
More Motif additions: mdi and sashtest samples now just about work!
[wxWidgets.git] / src / motif / listbox.cpp
index 2dffe82cb1e56a4eaeecf77b82d5891a7b6137da..8bf509bbbe997d9e4c2c0d12dcadf8185352ef75 100644 (file)
@@ -40,7 +40,6 @@ wxListBox::wxListBox(): m_clientDataList(wxKEY_INTEGER)
 {
     m_noItems = 0;
     m_selected = 0;
-    m_inSetValue = FALSE;
 }
 
 bool wxListBox::Create(wxWindow *parent, wxWindowID id,
@@ -51,7 +50,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
                        const wxValidator& validator,
                        const wxString& name)
 {
-    m_inSetValue = FALSE;
     m_windowStyle = style;
     m_noItems = n;
     m_selected = 0;
@@ -86,6 +84,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 
     m_mainWidget = (WXWidget) listWidget;
 
+    Set(n, choices);
+
     XtManageChild (listWidget);
 
     long width = size.x;
@@ -434,6 +434,8 @@ void wxListBox::SetClientData(int N, char *Client_data)
     wxNode *node = m_clientDataList.Find ((long) N);
     if (node)
         node->SetData ((wxObject *)Client_data);
+    else
+        node = m_clientDataList.Append((long) N, (wxObject*) Client_data);
 }
 
 // Return number of selections and an array of selected integers
@@ -514,6 +516,13 @@ void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
     // Check resulting size is correct
     int tempW, tempH;
     GetSize (&tempW, &tempH);
+
+    /*
+    if (tempW != width || tempH != height)
+    {
+      cout << "wxListBox::SetSize sizes not set correctly.");
+    }
+    */
 }
 
 void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
@@ -674,7 +683,7 @@ void wxListBoxCallback (Widget w, XtPointer clientData,
 
     wxListBox *item = (wxListBox *) clientData;
 
-    if (item->m_inSetValue)
+    if (item->InSetValue())
         return;
 
     wxCommandEvent event (wxEVT_COMMAND_LISTBOX_SELECTED);
@@ -726,4 +735,7 @@ void wxListBoxDefaultActionProc (Widget list_w, XtPointer client_data, XmListCal
     lbox->GetEventHandler()->ProcessEvent(event) ;
 }
 
-
+WXWidget wxListBox::GetTopWidget() const
+{
+  return (WXWidget) XtParent( (Widget) m_mainWidget );
+}