]> git.saurik.com Git - wxWidgets.git/commitdiff
simplified wxTextCtrl::Create() to use wxControl::MSWCreateControl() instead of dupli...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 19 Oct 2001 15:34:37 +0000 (15:34 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 19 Oct 2001 15:34:37 +0000 (15:34 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12086 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/textctrl.h
src/msw/textctrl.cpp

index d2d7315e4ea90a7b7753974ef32f5fed271cee51..a57f54c7544f3925e78c39a51c3feec67b82d1d3 100644 (file)
@@ -145,7 +145,6 @@ public:
 #endif // wxUSE_RICHEDIT
 
     virtual void AdoptAttributesFromHWND();
-    virtual void SetupColours();
 
     virtual bool AcceptsFocus() const;
 
index d3b91d242bc7ee980a8a3241a7795b51cc830236..1ec178c99f522b72c84f286ac9bdaaf7add96575 100644 (file)
@@ -185,7 +185,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
 
     // translate wxWin style flags to MSW ones, checking for consistency while
     // doing it
-    long msStyle = ES_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP;
+    long msStyle = ES_LEFT | WS_TABSTOP;
 
     if ( m_windowStyle & wxCLIP_SIBLINGS )
         msStyle |= WS_CLIPSIBLINGS;
@@ -297,36 +297,8 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         m_isRich = FALSE;
 #endif // wxUSE_RICHEDIT
 
-    bool want3D;
-    WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
-
-    // Even with extended styles, need to combine with WS_BORDER for them to
-    // look right.
-    if ( want3D || wxStyleHasBorder(m_windowStyle) )
-        msStyle |= WS_BORDER;
-
-    // NB: don't use pos and size as CreateWindowEx arguments because they
-    //     might be -1 in which case we should use the default values (and
-    //     SetSize called below takes care of it)
-    m_hWnd = (WXHWND)::CreateWindowEx(exStyle,
-                                      windowClass.c_str(),
-                                      NULL,
-                                      msStyle,
-                                      0, 0, 0, 0,
-                                      GetHwndOf(parent),
-                                      (HMENU)m_windowId,
-                                      wxGetInstance(),
-                                      NULL);
-
-    wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create text ctrl") );
-
-#if wxUSE_CTL3D
-    if ( want3D )
-    {
-        Ctl3dSubclassCtl(GetHwnd());
-        m_useCtl3D = TRUE;
-    }
-#endif
+    if ( !MSWCreateControl(windowClass, msStyle, pos, size, value) )
+        return FALSE;
 
 #if wxUSE_RICHEDIT
     if (m_isRich)
@@ -345,32 +317,6 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
     }
 #endif // wxUSE_RICHEDIT
 
-    SubclassWin(GetHWND());
-
-    // set font, position, size and initial value
-    wxFont& fontParent = parent->GetFont();
-    if ( fontParent.Ok() )
-    {
-        SetFont(fontParent);
-    }
-    else
-    {
-        SetFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
-    }
-
-    // Causes a crash for Symantec C++ and WIN32 for some reason
-#if !(defined(__SC__) && defined(__WIN32__))
-    if ( !value.IsEmpty() )
-    {
-        SetValue(value);
-    }
-#endif
-
-    // set colours
-    SetupColours();
-
-    SetSize(pos.x, pos.y, size.x, size.y);
-
     return TRUE;
 }
 
@@ -404,18 +350,6 @@ void wxTextCtrl::AdoptAttributesFromHWND()
     m_windowStyle |= wxTE_PROCESS_ENTER;
 }
 
-void wxTextCtrl::SetupColours()
-{
-    wxColour bkgndColour;
-//    if (IsEditable() || (m_windowStyle & wxTE_MULTILINE))
-        bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
-//    else
-//        bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
-
-    SetBackgroundColour(bkgndColour);
-    SetForegroundColour(GetParent()->GetForegroundColour());
-}
-
 // ----------------------------------------------------------------------------
 // set/get the controls text
 // ----------------------------------------------------------------------------