summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webthemeengine_impl_win.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 18:52:09 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 18:52:09 +0000
commita3d79ab709a169177f8f82852e6bfe4ab81bc1a1 (patch)
treedc3aae86477e201324bb463285b612c40892df16 /webkit/glue/webthemeengine_impl_win.cc
parentb4fc9c198c85039e15907ccbf99f4d7259d2f085 (diff)
downloadchromium_src-a3d79ab709a169177f8f82852e6bfe4ab81bc1a1.zip
chromium_src-a3d79ab709a169177f8f82852e6bfe4ab81bc1a1.tar.gz
chromium_src-a3d79ab709a169177f8f82852e6bfe4ab81bc1a1.tar.bz2
Adds WebThemeEngine, WebColor, and WebCanvas to the WebKit API (chrome-side).
R=dglazkov Review URL: http://codereview.chromium.org/40330 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webthemeengine_impl_win.cc')
-rw-r--r--webkit/glue/webthemeengine_impl_win.cc103
1 files changed, 103 insertions, 0 deletions
diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc
new file mode 100644
index 0000000..f06921c
--- /dev/null
+++ b/webkit/glue/webthemeengine_impl_win.cc
@@ -0,0 +1,103 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
+
+#include "webkit/glue/webthemeengine_impl_win.h"
+
+#include "WebRect.h"
+
+#include "base/gfx/native_theme.h"
+
+using WebKit::WebCanvas;
+using WebKit::WebColor;
+using WebKit::WebRect;
+
+namespace webkit_glue {
+
+static RECT WebRectToRECT(const WebRect& rect) {
+ RECT result;
+ result.left = rect.x;
+ result.top = rect.y;
+ result.right = rect.x + rect.width;
+ result.bottom = rect.y + rect.height;
+ return result;
+}
+
+void WebThemeEngineImpl::paintButton(
+ WebCanvas* canvas, int part, int state, int classic_state,
+ const WebRect& rect) {
+ HDC hdc = canvas->beginPlatformPaint();
+
+ RECT native_rect = WebRectToRECT(rect);
+ gfx::NativeTheme::instance()->PaintButton(
+ hdc, part, state, classic_state, &native_rect);
+
+ canvas->endPlatformPaint();
+}
+
+void WebThemeEngineImpl::paintMenuList(
+ WebCanvas* canvas, int part, int state, int classic_state,
+ const WebRect& rect) {
+ HDC hdc = canvas->beginPlatformPaint();
+
+ RECT native_rect = WebRectToRECT(rect);
+ gfx::NativeTheme::instance()->PaintMenuList(
+ hdc, part, state, classic_state, &native_rect);
+
+ canvas->endPlatformPaint();
+}
+
+void WebThemeEngineImpl::paintScrollbarArrow(
+ WebCanvas* canvas, int state, int classic_state,
+ const WebRect& rect) {
+ HDC hdc = canvas->beginPlatformPaint();
+
+ RECT native_rect = WebRectToRECT(rect);
+ gfx::NativeTheme::instance()->PaintScrollbarArrow(
+ hdc, state, classic_state, &native_rect);
+
+ canvas->endPlatformPaint();
+}
+
+void WebThemeEngineImpl::paintScrollbarThumb(
+ WebCanvas* canvas, int part, int state, int classic_state,
+ const WebRect& rect) {
+ HDC hdc = canvas->beginPlatformPaint();
+
+ RECT native_rect = WebRectToRECT(rect);
+ gfx::NativeTheme::instance()->PaintScrollbarThumb(
+ hdc, part, state, classic_state, &native_rect);
+
+ canvas->endPlatformPaint();
+}
+
+void WebThemeEngineImpl::paintScrollbarTrack(
+ WebCanvas* canvas, int part, int state, int classic_state,
+ const WebRect& rect, const WebRect& align_rect) {
+ HDC hdc = canvas->beginPlatformPaint();
+
+ RECT native_rect = WebRectToRECT(rect);
+ RECT native_align_rect = WebRectToRECT(align_rect);
+ gfx::NativeTheme::instance()->PaintScrollbarTrack(
+ hdc, part, state, classic_state, &native_rect, &native_align_rect,
+ canvas);
+
+ canvas->endPlatformPaint();
+}
+
+void WebThemeEngineImpl::paintTextField(
+ WebCanvas* canvas, int part, int state, int classic_state,
+ const WebRect& rect, WebColor color, bool fill_content_area,
+ bool draw_edges) {
+ HDC hdc = canvas->beginPlatformPaint();
+
+ RECT native_rect = WebRectToRECT(rect);
+
+ gfx::NativeTheme::instance()->PaintTextField(
+ hdc, part, state, classic_state, &native_rect, color, fill_content_area,
+ draw_edges);
+
+ canvas->endPlatformPaint();
+}
+
+} // namespace webkit_glue