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

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: More compile fix for 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
« no previous file with comments | « ui/views/controls/button/image_button.cc ('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 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 gfx::FontList cached_bold_font_list_; 141 gfx::FontList cached_bold_font_list_;
142 142
143 // The images and colors for each button state. 143 // The images and colors for each button state.
144 gfx::ImageSkia button_state_images_[STATE_COUNT]; 144 gfx::ImageSkia button_state_images_[STATE_COUNT];
145 SkColor button_state_colors_[STATE_COUNT]; 145 SkColor button_state_colors_[STATE_COUNT];
146 146
147 // Used to track whether SetTextColor() has been invoked. 147 // Used to track whether SetTextColor() has been invoked.
148 bool explicitly_set_colors_[STATE_COUNT]; 148 bool explicitly_set_colors_[STATE_COUNT];
149 149
150 // |min_size_| increases monotonically with the preferred size. 150 // |min_size_| increases monotonically with the preferred size.
151 gfx::Size min_size_; 151 mutable gfx::Size min_size_;
152 // |max_size_| may be set to clamp the preferred size. 152 // |max_size_| may be set to clamp the preferred size.
153 gfx::Size max_size_; 153 gfx::Size max_size_;
154 154
155 // Flag indicating default handling of the return key via an accelerator. 155 // Flag indicating default handling of the return key via an accelerator.
156 // Whether or not the button appears or behaves as the default button in its 156 // Whether or not the button appears or behaves as the default button in its
157 // current context; 157 // current context;
158 bool is_default_; 158 bool is_default_;
159 159
160 // The button's overall style. 160 // The button's overall style.
161 ButtonStyle style_; 161 ButtonStyle style_;
162 162
163 // True if current border was set by UpdateThemedBorder. Defaults to true. 163 // True if current border was set by UpdateThemedBorder. Defaults to true.
164 bool border_is_themed_border_; 164 bool border_is_themed_border_;
165 165
166 scoped_ptr<Painter> focus_painter_; 166 scoped_ptr<Painter> focus_painter_;
167 167
168 DISALLOW_COPY_AND_ASSIGN(LabelButton); 168 DISALLOW_COPY_AND_ASSIGN(LabelButton);
169 }; 169 };
170 170
171 } // namespace views 171 } // namespace views
172 172
173 #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/image_button.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698