X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/47bc1060127d86222768789575295254a710f5a6..58c7cd12b9035450e702d36dfdce63bfd008bcd0:/src/motif/statbox.cpp diff --git a/src/motif/statbox.cpp b/src/motif/statbox.cpp index b695120c8f..872d120417 100644 --- a/src/motif/statbox.cpp +++ b/src/motif/statbox.cpp @@ -27,7 +27,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) BEGIN_EVENT_TABLE(wxStaticBox, wxControl) - EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground) +// EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground) END_EVENT_TABLE() #endif @@ -51,6 +51,9 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, { m_formWidget = (WXWidget) 0; m_labelWidget = (WXWidget) 0; + m_backgroundColour = parent->GetBackgroundColour(); + m_foregroundColour = parent->GetForegroundColour(); + m_font = parent->GetFont(); SetName(name); @@ -76,10 +79,13 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, if (hasLabel) { + XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget)); + wxString label1(wxStripMenuCodes(label)); XmString text = XmStringCreateSimple ((char*) (const char*) label1); m_labelWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) label1, xmLabelWidgetClass, formWidget, + XmNfontList, fontList, XmNlabelString, text, NULL); XmStringFree (text); @@ -108,15 +114,30 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, XmNrightAttachment, XmATTACH_FORM, NULL); - m_mainWidget = (Widget) formWidget; + m_mainWidget = (WXWidget) frameWidget; + m_formWidget = (WXWidget) formWidget; SetCanAddEventHandler(TRUE); - AttachWidget (parent, m_mainWidget, (WXWidget) frameWidget, pos.x, pos.y, size.x, size.y); - ChangeColour(m_mainWidget); + AttachWidget (parent, (WXWidget) frameWidget, (WXWidget) formWidget, pos.x, pos.y, size.x, size.y); + ChangeBackgroundColour(); return TRUE; } +wxStaticBox::~wxStaticBox() +{ + DetachWidget(m_formWidget); + DetachWidget(m_mainWidget); + XtDestroyWidget((Widget) m_mainWidget); + if (m_labelWidget) + XtDestroyWidget((Widget) m_labelWidget); + XtDestroyWidget((Widget) m_formWidget); + + m_mainWidget = (WXWidget) 0; + m_labelWidget = (WXWidget) 0; + m_formWidget = (WXWidget) 0; +} + void wxStaticBox::SetLabel(const wxString& label) { if (!m_labelWidget) @@ -161,9 +182,9 @@ wxString wxStaticBox::GetLabel() const } } -void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - wxControl::SetSize (x, y, width, height, sizeFlags); + wxControl::DoSetSize (x, y, width, height, sizeFlags); if (m_labelWidget) { @@ -179,3 +200,22 @@ void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags) } } +void wxStaticBox::ChangeFont(bool keepOriginalSize) +{ + wxWindow::ChangeFont(keepOriginalSize); +} + +void wxStaticBox::ChangeBackgroundColour() +{ + wxWindow::ChangeBackgroundColour(); + if (m_labelWidget) + DoChangeBackgroundColour(m_labelWidget, m_backgroundColour); +} + +void wxStaticBox::ChangeForegroundColour() +{ + wxWindow::ChangeForegroundColour(); + if (m_labelWidget) + DoChangeForegroundColour(m_labelWidget, m_foregroundColour); +} +