#pragma implementation "listbox.h"
#endif
-#include "wx/listbox.h"
+#ifdef __VMS
+#define XtParent XTPARENT
+#define XtDisplay XTDISPLAY
+#endif
+
+# include "wx/listbox.h"
#include "wx/settings.h"
#include "wx/dynarray.h"
#include "wx/log.h"
#include "wx/utils.h"
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
#include <Xm/List.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
#include "wx/motif/private.h"
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
-#endif
static void wxListBoxCallback(Widget w,
XtPointer clientData,
m_noItems ++;
}
-void wxListBox::Append(const wxString& item, char *clientData)
+void wxListBox::Append(const wxString& item, void *clientData)
{
int width1, height1;
int width2, height2;
m_noItems ++;
}
-void wxListBox::Set(int n, const wxString *choices, char** clientData)
+void wxListBox::Set(int n, const wxString *choices, void** clientData)
{
m_clientDataList.Clear();
int width1, height1;
m_inSetValue = FALSE;
}
-bool wxListBox::Selected(int N) const
+bool wxListBox::IsSelected(int N) const
{
// In Motif, no simple way to determine if the item is selected.
wxArrayInt theSelections;
XmListDeselectPos ((Widget) m_mainWidget, N + 1);
}
-char *wxListBox::GetClientData(int N) const
+void *wxListBox::GetClientData(int N) const
{
wxNode *node = m_clientDataList.Find ((long) N);
if (node)
- return (char *) node->Data ();
+ return (void *) node->Data ();
else
return NULL;
}
-void wxListBox::SetClientData(int N, char *Client_data)
+void wxListBox::SetClientData(int N, void *Client_data)
{
wxNode *node = m_clientDataList.Find ((long) N);
if (node)
ProcessCommand (event);
}
-void wxListBoxCallback (Widget w, XtPointer clientData,
+void wxListBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
XmListCallbackStruct * cbs)
{
/*
* designated "default button" in the action area and activate it
* as if the user had selected it.
*/
-void wxListBoxDefaultActionProc (Widget list_w, XtPointer client_data, XmListCallbackStruct * cbs)
+void wxListBoxDefaultActionProc (Widget WXUNUSED(list_w), XtPointer client_data, XmListCallbackStruct * WXUNUSED(cbs))
{
wxListBox *lbox = (wxListBox *) client_data;
/* TODO: should scrollbars be affected? Should probably have separate
* function to change them (by default, taken from wxSystemSettings)
*/
- wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
*/
}
+// These implement functions needed by wxControlWithItems.
+// Unfortunately, they're not all implemented yet.
+
+int wxListBox::GetCount() const
+{
+ return Number();
+}
+
+int wxListBox::DoAppend(const wxString& item)
+{
+ Append(item, (void*) NULL);
+ return GetCount() - 1;
+}
+// Just appends, doesn't yet insert
+void wxListBox::DoInsertItems(const wxArrayString& items, int WXUNUSED(pos))
+{
+ size_t nItems = items.GetCount();
+
+ for ( size_t n = 0; n < nItems; n++ )
+ {
+ Append( items[n], (void*) NULL);
+ }
+}
+
+void wxListBox::DoSetItems(const wxArrayString& items, void **clientData)
+{
+ size_t nItems = items.GetCount();
+ wxString* strings = new wxString[nItems];
+
+ for ( size_t n = 0; n < nItems; n++ )
+ {
+ strings[n] = items[n];
+ }
+ Set(nItems, strings, clientData);
+
+ delete[] strings;
+}
+
+void wxListBox::DoSetFirstItem(int WXUNUSED(n))
+{
+ wxFAIL_MSG( wxT("wxListBox::DoSetFirstItem not implemented") );
+}
+
+void wxListBox::DoSetItemClientData(int n, void* clientData)
+{
+ SetClientData(n, clientData);
+}
+
+void* wxListBox::DoGetItemClientData(int n) const
+{
+ return GetClientData(n);
+}
+
+void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
+{
+ DoSetItemClientData(n, (void*) clientData);
+}
+
+wxClientData* wxListBox::DoGetItemClientObject(int n) const
+{
+ return (wxClientData*) DoGetItemClientData(n);
+}
+
+void wxListBox::Select(int n)
+{
+ SetSelection(n, TRUE);
+}