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

Unified Diff: ui/views/controls/button/toggle_button.h

Issue 2506133003: [ash-md] Allows ToggleButton to have a border and adds focus rectangle (Closed)
Patch Set: [ash-md] Allows ToggleButton to have a border and adds focus rectangle (rebase) Created 4 years, 1 month 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
« no previous file with comments | « ash/common/system/tray/tray_popup_utils.cc ('k') | ui/views/controls/button/toggle_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/toggle_button.h
diff --git a/ui/views/controls/button/toggle_button.h b/ui/views/controls/button/toggle_button.h
index eb8efadfbd22aea374cab8b80f86fdc1b46772d3..452dd80601e3c10dce28df6d2ba82ac3f0919b71 100644
--- a/ui/views/controls/button/toggle_button.h
+++ b/ui/views/controls/button/toggle_button.h
@@ -10,6 +10,8 @@
namespace views {
+class Painter;
+
// This view presents a button that has two states: on and off. This is similar
// to a checkbox but has no text and looks more like a two-state horizontal
// slider.
@@ -23,11 +25,19 @@ class VIEWS_EXPORT ToggleButton : public CustomButton {
void SetIsOn(bool is_on, bool animate);
bool is_on() const { return is_on_; }
+ void SetFocusPainter(std::unique_ptr<Painter> focus_painter);
+
+ // views::View:
+ gfx::Size GetPreferredSize() const override;
+
private:
friend class TestToggleButton;
class ThumbView;
- // Calculates the bounding box for the thumb (the circle).
+ // Calculates and returns the bounding box for the track.
+ gfx::Rect GetTrackBounds() const;
+
+ // Calculates and returns the bounding box for the thumb (the circle).
gfx::Rect GetThumbBounds() const;
// Updates position and color of the thumb.
@@ -35,14 +45,17 @@ class VIEWS_EXPORT ToggleButton : public CustomButton {
SkColor GetTrackColor(bool is_on) const;
- // CustomButton:
- gfx::Size GetPreferredSize() const override;
+ // views::View:
const char* GetClassName() const override;
void OnPaint(gfx::Canvas* canvas) override;
- void NotifyClick(const ui::Event& event) override;
+ void OnFocus() override;
+ void OnBlur() override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
+
+ // CustomButton:
+ void NotifyClick(const ui::Event& event) override;
void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
std::unique_ptr<InkDrop> CreateInkDrop() override;
@@ -55,6 +68,7 @@ class VIEWS_EXPORT ToggleButton : public CustomButton {
bool is_on_;
gfx::SlideAnimation slide_animation_;
ThumbView* thumb_view_;
+ std::unique_ptr<Painter> focus_painter_;
DISALLOW_COPY_AND_ASSIGN(ToggleButton);
};
« no previous file with comments | « ash/common/system/tray/tray_popup_utils.cc ('k') | ui/views/controls/button/toggle_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698