diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-22 21:13:54 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-22 21:13:54 +0000 |
commit | 93786d86863a0fc8e83872a78ba875fd08753ae2 (patch) | |
tree | 7b20fb2a9155e09fa70370cd4da52e8b817bf9b4 /base/gfx | |
parent | cf7e592c1d75cd1ffc855667309adcc650112500 (diff) | |
download | chromium_src-93786d86863a0fc8e83872a78ba875fd08753ae2.zip chromium_src-93786d86863a0fc8e83872a78ba875fd08753ae2.tar.gz chromium_src-93786d86863a0fc8e83872a78ba875fd08753ae2.tar.bz2 |
Changes to how we draw buttons.
1) Change RenderThemeWin.cpp so that pressed buttons have priority over
focused buttons. I.e., if a button is focused and pressed, we should
draw it pressed.
2) In classic mode, add the black border for focused buttons and properly
add the dotted focus rect.
http://crbug.com/135
Review URL: http://codereview.chromium.org/8071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx')
-rw-r--r-- | base/gfx/native_theme.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/base/gfx/native_theme.cc b/base/gfx/native_theme.cc index b8aa30c..65f1914 100644 --- a/base/gfx/native_theme.cc +++ b/base/gfx/native_theme.cc @@ -82,8 +82,9 @@ HRESULT NativeTheme::PaintButton(HDC hdc, // Draw it manually. // All pressed states have both low bits set, and no other states do. - const bool focused = ((state_id & PBS_PRESSED) == PBS_PRESSED); - if ((part_id == BP_PUSHBUTTON) && focused) { + const bool focused = ((state_id & TS_CHECKED) == TS_CHECKED); + const bool pressed = ((state_id & PBS_PRESSED) == PBS_PRESSED); + if ((BP_PUSHBUTTON == part_id) && (pressed || focused)) { // BP_PUSHBUTTON has a focus rect drawn around the outer edge, and the // button itself is shrunk by 1 pixel. HBRUSH brush = GetSysColorBrush(COLOR_3DDKSHADOW); @@ -92,13 +93,21 @@ HRESULT NativeTheme::PaintButton(HDC hdc, InflateRect(rect, -1, -1); } } - DrawFrameControl(hdc, rect, DFC_BUTTON, classic_state); - // BP_RADIOBUTTON, BP_CHECKBOX, BP_GROUPBOX and BP_USERBUTTON have their - // focus drawn over the control. - if ((part_id != BP_PUSHBUTTON) && focused) + // Draw the focus rectangle (the dotted line box) only on buttons. For radio + // and checkboxes, we let webkit draw the focus rectangle (orange glow). + if ((BP_PUSHBUTTON == part_id) && focused) { + // The focus rect is inside the button. The exact number of pixels depends + // on whether we're in classic mode or using uxtheme. + if (handle && get_theme_content_rect_) { + get_theme_content_rect_(handle, hdc, part_id, state_id, rect, rect); + } else { + InflateRect(rect, -GetSystemMetrics(SM_CXEDGE), + -GetSystemMetrics(SM_CYEDGE)); + } DrawFocusRect(hdc, rect); + } return S_OK; } |