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

Side by Side Diff: ui/views/controls/button/checkbox.cc

Issue 103493005: Rename View::set_focusable and View::set_accessibility_focusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a few missing files Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/button/button.cc ('k') | ui/views/controls/button/custom_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/views/controls/button/checkbox.h" 5 #include "ui/views/controls/button/checkbox.h"
6 6
7 #include "grit/ui_resources.h" 7 #include "grit/ui_resources.h"
8 #include "ui/base/accessibility/accessible_view_state.h" 8 #include "ui/base/accessibility/accessible_view_state.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/views/controls/button/label_button_border.h" 10 #include "ui/views/controls/button/label_button_border.h"
11 #include "ui/views/painter.h" 11 #include "ui/views/painter.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 // static 15 // static
16 const char Checkbox::kViewClassName[] = "Checkbox"; 16 const char Checkbox::kViewClassName[] = "Checkbox";
17 17
18 Checkbox::Checkbox(const string16& label) 18 Checkbox::Checkbox(const string16& label)
19 : LabelButton(NULL, label), 19 : LabelButton(NULL, label),
20 checked_(false) { 20 checked_(false) {
21 SetHorizontalAlignment(gfx::ALIGN_LEFT); 21 SetHorizontalAlignment(gfx::ALIGN_LEFT);
22 LabelButtonBorder* button_border = static_cast<LabelButtonBorder*>(border()); 22 LabelButtonBorder* button_border = static_cast<LabelButtonBorder*>(border());
23 button_border->SetPainter(false, STATE_HOVERED, NULL); 23 button_border->SetPainter(false, STATE_HOVERED, NULL);
24 button_border->SetPainter(false, STATE_PRESSED, NULL); 24 button_border->SetPainter(false, STATE_PRESSED, NULL);
25 // Inset the trailing side by a couple pixels for the focus border. 25 // Inset the trailing side by a couple pixels for the focus border.
26 button_border->set_insets(gfx::Insets(0, 0, 0, 2)); 26 button_border->set_insets(gfx::Insets(0, 0, 0, 2));
27 set_focusable(true); 27 SetFocusable(true);
28 28
29 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 29 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
30 30
31 // Unchecked/Unfocused images. 31 // Unchecked/Unfocused images.
32 SetCustomImage(false, false, STATE_NORMAL, 32 SetCustomImage(false, false, STATE_NORMAL,
33 *rb.GetImageSkiaNamed(IDR_CHECKBOX)); 33 *rb.GetImageSkiaNamed(IDR_CHECKBOX));
34 SetCustomImage(false, false, STATE_HOVERED, 34 SetCustomImage(false, false, STATE_HOVERED,
35 *rb.GetImageSkiaNamed(IDR_CHECKBOX_HOVER)); 35 *rb.GetImageSkiaNamed(IDR_CHECKBOX_HOVER));
36 SetCustomImage(false, false, STATE_PRESSED, 36 SetCustomImage(false, false, STATE_PRESSED,
37 *rb.GetImageSkiaNamed(IDR_CHECKBOX_PRESSED)); 37 *rb.GetImageSkiaNamed(IDR_CHECKBOX_PRESSED));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 ui::NativeTheme::Part Checkbox::GetThemePart() const { 136 ui::NativeTheme::Part Checkbox::GetThemePart() const {
137 return ui::NativeTheme::kCheckbox; 137 return ui::NativeTheme::kCheckbox;
138 } 138 }
139 139
140 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { 140 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const {
141 LabelButton::GetExtraParams(params); 141 LabelButton::GetExtraParams(params);
142 params->button.checked = checked_; 142 params->button.checked = checked_;
143 } 143 }
144 144
145 } // namespace views 145 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/button.cc ('k') | ui/views/controls/button/custom_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698