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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 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_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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void SetIsDefault(bool is_default); 68 void SetIsDefault(bool is_default);
69 69
70 // 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|.
71 ButtonStyle style() const { return style_; } 71 ButtonStyle style() const { return style_; }
72 void SetStyle(ButtonStyle style); 72 void SetStyle(ButtonStyle style);
73 73
74 void SetFocusPainter(scoped_ptr<Painter> focus_painter); 74 void SetFocusPainter(scoped_ptr<Painter> focus_painter);
75 75
76 // View: 76 // View:
77 virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE; 77 virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE;
78 virtual gfx::Size GetPreferredSize() OVERRIDE; 78 virtual gfx::Size GetPreferredSize() const OVERRIDE;
79 virtual void Layout() OVERRIDE; 79 virtual void Layout() OVERRIDE;
80 virtual const char* GetClassName() const OVERRIDE; 80 virtual const char* GetClassName() const OVERRIDE;
81 81
82 protected: 82 protected:
83 ImageView* image() const { return image_; } 83 ImageView* image() const { return image_; }
84 Label* label() const { return label_; } 84 Label* label() const { return label_; }
85 85
86 // View: 86 // View:
87 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 87 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
88 virtual void OnFocus() OVERRIDE; 88 virtual void OnFocus() OVERRIDE;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 gfx::FontList cached_bold_font_list_; 138 gfx::FontList cached_bold_font_list_;
139 139
140 // The images and colors for each button state. 140 // The images and colors for each button state.
141 gfx::ImageSkia button_state_images_[STATE_COUNT]; 141 gfx::ImageSkia button_state_images_[STATE_COUNT];
142 SkColor button_state_colors_[STATE_COUNT]; 142 SkColor button_state_colors_[STATE_COUNT];
143 143
144 // Used to track whether SetTextColor() has been invoked. 144 // Used to track whether SetTextColor() has been invoked.
145 bool explicitly_set_colors_[STATE_COUNT]; 145 bool explicitly_set_colors_[STATE_COUNT];
146 146
147 // |min_size_| increases monotonically with the preferred size. 147 // |min_size_| increases monotonically with the preferred size.
148 gfx::Size min_size_; 148 mutable gfx::Size min_size_;
149 // |max_size_| may be set to clamp the preferred size. 149 // |max_size_| may be set to clamp the preferred size.
150 gfx::Size max_size_; 150 gfx::Size max_size_;
151 151
152 // Flag indicating default handling of the return key via an accelerator. 152 // Flag indicating default handling of the return key via an accelerator.
153 // Whether or not the button appears or behaves as the default button in its 153 // Whether or not the button appears or behaves as the default button in its
154 // current context; 154 // current context;
155 bool is_default_; 155 bool is_default_;
156 156
157 // The button's overall style. 157 // The button's overall style.
158 ButtonStyle style_; 158 ButtonStyle style_;
159 159
160 // True if current border was set by UpdateThemedBorder. Defaults to true. 160 // True if current border was set by UpdateThemedBorder. Defaults to true.
161 bool border_is_themed_border_; 161 bool border_is_themed_border_;
162 162
163 scoped_ptr<Painter> focus_painter_; 163 scoped_ptr<Painter> focus_painter_;
164 164
165 DISALLOW_COPY_AND_ASSIGN(LabelButton); 165 DISALLOW_COPY_AND_ASSIGN(LabelButton);
166 }; 166 };
167 167
168 } // namespace views 168 } // namespace views
169 169
170 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 170 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698