]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/win32.cpp
Ehm... fixed my comment about DJGPP to say what I wanted it to say
[wxWidgets.git] / src / univ / themes / win32.cpp
index dc1a5005a6cef8de466520d55c143b4bfa8871ac..75adfec94e38d99d608941fff44daf3f1124dab4 100644 (file)
@@ -600,7 +600,7 @@ public:
     wxWin32Theme();
     virtual ~wxWin32Theme();
 
-    virtual wxRenderer *GetRenderer() { return m_renderer; }
+    virtual wxRenderer *GetRenderer();
     virtual wxInputHandler *GetInputHandler(const wxString& control);
     virtual wxColourScheme *GetColourScheme();
 
@@ -1111,8 +1111,8 @@ WX_IMPLEMENT_THEME(wxWin32Theme, win32, wxTRANSLATE("Win32 theme"));
 
 wxWin32Theme::wxWin32Theme()
 {
-    m_scheme = new wxWin32ColourScheme;
-    m_renderer = new wxWin32Renderer(m_scheme);
+    m_scheme = NULL;
+    m_renderer = NULL;
     m_handlerDefault = NULL;
 }
 
@@ -1131,6 +1131,16 @@ wxWin32Theme::~wxWin32Theme()
     delete m_scheme;
 }
 
+wxRenderer *wxWin32Theme::GetRenderer()
+{
+    if ( !m_renderer )
+    {
+        m_renderer = new wxWin32Renderer(GetColourScheme());
+    }
+
+    return m_renderer;
+}
+
 wxInputHandler *wxWin32Theme::GetDefaultInputHandler()
 {
     if ( !m_handlerDefault )
@@ -1209,6 +1219,10 @@ wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control)
 
 wxColourScheme *wxWin32Theme::GetColourScheme()
 {
+    if ( !m_scheme )
+    {
+        m_scheme = new wxWin32ColourScheme;
+    }
     return m_scheme;
 }
 
@@ -1296,7 +1310,10 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
 
         case TITLEBAR:          return wxColour(GetSysColor(COLOR_INACTIVECAPTION));
         case TITLEBAR_ACTIVE:   return wxColour(GetSysColor(COLOR_ACTIVECAPTION));
-        case TITLEBAR_TEXT:     return wxColour(GetSysColor(COLOR_CAPTIONTEXT));
+        case TITLEBAR_TEXT:     return wxColour(GetSysColor(COLOR_INACTIVECAPTIONTEXT));
+        case TITLEBAR_ACTIVE_TEXT: return wxColour(GetSysColor(COLOR_CAPTIONTEXT));
+        
+        case DESKTOP:           return wxColour(0x808000);
 #else // !__WXMSW__
         // use the standard Windows colours elsewhere
         case WINDOW:            return *wxWHITE;
@@ -1325,7 +1342,10 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
 
         case TITLEBAR:          return wxColour(0xaeaaae);
         case TITLEBAR_ACTIVE:   return wxColour(0x820300);
-        case TITLEBAR_TEXT:     return *wxWHITE;
+        case TITLEBAR_TEXT:     return wxColour(0xc0c0c0);
+        case TITLEBAR_ACTIVE_TEXT:return *wxWHITE;
+
+        case DESKTOP:           return wxColour(0x808000);
 #endif // __WXMSW__
 
         case MAX:
@@ -2175,7 +2195,13 @@ wxBitmap wxWin32Renderer::GetIndicator(IndicatorType indType, int flags)
                                     : IndicatorStatus_Unchecked;
 
     const char **xpm = bmpIndicators[indType][indState][indStatus];
