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

Side by Side Diff: ui/views/controls/button/label_button_border.h

Issue 15061006: views: Switch Checkbox over to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm dcheck Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
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 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ui/gfx/insets.h"
11 #include "ui/views/border.h" 12 #include "ui/views/border.h"
12 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
13 #include "ui/views/painter.h" 14 #include "ui/views/painter.h"
14 15
15 namespace views { 16 namespace views {
16 17
17 // A Border that paints a LabelButton's background frame. 18 // A Border that paints a LabelButton's background frame.
18 class VIEWS_EXPORT LabelButtonBorder : public Border { 19 class VIEWS_EXPORT LabelButtonBorder : public Border {
19 public: 20 public:
20 explicit LabelButtonBorder(Button::ButtonStyle style); 21 explicit LabelButtonBorder(Button::ButtonStyle style);
21 virtual ~LabelButtonBorder(); 22 virtual ~LabelButtonBorder();
22 23
23 Button::ButtonStyle style() const { return style_; } 24 Button::ButtonStyle style() const { return style_; }
24 25
25 // Overridden from Border: 26 // Overridden from Border:
26 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; 27 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE;
27 virtual gfx::Insets GetInsets() const OVERRIDE; 28 virtual gfx::Insets GetInsets() const OVERRIDE;
28 29
30 void set_insets(const gfx::Insets& insets) { insets_ = insets; }
31
29 // Get or set the painter used for the specified |focused| button |state|. 32 // Get or set the painter used for the specified |focused| button |state|.
30 // LabelButtonBorder takes and retains ownership of |painter|. 33 // LabelButtonBorder takes and retains ownership of |painter|.
31 Painter* GetPainter(bool focused, Button::ButtonState state); 34 Painter* GetPainter(bool focused, Button::ButtonState state);
32 void SetPainter(bool focused, Button::ButtonState state, Painter* painter); 35 void SetPainter(bool focused, Button::ButtonState state, Painter* painter);
33 36
34 private: 37 private:
35 // The painters used for each unfocused or focused button state. 38 // The painters used for each unfocused or focused button state.
36 scoped_ptr<Painter> painters_[2][Button::STATE_COUNT]; 39 scoped_ptr<Painter> painters_[2][Button::STATE_COUNT];
37 40
38 // The button style supplied in part by this border. 41 // The button style supplied in part by this border.
39 Button::ButtonStyle style_; 42 Button::ButtonStyle style_;
40 43
44 gfx::Insets insets_;
45
41 DISALLOW_COPY_AND_ASSIGN(LabelButtonBorder); 46 DISALLOW_COPY_AND_ASSIGN(LabelButtonBorder);
42 }; 47 };
43 48
44 } // namespace views 49 } // namespace views
45 50
46 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ 51 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/button/label_button_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698