Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(678)

Unified Diff: ui/gfx/native_theme_win.cc

Issue 7196002: Fix checkbox in windows uninstaller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix trybot break in chromeos Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/native_theme_win.cc
===================================================================
--- ui/gfx/native_theme_win.cc (revision 90205)
+++ ui/gfx/native_theme_win.cc (working copy)
@@ -126,7 +126,26 @@
NULL, TS_TRUE, &size);
ReleaseDC(NULL, hdc);
- return SUCCEEDED(hr) ? Size(size.cx, size.cy) : Size();
+ if (FAILED(hr)) {
+ // TODO(rogerta): For now, we need to support radio buttons and checkboxes
+ // when theming is not enabled. Support for other parts can be added
+ // if/when needed.
+ switch (part) {
+ case kCheckbox:
+ case kRadio:
+ // TODO(rogerta): I was not able to find any API to get the default
+ // size of these controls, so determined these values empirically.
+ size.cx = 13;
+ size.cy = 13;
+ break;
+ default:
+ size.cx = 0;
+ size.cy = 0;
+ break;
+ }
+ }
+
+ return Size(size.cx, size.cy);
}
void NativeThemeWin::PaintToNonPlatformCanvas(SkCanvas* canvas,
@@ -497,8 +516,8 @@
}
RECT rect_win = rect.ToRECT();
- return PaintButton(hdc, BP_PUSHBUTTON, state_id, extra.classic_state,
- &rect_win);
+ return PaintButton(hdc, state, BP_PUSHBUTTON, state_id,
+ extra.classic_state | DFCS_BUTTONPUSH, &rect_win);
}
HRESULT NativeThemeWin::PaintRadioButton(HDC hdc,
@@ -526,8 +545,8 @@
}
RECT rect_win = rect.ToRECT();
- return PaintButton(hdc, BP_RADIOBUTTON, state_id, extra.classic_state,
- &rect_win);
+ return PaintButton(hdc, state, BP_RADIOBUTTON, state_id,
+ extra.classic_state | DFCS_BUTTONRADIO, &rect_win);
}
HRESULT NativeThemeWin::PaintCheckbox(HDC hdc,
@@ -563,11 +582,12 @@
}
RECT rect_win = rect.ToRECT();
- return PaintButton(hdc, BP_CHECKBOX, state_id, extra.classic_state,
- &rect_win);
+ return PaintButton(hdc, state, BP_CHECKBOX, state_id,
+ extra.classic_state | DFCS_BUTTONCHECK, &rect_win);
}
HRESULT NativeThemeWin::PaintButton(HDC hdc,
+ State state,
int part_id,
int state_id,
int classic_state,
@@ -576,6 +596,22 @@
if (handle && draw_theme_)
return draw_theme_(handle, hdc, part_id, state_id, rect, NULL);
+ // Adjust classic_state based on State.
+ switch(state) {
+ case kDisabled:
+ classic_state |= DFCS_INACTIVE;
+ break;
+ case kPressed:
+ classic_state |= DFCS_PUSHED;
+ break;
+ case kNormal:
+ case kHovered:
+ break;
+ default:
+ NOTREACHED() << "Unknown state: " << state;
+ break;
+ }
+
// Draw it manually.
// All pressed states have both low bits set, and no other states do.
const bool focused = ((state_id & ETS_FOCUSED) == ETS_FOCUSED);

Powered by Google App Engine
This is Rietveld 408576698