X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a4294b7832a5aed3c1cccc06aecd227d43da8830..5b6ec9803a058368a1b240a22d444c7301c5715a:/src/motif/listbox.cpp diff --git a/src/motif/listbox.cpp b/src/motif/listbox.cpp index 8bf509bbbe..13fca3d66d 100644 --- a/src/motif/listbox.cpp +++ b/src/motif/listbox.cpp @@ -53,6 +53,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, m_windowStyle = style; m_noItems = n; m_selected = 0; + m_backgroundColour = parent->GetBackgroundColour(); + m_foregroundColour = parent->GetForegroundColour(); SetName(name); SetValidator(validator); @@ -105,13 +107,12 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, XtAddCallback (listWidget, XmNdefaultActionCallback, (XtCallbackProc) wxListBoxDefaultActionProc, (XtPointer) this); - AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height); + m_windowFont = parent->GetFont(); + ChangeFont(FALSE); - wxSystemSettings settings; - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); + AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height); - SetFont(* parent->GetFont()); - ChangeColour(m_mainWidget); + ChangeBackgroundColour(); return TRUE; } @@ -170,8 +171,8 @@ void wxListBox::Delete(int N) if (node) m_clientDataList.DeleteNode(node); // if existed then delete from list node = m_clientDataList.First(); // we now have to adjust all keys that while (node) // are >=N+1 - { if (node->key.integer >= (long)(N+1)) // very ugly C++ wise but no other way - node->key.integer--; // to look at or change key value + { if (node->GetKeyInteger() >= (long)(N+1)) + node->SetKeyInteger(node->GetKeyInteger() - 1); node = node->Next(); } @@ -739,3 +740,50 @@ WXWidget wxListBox::GetTopWidget() const { return (WXWidget) XtParent( (Widget) m_mainWidget ); } + +void wxListBox::ChangeFont(bool keepOriginalSize) +{ + wxWindow::ChangeFont(keepOriginalSize); +} + +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) + DoChangeBackgroundColour((WXWidget) hsb, m_backgroundColour, TRUE); + DoChangeBackgroundColour((WXWidget) vsb, m_backgroundColour, TRUE); + */ + + DoChangeBackgroundColour((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) + DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour); + DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour); + DoChangeForegroundColour((WXWidget) parent, m_foregroundColour); + */ +} + +