]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/textctrl.cpp
Cured Dialog Editor position/size setting problem
[wxWidgets.git] / src / motif / textctrl.cpp
index 3d7c94d2e4f17c380391758d8849c032d7e2863e..b9f564264cd5088bbb057cb4fa636f6cb192ab9d 100644 (file)
@@ -80,7 +80,8 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
     m_modified = FALSE;
     m_processedDefault = FALSE;
     m_fileName = "";
-    m_backgroundColour = parent->GetBackgroundColour();
+    //    m_backgroundColour = parent->GetBackgroundColour();
+    m_backgroundColour = * wxWHITE;
     m_foregroundColour = parent->GetForegroundColour();
 
     SetName(name);
@@ -181,7 +182,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);
@@ -486,7 +489,7 @@ int wxTextCtrl::overflow(int c)
   // Verify that there are no characters in get area
   if ( gptr() && gptr() < egptr() )
   {
-     wxError("Who's trespassing my get area?","Internal error");
+     wxError("wxTextCtrl::overflow: Who's trespassing my get area?","Internal error");
      return EOF;
   }
 
@@ -647,46 +650,51 @@ void wxTextCtrl::ChangeBackgroundColour()
 {
     wxWindow::ChangeBackgroundColour();
 
-    Widget parent = XtParent ((Widget) m_mainWidget);
-    Widget hsb, vsb;
+    /* TODO: should scrollbars be affected? Should probably have separate
+     * function to change them (by default, taken from wxSystemSettings)
+     */
+    if (m_windowStyle & wxTE_MULTILINE)
+    {
+        Widget parent = XtParent ((Widget) m_mainWidget);
+        Widget hsb, vsb;
 
-    XtVaGetValues (parent,
+        XtVaGetValues (parent,
                     XmNhorizontalScrollBar, &hsb,
                     XmNverticalScrollBar, &vsb,
                     NULL);
+        wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+        if (hsb)
+            DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
+        if (vsb)
+            DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
 
-    /* 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);
+        DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
+    }
 }
 
 void wxTextCtrl::ChangeForegroundColour()
 {
     wxWindow::ChangeForegroundColour();
 
+    if (m_windowStyle & wxTE_MULTILINE)
+    {
+        Widget parent = XtParent ((Widget) m_mainWidget);
+        Widget hsb, vsb;
 
-    Widget parent = XtParent ((Widget) m_mainWidget);
-    Widget hsb, vsb;
-
-    XtVaGetValues (parent,
+        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);
+        /* 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)