1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 // This implements the WebThemeEngine API used by the Windows version of 32 // Chromium to render native form controls like checkboxes, radio buttons, 33 // and scroll bars. 34 // The normal implementation (native_theme) renders the controls using either 35 // the UXTheme theming engine present in XP, Vista, and Win 7, or the "classic" 36 // theme used if that theme is selected in the Desktop settings. 37 // Unfortunately, both of these themes render controls differently on the 38 // different versions of Windows. 39 // 40 // In order to ensure maximum consistency of baselines across the different 41 // Windows versions, we provide a simple implementation for DRT here 42 // instead. These controls are actually platform-independent (they're rendered 43 // using Skia) and could be used on Linux and the Mac as well, should we 44 // choose to do so at some point. 45 // 46 47 #ifndef WebThemeEngineDRTWin_h 48 #define WebThemeEngineDRTWin_h 49 50 #include "win/WebThemeEngine.h" 51 #include <wtf/Noncopyable.h> 52 53 class WebThemeEngineDRTWin : public WebKit::WebThemeEngine { 54 WTF_MAKE_NONCOPYABLE(WebThemeEngineDRTWin); 55 public: 56 WebThemeEngineDRTWin() {} 57 58 // WebThemeEngine methods: 59 virtual void paintButton( 60 WebKit::WebCanvas*, int part, int state, int classicState, 61 const WebKit::WebRect&); 62 63 virtual void paintMenuList( 64 WebKit::WebCanvas*, int part, int state, int classicState, 65 const WebKit::WebRect&); 66 67 virtual void paintScrollbarArrow( 68 WebKit::WebCanvas*, int state, int classicState, 69 const WebKit::WebRect&); 70 71 virtual void paintScrollbarThumb( 72 WebKit::WebCanvas*, int part, int state, int classicState, 73 const WebKit::WebRect&); 74 75 virtual void paintScrollbarTrack( 76 WebKit::WebCanvas*, int part, int state, int classicState, 77 const WebKit::WebRect&, const WebKit::WebRect& alignRect); 78 79 virtual void paintSpinButton( 80 WebKit::WebCanvas*, int part, int state, int classicState, 81 const WebKit::WebRect&); 82 83 virtual void paintTextField( 84 WebKit::WebCanvas*, int part, int state, int classicState, 85 const WebKit::WebRect&, WebKit::WebColor, bool fillContentArea, 86 bool drawEdges); 87 88 virtual void paintTrackbar( 89 WebKit::WebCanvas*, int part, int state, int classicState, 90 const WebKit::WebRect&); 91 92 virtual void paintProgressBar( 93 WebKit::WebCanvas*, const WebKit::WebRect& barRect, 94 const WebKit::WebRect& valueRect, 95 bool determinate, double time); 96 }; 97 98 #endif // WebThemeEngineDRTWin_h 99