-    return xpm ? wxBitmap(xpm) : wxNullBitmap;
+    if (xpm)
+    {
+        wxBitmap bmp(xpm);
+       return bmp;
+    }
+    else
+       return wxNullBitmap;
 }
 
 void wxWin32Renderer::DrawCheckOrRadioButton(wxDC& dc,
@@ -2213,6 +2239,7 @@ void wxWin32Renderer::DrawCheckOrRadioButton(wxDC& dc,
         rectLabel.SetRight(rect.GetRight());
     }
 
+    // THIS IS THE CULPRIT -- JACS
     dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
 
     DoDrawLabel(
@@ -2234,10 +2261,19 @@ void wxWin32Renderer::DrawRadioButton(wxDC& dc,
                                       wxAlignment align,
                                       int indexAccel)
 {
-    DrawCheckOrRadioButton(dc, label,
-                           bitmap.Ok() ? bitmap : GetRadioBitmap(flags),
+    if (bitmap.Ok())
+        DrawCheckOrRadioButton(dc, label,
+                              bitmap,
                            rect, flags, align, indexAccel,
-                           FOCUS_RECT_OFFSET_Y); // default focus rect offset
+                            FOCUS_RECT_OFFSET_Y); // default focus rect offset
+    else
+    {
+       wxBitmap rbitmap(GetRadioBitmap(flags));
+        DrawCheckOrRadioButton(dc, label,
+                              rbitmap,
+                           rect, flags, align, indexAccel,
+                              FOCUS_RECT_OFFSET_Y); // default focus rect offset
+    }
 }
 
 void wxWin32Renderer::DrawCheckButton(wxDC& dc,
@@ -2248,10 +2284,21 @@ void wxWin32Renderer::DrawCheckButton(wxDC& dc,
                                       wxAlignment align,
                                       int indexAccel)
 {
-    DrawCheckOrRadioButton(dc, label,
-                           bitmap.Ok() ? bitmap : GetCheckBitmap(flags),
-                           rect, flags, align, indexAccel,
-                           0); // no focus rect offset for checkboxes
+    if (bitmap.Ok())
+        DrawCheckOrRadioButton(dc, label,
+                              bitmap,
+                             rect, flags, align, indexAccel,
+                             0); // no focus rect offset for checkboxes
+    else
+    {
+       wxBitmap cbitmap(GetCheckBitmap(flags));
+#if 1
+        DrawCheckOrRadioButton(dc, label,
+                             cbitmap,
+                             rect, flags, align, indexAccel,
+                              0); // no focus rect offset for checkboxes
+#endif
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -3358,6 +3405,10 @@ void wxWin32Renderer::DrawFrameTitle(wxDC& dc,
                                      const wxString& title,
                                      int flags)
 {
+    wxColour col = (flags & wxTOPLEVEL_ACTIVE) ?
+                   wxSCHEME_COLOUR(m_scheme, TITLEBAR_ACTIVE_TEXT) :
+                   wxSCHEME_COLOUR(m_scheme, TITLEBAR_TEXT);
+
     wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
     r.height = FRAME_TITLEBAR_HEIGHT;
     if ( flags & wxTOPLEVEL_ICON )
@@ -3366,7 +3417,7 @@ void wxWin32Renderer::DrawFrameTitle(wxDC& dc,
         r.x += 1;
 
     dc.SetFont(m_titlebarFont);
-    dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, TITLEBAR_TEXT));
+    dc.SetTextForeground(col);
     dc.DrawLabel(title, wxNullBitmap, r, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
 }
 
@@ -4044,8 +4095,8 @@ bool wxWin32StatusBarInputHandler::IsOnGrip(wxWindow *statbar,
     {
         wxSize sizeSbar = statbar->GetSize();
 
-        return (sizeSbar.x - pt.x) < STATUSBAR_GRIP_SIZE &&
-               (sizeSbar.y - pt.y) < STATUSBAR_GRIP_SIZE;
+        return (sizeSbar.x - pt.x) < (wxCoord)STATUSBAR_GRIP_SIZE &&
+               (sizeSbar.y - pt.y) < (wxCoord)STATUSBAR_GRIP_SIZE;
     }
 
     return FALSE;