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

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

Issue 340003002: Revert of views: Move MenuButton from TextButton to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/label_button.cc » ('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 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 20 matching lines...) Expand all
31 LabelButton(ButtonListener* listener, const base::string16& text); 31 LabelButton(ButtonListener* listener, const base::string16& text);
32 virtual ~LabelButton(); 32 virtual ~LabelButton();
33 33
34 // Get or set the image shown for the specified button state. 34 // Get or set the image shown for the specified button state.
35 // GetImage returns the image for STATE_NORMAL if the state's image is empty. 35 // GetImage returns the image for STATE_NORMAL if the state's image is empty.
36 virtual const gfx::ImageSkia& GetImage(ButtonState for_state); 36 virtual const gfx::ImageSkia& GetImage(ButtonState for_state);
37 void SetImage(ButtonState for_state, const gfx::ImageSkia& image); 37 void SetImage(ButtonState for_state, const gfx::ImageSkia& image);
38 38
39 // Get or set the text shown on the button. 39 // Get or set the text shown on the button.
40 const base::string16& GetText() const; 40 const base::string16& GetText() const;
41 virtual void SetText(const base::string16& text); 41 void SetText(const base::string16& text);
42 42
43 // Set the text color shown for the specified button state. 43 // Set the text color shown for the specified button state.
44 void SetTextColor(ButtonState for_state, SkColor color); 44 void SetTextColor(ButtonState for_state, SkColor color);
45 45
46 // Sets a halo color on the label.
47 void SetHaloColor(SkColor color);
48
49 // Get or set the text's multi-line property to break on '\n', etc. 46 // Get or set the text's multi-line property to break on '\n', etc.
50 bool GetTextMultiLine() const; 47 bool GetTextMultiLine() const;
51 void SetTextMultiLine(bool text_multi_line); 48 void SetTextMultiLine(bool text_multi_line);
52 49
53 // Get or set the font list used by this button. 50 // Get or set the font list used by this button.
54 const gfx::FontList& GetFontList() const; 51 const gfx::FontList& GetFontList() const;
55 void SetFontList(const gfx::FontList& font_list); 52 void SetFontList(const gfx::FontList& font_list);
56 53
57 // Set the elide behavior of this button. 54 // Set the elide behavior of this button.
58 void SetElideBehavior(gfx::ElideBehavior elide_behavior); 55 void SetElideBehavior(gfx::ElideBehavior elide_behavior);
59 56
60 // Get or set the horizontal alignment used for the button; reversed in RTL. 57 // Get or set the horizontal alignment used for the button; reversed in RTL.
61 // The optional image will lead the text, unless the button is right-aligned. 58 // The optional image will lead the text, unless the button is right-aligned.
62 gfx::HorizontalAlignment GetHorizontalAlignment() const; 59 gfx::HorizontalAlignment GetHorizontalAlignment() const;
63 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); 60 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment);
64 61
65 // Call set_min_size(gfx::Size()) to clear the monotonically increasing size. 62 // Call set_min_size(gfx::Size()) to clear the monotonically increasing size.
66 void set_min_size(const gfx::Size& min_size) { min_size_ = min_size; } 63 void set_min_size(const gfx::Size& min_size) { min_size_ = min_size; }
67 void set_max_size(const gfx::Size& max_size) { max_size_ = max_size; } 64 void set_max_size(const gfx::Size& max_size) { max_size_ = max_size; }
68 65
69 // Get or set the option to handle the return key; false by default. 66 // Get or set the option to handle the return key; false by default.
70 bool is_default() const { return is_default_; } 67 bool is_default() const { return is_default_; }
71 void SetIsDefault(bool is_default); 68 void SetIsDefault(bool is_default);
72 69
73 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|. 70 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|.
74 ButtonStyle style() const { return style_; } 71 ButtonStyle style() const { return style_; }
75 void SetStyle(ButtonStyle style); 72 void SetStyle(ButtonStyle style);
76 73
77 void SetFocusPainter(scoped_ptr<Painter> focus_painter); 74 void SetFocusPainter(scoped_ptr<Painter> focus_painter);
78 Painter* focus_painter() { return focus_painter_.get(); }
79 75
80 // View: 76 // View:
81 virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE; 77 virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE;
82 virtual gfx::Size GetPreferredSize() const OVERRIDE; 78 virtual gfx::Size GetPreferredSize() const OVERRIDE;
83 virtual void Layout() OVERRIDE; 79 virtual void Layout() OVERRIDE;
84 virtual const char* GetClassName() const OVERRIDE; 80 virtual const char* GetClassName() const OVERRIDE;
85 81
86 protected: 82 protected:
87 ImageView* image() const { return image_; } 83 ImageView* image() const { return image_; }
88 Label* label() const { return label_; } 84 Label* label() const { return label_; }
89 85
90 // Returns the available area for the label and image. Subclasses can change
91 // these bounds if they need room to do manual painting.
92 virtual gfx::Rect GetChildAreaBounds();
93
94 // View: 86 // View:
95 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 87 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
96 virtual void OnFocus() OVERRIDE; 88 virtual void OnFocus() OVERRIDE;
97 virtual void OnBlur() OVERRIDE; 89 virtual void OnBlur() OVERRIDE;
98 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; 90 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
99 91
100 // Fill |params| with information about the button. 92 // Fill |params| with information about the button.
101 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; 93 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const;
102 94
103 // Resets colors from the NativeTheme, explicitly set colors are unchanged. 95 // Resets colors from the NativeTheme, explicitly set colors are unchanged.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool border_is_themed_border_; 164 bool border_is_themed_border_;
173 165
174 scoped_ptr<Painter> focus_painter_; 166 scoped_ptr<Painter> focus_painter_;
175 167
176 DISALLOW_COPY_AND_ASSIGN(LabelButton); 168 DISALLOW_COPY_AND_ASSIGN(LabelButton);
177 }; 169 };
178 170
179 } // namespace views 171 } // namespace views
180 172
181 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 173 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698