]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/metal.cpp
setting clipping correctly
[wxWidgets.git] / src / univ / themes / metal.cpp
index a1e1e2d92bc6868885ac504f800383b94899f7d6..af2b79fd60bc683595c71bda1759dc565d7533d2 100644 (file)
@@ -1,4 +1,5 @@
-// Name:        univ/themes/metal.cpp
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/univ/themes/metal.cpp
 // Purpose:     wxUniversal theme implementing Win32-like LNF
 // Author:      Vadim Zeitlin, Robert Roebling
 // Modified by:
     #pragma hdrstop
 #endif
 
+#include "wx/univ/theme.h"
+
+#if wxUSE_THEME_METAL
+
 #ifndef WX_PRECOMP
     #include "wx/timer.h"
     #include "wx/intl.h"
     #include "wx/textctrl.h"
     #include "wx/toolbar.h"
 
-    #ifdef __WXMSW__
-        // for COLOR_* constants
-        #include "wx/msw/private.h"
-    #endif
+    #include "wx/menu.h"
+    #include "wx/settings.h"
+    #include "wx/toplevel.h"
 #endif // WX_PRECOMP
 
 #include "wx/notebook.h"
 #include "wx/spinbutt.h"
-#include "wx/settings.h"
-#include "wx/menu.h"
 #include "wx/artprov.h"
-#include "wx/toplevel.h"
 
 #include "wx/univ/scrtimer.h"
 #include "wx/univ/renderer.h"
+#include "wx/univ/inpcons.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
-#include "wx/univ/theme.h"
 
 // wxMetalRenderer: draw the GUI elements in Metal style
 // ----------------------------------------------------------------------------
@@ -79,8 +80,8 @@ class wxMetalRenderer : public wxDelegateRenderer
         Arrow_Normal,
         Arrow_Disabled,
         Arrow_Pressed,
-        Arrow_Inversed,
-        Arrow_InversedDisabled,
+        Arrow_Inverted,
+        Arrow_InvertedDisabled,
         Arrow_StateMax
     };
 public:
@@ -141,8 +142,6 @@ private:
 // wxMetalTheme
 // ----------------------------------------------------------------------------
 
-WX_DEFINE_ARRAY_PTR(wxInputHandler *, wxArrayHandlers);
-
 class wxMetalTheme : public wxTheme
 {
 public:
@@ -151,8 +150,10 @@ public:
 
     virtual wxRenderer *GetRenderer();
     virtual wxArtProvider *GetArtProvider();
-    virtual wxInputHandler *GetInputHandler(const wxString& control);
+    virtual wxInputHandler *GetInputHandler(const wxString& control,
+                                            wxInputConsumer *consumer);
     virtual wxColourScheme *GetColourScheme();
+
 private:
     bool GetOrCreateTheme()
     {
@@ -160,10 +161,10 @@ private:
             m_win32Theme = wxTheme::Create( wxT("win32") );
         return m_win32Theme != NULL;
     }
-private:
+
     wxTheme *m_win32Theme;
     wxMetalRenderer *m_renderer;
-    
+
     WX_DECLARE_THEME(Metal)
 };
 
@@ -207,11 +208,12 @@ wxArtProvider *wxMetalTheme::GetArtProvider()
     return m_win32Theme->GetArtProvider();
 }
 
-wxInputHandler *wxMetalTheme::GetInputHandler(const wxString& control)
+wxInputHandler *wxMetalTheme::GetInputHandler(const wxString& control,
+                                              wxInputConsumer *consumer)
 {
     if ( !GetOrCreateTheme() )
         return 0;
-    return m_win32Theme->GetInputHandler(control);
+    return m_win32Theme->GetInputHandler(control, consumer);
 }
 
 wxColourScheme *wxMetalTheme::GetColourScheme()
@@ -226,7 +228,7 @@ wxColourScheme *wxMetalTheme::GetColourScheme()
 // ----------------------------------------------------------------------------
 
 wxMetalRenderer::wxMetalRenderer(wxRenderer *renderer, wxColourScheme *scheme)
-    : wxDelegateRenderer(renderer)
+               : wxDelegateRenderer(renderer)
 {
     // init colours and pens
     m_penBlack = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_DARK), 0, wxSOLID);
@@ -366,31 +368,31 @@ wxMetalRenderer::wxMetalRenderer(wxRenderer *renderer, wxColourScheme *scheme)
 
         }
 
-        // create the inversed bitmap but only for the right arrow as we only
+        // create the inverted bitmap but only for the right arrow as we only
         // use it for the menus
         if ( n == Arrow_Right )
         {
-            m_bmpArrows[Arrow_Inversed][n].Create(w, h);
-            dcInverse.SelectObject(m_bmpArrows[Arrow_Inversed][n]);
+            m_bmpArrows[Arrow_Inverted][n].Create(w, h);
+            dcInverse.SelectObject(m_bmpArrows[Arrow_Inverted][n]);
             dcInverse.Clear();
             dcInverse.Blit(0, 0, w, h,
                           &dcNormal, 0, 0,
                           wxXOR);
             dcInverse.SelectObject(wxNullBitmap);
 
-            mask = new wxMask(m_bmpArrows[Arrow_Inversed][n], *wxBLACK);
-            m_bmpArrows[Arrow_Inversed][n].SetMask(mask);
+            mask = new wxMask(m_bmpArrows[Arrow_Inverted][n], *wxBLACK);
+            m_bmpArrows[Arrow_Inverted][n].SetMask(mask);
 
-            m_bmpArrows[Arrow_InversedDisabled][n].Create(w, h);
-            dcInverse.SelectObject(m_bmpArrows[Arrow_InversedDisabled][n]);
+            m_bmpArrows[Arrow_InvertedDisabled][n].Create(w, h);
+            dcInverse.SelectObject(m_bmpArrows[Arrow_InvertedDisabled][n]);
             dcInverse.Clear();
             dcInverse.Blit(0, 0, w, h,
                           &dcDisabled, 0, 0,
                           wxXOR);
             dcInverse.SelectObject(wxNullBitmap);
 
-            mask = new wxMask(m_bmpArrows[Arrow_InversedDisabled][n], *wxBLACK);
-            m_bmpArrows[Arrow_InversedDisabled][n].SetMask(mask);
+            mask = new wxMask(m_bmpArrows[Arrow_InvertedDisabled][n], *wxBLACK);
+            m_bmpArrows[Arrow_InvertedDisabled][n].SetMask(mask);
         }
 
         dcNormal.SelectObject(wxNullBitmap);
@@ -587,8 +589,10 @@ void wxMetalRenderer::DrawMetal(wxDC &dc, const wxRect &rect )
     dc.SetPen(*wxTRANSPARENT_PEN);
     for (int y = rect.y; y < rect.height+rect.y; y++)
     {
-       int intens = 230 + 80 * (rect.y-y) / rect.height;
+       unsigned char intens = (unsigned char)(230 + 80 * (rect.y-y) / rect.height);
        dc.SetBrush( wxBrush( wxColour(intens,intens,intens), wxSOLID ) );
        dc.DrawRectangle( rect.x, y, rect.width, 1 );
     }
 }
+
+#endif // wxUSE_THEME_METAL