+ return (WXWidget) XtParent( (Widget) m_mainWidget );
+}
+
+void wxListBox::ChangeBackgroundColour()
+{
+ wxWindow::ChangeBackgroundColour();
+
+ Widget parent = XtParent ((Widget) m_mainWidget);
+ Widget hsb, vsb;
+
+ XtVaGetValues (parent,
+ XmNhorizontalScrollBar, &hsb,
+ XmNverticalScrollBar, &vsb,
+ NULL);
+
+ /* TODO: should scrollbars be affected? Should probably have separate
+ * function to change them (by default, taken from wxSystemSettings)
+ */
+ wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
+ wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, true);
+ wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, true);
+
+ XtVaSetValues (hsb,
+ XmNtroughColor, backgroundColour.AllocColour(XtDisplay(hsb)),
+ NULL);
+ XtVaSetValues (vsb,
+ XmNtroughColor, backgroundColour.AllocColour(XtDisplay(vsb)),
+ NULL);
+
+ // MBN: why change parent's background? It looks really ugly.
+ // wxDoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, true);
+}
+
+void wxListBox::ChangeForegroundColour()
+{
+ wxWindow::ChangeForegroundColour();
+
+ Widget parent = XtParent ((Widget) m_mainWidget);
+ Widget hsb, vsb;
+
+ XtVaGetValues(parent,
+ XmNhorizontalScrollBar, &hsb,
+ XmNverticalScrollBar, &vsb,
+ NULL);
+
+ /* TODO: should scrollbars be affected? Should probably have separate
+ function to change them (by default, taken from wxSystemSettings)
+
+ wxDoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
+ wxDoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
+ wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
+ */
+}
+
+int wxListBox::GetCount() const
+{
+ return m_noItems;
+}
+
+#define LIST_SCROLL_SPACING 6
+
+wxSize wxDoGetListBoxBestSize( Widget listWidget, const wxWindow* window )
+{
+ int max;
+ Dimension spacing, highlight, xmargin, ymargin, shadow;
+ int width = 0;
+ int x, y;
+
+ XtVaGetValues( listWidget,
+ XmNitemCount, &max,
+ XmNlistSpacing, &spacing,
+ XmNhighlightThickness, &highlight,
+ XmNlistMarginWidth, &xmargin,
+ XmNlistMarginHeight, &ymargin,
+ XmNshadowThickness, &shadow,
+ NULL );
+
+ for( size_t i = 0; i < (size_t)max; ++i )