OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file implements a simple generic version of the WebKitThemeEngine, | 5 // This file implements a simple generic version of the WebKitThemeEngine, |
6 // Since WebThemeEngine is unfortunately defined in terms of the Windows | 6 // Since WebThemeEngine is unfortunately defined in terms of the Windows |
7 // Theme parameters and values, we need to translate all the values into | 7 // Theme parameters and values, we need to translate all the values into |
8 // generic equivalents that we can more easily understand. This file does | 8 // generic equivalents that we can more easily understand. This file does |
9 // that translation (acting as a Facade design pattern) and then uses | 9 // that translation (acting as a Facade design pattern) and then uses |
10 // TestShellWebTheme::Control for the actual rendering of the widgets. | 10 // TestShellWebTheme::Control for the actual rendering of the widgets. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 CHECK_EQ(classic_state, DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_PUSHED); | 104 CHECK_EQ(classic_state, DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_PUSHED); |
105 ctype = Control::kCheckedBox_Type; | 105 ctype = Control::kCheckedBox_Type; |
106 cstate = Control::kPressed_State; | 106 cstate = Control::kPressed_State; |
107 break; | 107 break; |
108 case CBS_CHECKEDDISABLED: | 108 case CBS_CHECKEDDISABLED: |
109 CHECK_EQ(classic_state, | 109 CHECK_EQ(classic_state, |
110 DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE); | 110 DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE); |
111 ctype = Control::kCheckedBox_Type; | 111 ctype = Control::kCheckedBox_Type; |
112 cstate = Control::kDisabled_State; | 112 cstate = Control::kDisabled_State; |
113 break; | 113 break; |
| 114 case CBS_MIXEDNORMAL: |
| 115 // Classic theme can't represent mixed state checkbox. We assume |
| 116 // it's equivalent to unchecked. |
| 117 CHECK_EQ(classic_state, DFCS_BUTTONCHECK); |
| 118 ctype = Control::kIndeterminateCheckBox_Type; |
| 119 cstate = Control::kNormal_State; |
| 120 break; |
| 121 case CBS_MIXEDHOT: |
| 122 CHECK_EQ(classic_state, DFCS_BUTTONCHECK | DFCS_HOT); |
| 123 ctype = Control::kIndeterminateCheckBox_Type; |
| 124 cstate = Control::kHot_State; |
| 125 break; |
| 126 case CBS_MIXEDPRESSED: |
| 127 CHECK_EQ(classic_state, DFCS_BUTTONCHECK | DFCS_PUSHED); |
| 128 ctype = Control::kIndeterminateCheckBox_Type; |
| 129 cstate = Control::kPressed_State; |
| 130 break; |
| 131 case CBS_MIXEDDISABLED: |
| 132 CHECK_EQ(classic_state, DFCS_BUTTONCHECK | DFCS_INACTIVE); |
| 133 ctype = Control::kIndeterminateCheckBox_Type; |
| 134 cstate = Control::kDisabled_State; |
| 135 break; |
114 default: | 136 default: |
115 NOTREACHED(); | 137 NOTREACHED(); |
116 break; | 138 break; |
117 } | 139 } |
118 } else if (BP_RADIOBUTTON == part) { | 140 } else if (BP_RADIOBUTTON == part) { |
119 switch (state) { | 141 switch (state) { |
120 case RBS_UNCHECKEDNORMAL: | 142 case RBS_UNCHECKEDNORMAL: |
121 CHECK_EQ(classic_state, DFCS_BUTTONRADIO); | 143 CHECK_EQ(classic_state, DFCS_BUTTONRADIO); |
122 ctype = Control::kUncheckedRadio_Type; | 144 ctype = Control::kUncheckedRadio_Type; |
123 cstate = Control::kNormal_State; | 145 cstate = Control::kNormal_State; |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 const WebKit::WebRect& barRect, | 563 const WebKit::WebRect& barRect, |
542 const WebKit::WebRect& valueRect, | 564 const WebKit::WebRect& valueRect, |
543 bool determinate, double) { | 565 bool determinate, double) { |
544 Control::Type ctype = Control::kProgressBar_Type; | 566 Control::Type ctype = Control::kProgressBar_Type; |
545 Control::State cstate = | 567 Control::State cstate = |
546 determinate ? Control::kNormal_State : Control::kIndeterminate_State; | 568 determinate ? Control::kNormal_State : Control::kIndeterminate_State; |
547 drawProgressBar(canvas, ctype, cstate, barRect, valueRect); | 569 drawProgressBar(canvas, ctype, cstate, barRect, valueRect); |
548 } | 570 } |
549 | 571 |
550 } // namespace TestShellWebTheme | 572 } // namespace TestShellWebTheme |
OLD | NEW |