]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/win32.cpp
Make easier to compile with MSVC5.
[wxWidgets.git] / src / univ / themes / win32.cpp
index 596bc217a36a2e2d9cdf2420b28a08e812d7fd56..fae4a4a885deec9b070012baff00264e1efab43a 100644 (file)
@@ -1,4 +1,3 @@
-///////////////////////////////////////////////////////////////////////////////
 // Name:        univ/themes/win32.cpp
 // Purpose:     wxUniversal theme implementing Win32-like LNF
 // Author:      Vadim Zeitlin
     #include "wx/scrolbar.h"
     #include "wx/slider.h"
     #include "wx/textctrl.h"
+
+    #ifdef __WXMSW__
+        // for COLOR_* constants
+        #include "wx/msw/private.h"
+    #endif
 #endif // WX_PRECOMP
 
 #include "wx/notebook.h"
@@ -88,7 +92,6 @@ enum IndicatorStatus
     IndicatorStatus_Max
 };
 
-// ----------------------------------------------------------------------------
 // wxWin32Renderer: draw the GUI elements in Win32 style
 // ----------------------------------------------------------------------------
 
@@ -256,6 +259,7 @@ public:
                                    const wxMenuGeometryInfo& geomInfo);
 #endif
     virtual void GetComboBitmaps(wxBitmap *bmpNormal,
+                                 wxBitmap *bmpFocus,
                                  wxBitmap *bmpPressed,
                                  wxBitmap *bmpDisabled);
 
@@ -1090,6 +1094,37 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
 {
     switch ( col )
     {
+        // use the system colours under Windows
+#if defined(__WXMSW__)
+        case WINDOW:            return wxColour(GetSysColor(COLOR_WINDOW));
+
+        case CONTROL_PRESSED:
+        case CONTROL_CURRENT:
+        case CONTROL:           return wxColour(GetSysColor(COLOR_BTNFACE));
+
+        case CONTROL_TEXT:      return wxColour(GetSysColor(COLOR_BTNTEXT));
+
+        case SCROLLBAR:         return wxColour(GetSysColor(COLOR_SCROLLBAR));
+        case SCROLLBAR_PRESSED: return wxColour(GetSysColor(COLOR_HIGHLIGHT));
+
+        case HIGHLIGHT:         return wxColour(GetSysColor(COLOR_HIGHLIGHT));
+        case HIGHLIGHT_TEXT:    return wxColour(GetSysColor(COLOR_HIGHLIGHTTEXT));
+
+#if defined(COLOR_3DDKSHADOW)
+        case SHADOW_DARK:       return wxColour(GetSysColor(COLOR_3DDKSHADOW));
+#else
+        case SHADOW_DARK:       return *wxBLACK;
+#endif
+
+        case CONTROL_TEXT_DISABLED:
+        case SHADOW_HIGHLIGHT:  return wxColour(GetSysColor(COLOR_BTNHIGHLIGHT));
+
+        case SHADOW_IN:         return wxColour(GetSysColor(COLOR_BTNFACE));
+
+        case CONTROL_TEXT_DISABLED_SHADOW:
+        case SHADOW_OUT:        return wxColour(GetSysColor(COLOR_BTNSHADOW));
+#else // !__WXMSW__
+        // use the standard Windows colours elsewhere
         case WINDOW:            return *wxWHITE;
 
         case CONTROL_PRESSED:
@@ -1113,6 +1148,7 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
 
         case CONTROL_TEXT_DISABLED_SHADOW:
         case SHADOW_OUT:        return wxColour(0x7f7f7f);
+#endif // __WXMSW__
 
         case MAX:
         default:
@@ -2682,6 +2718,7 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
 
 #else // !wxUSE_MENUS
 
+/*
 void wxWin32Renderer::DrawMenuBarItem(wxDC& WXUNUSED(dc),
                                       const wxRect& WXUNUSED(rectOrig),
                                       const wxString& WXUNUSED(label),
@@ -2718,6 +2755,7 @@ wxWin32Renderer::GetMenuGeometry(wxWindow *WXUNUSED(win),
 {
     return NULL;
 }
+*/
 
 #endif // wxUSE_MENUS/!wxUSE_MENUS
 
@@ -2726,6 +2764,7 @@ wxWin32Renderer::GetMenuGeometry(wxWindow *WXUNUSED(win),
 // ----------------------------------------------------------------------------
 
 void wxWin32Renderer::GetComboBitmaps(wxBitmap *bmpNormal,
+                                      wxBitmap *bmpFocus,
                                       wxBitmap *bmpPressed,
                                       wxBitmap *bmpDisabled)
 {
@@ -2975,19 +3014,17 @@ void wxWin32Renderer::AdjustSize(wxSize *size, const wxWindow *window)
 #if wxUSE_BUTTON
     if ( wxDynamicCast(window, wxButton) )
     {
-        // TODO
-        size->x += 3*window->GetCharWidth();
-#if 0 // do allow creating small buttons if wanted
-        wxSize sizeDef = wxButton::GetDefaultSize();
-        if ( size->x < sizeDef.x )
-            size->x = sizeDef.x;
-#endif // 0
-
-        wxCoord heightBtn = (11*(window->GetCharHeight() + 8))/10;
-        if ( size->y < heightBtn - 8 )
-            size->y = heightBtn;
-        else
-            size->y += 9;
+        if ( !(window->GetWindowStyle() & wxBU_EXACTFIT) )
+        {
+            // TODO: don't harcode all this
+            size->x += 3*window->GetCharWidth();
+
+            wxCoord heightBtn = (11*(window->GetCharHeight() + 8))/10;
+            if ( size->y < heightBtn - 8 )
+                size->y = heightBtn;
+            else
+                size->y += 9;
+        }
 
         // no border width adjustments for buttons
         return;
@@ -3023,6 +3060,14 @@ bool wxWin32InputHandler::HandleKey(wxControl *control,
 bool wxWin32InputHandler::HandleMouse(wxControl *control,
                                       const wxMouseEvent& event)
 {
+    // clicking on the control gives it focus
+    if ( event.ButtonDown() && wxWindow::FindFocus() != control )
+    {
+        control->SetFocus();
+
+        return TRUE;
+    }
+
     return FALSE;
 }