]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
ROP 0x00AA0029 used for transparent area in DrawBitmap and Blit
[wxWidgets.git] / src / msw / textctrl.cpp
index fa1c2a47c5006927d9bbaae2c8842745e2e905af..794d146e783f4a06d6d1f95a6b52191b665809e8 100644 (file)
@@ -152,9 +152,6 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
     if ( parent )
         parent->AddChild(this);
 
-    // set colours
-    SetupColours();
-
     // translate wxWin style flags to MSW ones, checking for consistency while
     // doing it
     long msStyle = ES_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP;
@@ -316,6 +313,9 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
     }
 #endif
 
+    // set colours
+    SetupColours();
+
     SetSize(pos.x, pos.y, size.x, size.y);
 
     return TRUE;
@@ -353,8 +353,13 @@ void wxTextCtrl::AdoptAttributesFromHWND()
 
 void wxTextCtrl::SetupColours()
 {
-    // FIXME why is bg colour not inherited from parent?
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
+    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());
 }
 
@@ -516,8 +521,16 @@ bool wxTextCtrl::CanPaste() const
 
 void wxTextCtrl::SetEditable(bool editable)
 {
+    bool isEditable = IsEditable();
+
     HWND hWnd = GetHwnd();
     SendMessage(hWnd, EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L);
+
+    if (editable != isEditable)
+    {
+       SetupColours();
+       Refresh();
+    }
 }
 
 void wxTextCtrl::SetInsertionPoint(long pos)
@@ -880,30 +893,19 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
             // ourselves the fact that we got here means that the user code
             // decided to skip processing of this TAB - probably to let it
             // do its default job.
-            //
-            // NB: Notice that Ctrl-Tab is handled elsewhere and Alt-Tab is
-            //     handled by Windows
             {
                 wxNavigationKeyEvent eventNav;
                 eventNav.SetDirection(!event.ShiftDown());
-                eventNav.SetWindowChange(FALSE);
+                eventNav.SetWindowChange(event.ControlDown());
                 eventNav.SetEventObject(this);
 
-                if ( GetEventHandler()->ProcessEvent(eventNav) )
+                if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
                     return;
             }
             break;
-
-        default:
-            event.Skip();
-            return;
     }
 
-    // don't just call event.Skip() because this will cause TABs and ENTERs
-    // be passed upwards and we don't always want this - instead process it
-    // right here
-
-    // FIXME
+    // no, we didn't process it
     event.Skip();
 }