| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_CONTROLS_LABEL_H_ | 5 #ifndef CHROME_VIEWS_CONTROLS_LABEL_H_ |
| 6 #define CHROME_VIEWS_CONTROLS_LABEL_H_ | 6 #define CHROME_VIEWS_CONTROLS_LABEL_H_ |
| 7 | 7 |
| 8 #include "chrome/common/gfx/chrome_font.h" | 8 #include "chrome/common/gfx/chrome_font.h" |
| 9 #include "chrome/views/view.h" | 9 #include "chrome/views/view.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 // Gets/sets the flag to determine whether the label should be collapsed when | 184 // Gets/sets the flag to determine whether the label should be collapsed when |
| 185 // it's hidden (not visible). If this flag is true, the label will return a | 185 // it's hidden (not visible). If this flag is true, the label will return a |
| 186 // preferred size of (0, 0) when it's not visible. | 186 // preferred size of (0, 0) when it's not visible. |
| 187 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } | 187 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } |
| 188 bool collapse_when_hidden() const { return collapse_when_hidden_; } | 188 bool collapse_when_hidden() const { return collapse_when_hidden_; } |
| 189 | 189 |
| 190 void set_paint_as_focused(bool paint_as_focused) { | 190 void set_paint_as_focused(bool paint_as_focused) { |
| 191 paint_as_focused_ = paint_as_focused; | 191 paint_as_focused_ = paint_as_focused; |
| 192 } | 192 } |
| 193 void set_has_focus_border(bool has_focus_border) { |
| 194 has_focus_border_ = has_focus_border; |
| 195 } |
| 193 | 196 |
| 194 private: | 197 private: |
| 195 // These tests call CalculateDrawStringParams in order to verify the | 198 // These tests call CalculateDrawStringParams in order to verify the |
| 196 // calculations done for drawing text. | 199 // calculations done for drawing text. |
| 197 FRIEND_TEST(LabelTest, DrawSingleLineString); | 200 FRIEND_TEST(LabelTest, DrawSingleLineString); |
| 198 FRIEND_TEST(LabelTest, DrawMultiLineString); | 201 FRIEND_TEST(LabelTest, DrawMultiLineString); |
| 199 | 202 |
| 200 static ChromeFont GetDefaultFont(); | 203 static ChromeFont GetDefaultFont(); |
| 201 | 204 |
| 202 // Returns parameters to be used for the DrawString call. | 205 // Returns parameters to be used for the DrawString call. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 scoped_ptr<Background> mouse_over_background_; | 237 scoped_ptr<Background> mouse_over_background_; |
| 235 // Whether to collapse the label when it's not visible. | 238 // Whether to collapse the label when it's not visible. |
| 236 bool collapse_when_hidden_; | 239 bool collapse_when_hidden_; |
| 237 // The following member variable is used to control whether the alignment | 240 // The following member variable is used to control whether the alignment |
| 238 // needs to be flipped around for RTL locales. Please refer to the definition | 241 // needs to be flipped around for RTL locales. Please refer to the definition |
| 239 // of RTLAlignmentMode for more information. | 242 // of RTLAlignmentMode for more information. |
| 240 RTLAlignmentMode rtl_alignment_mode_; | 243 RTLAlignmentMode rtl_alignment_mode_; |
| 241 // When embedded in a larger control that is focusable, setting this flag | 244 // When embedded in a larger control that is focusable, setting this flag |
| 242 // allows this view to be painted as focused even when it is itself not. | 245 // allows this view to be painted as focused even when it is itself not. |
| 243 bool paint_as_focused_; | 246 bool paint_as_focused_; |
| 247 // When embedded in a larger control that is focusable, setting this flag |
| 248 // allows this view to reserve space for a focus border that it otherwise |
| 249 // might not have because it is not itself focusable. |
| 250 bool has_focus_border_; |
| 244 | 251 |
| 245 DISALLOW_COPY_AND_ASSIGN(Label); | 252 DISALLOW_COPY_AND_ASSIGN(Label); |
| 246 }; | 253 }; |
| 247 | 254 |
| 248 } // namespace views | 255 } // namespace views |
| 249 | 256 |
| 250 #endif // CHROME_VIEWS_CONTROLS_LABEL_H_ | 257 #endif // CHROME_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |