X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/321db4b6bf15df209942b9c0e6c744c8e7074d1b..184b5d99a5382cd7a19888c85aff11f8a21af2f6:/src/motif/textctrl.cpp diff --git a/src/motif/textctrl.cpp b/src/motif/textctrl.cpp index e645133fcf..b28bdf9ef5 100644 --- a/src/motif/textctrl.cpp +++ b/src/motif/textctrl.cpp @@ -143,10 +143,12 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this); + m_windowFont = parent->GetFont(); + ChangeFont(FALSE); + SetCanAddEventHandler(TRUE); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); - SetFont(* parent->GetFont()); ChangeBackgroundColour(); return TRUE; @@ -179,7 +181,9 @@ wxString wxTextCtrl::GetValue() const void wxTextCtrl::SetValue(const wxString& value) { - wxASSERT_MSG( (!value.IsNull()), "Must not pass a null string to wxTextCtrl::SetValue." ) ; + // This assert is wrong -- means that you can't set an empty + // string (IsNull == IsEmpty). + // wxASSERT_MSG( (!value.IsNull()), "Must not pass a null string to wxTextCtrl::SetValue." ) ; m_inSetValue = TRUE; XmTextSetString ((Widget) m_mainWidget, (char*) (const char*) value); @@ -636,19 +640,55 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) } } -void wxTextCtrl::ChangeFont() +void wxTextCtrl::ChangeFont(bool keepOriginalSize) { - wxWindow::ChangeFont(); + wxWindow::ChangeFont(keepOriginalSize); } void wxTextCtrl::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) + if (hsb) + DoChangeBackgroundColour((WXWidget) hsb, m_backgroundColour, TRUE); + if (vsb) + DoChangeBackgroundColour((WXWidget) vsb, m_backgroundColour, TRUE); + */ + + DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE); } void wxTextCtrl::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) + if (hsb) + DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour); + if (vsb) + DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour); + */ + DoChangeForegroundColour((WXWidget) parent, m_foregroundColour); } static void wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer ptr)