| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 virtual gfx::Insets GetInsets() const; | 157 virtual gfx::Insets GetInsets() const; |
| 158 | 158 |
| 159 // Resizes the label so its width is set to the width of the longest line and | 159 // Resizes the label so its width is set to the width of the longest line and |
| 160 // its height deduced accordingly. | 160 // its height deduced accordingly. |
| 161 // This is only intended for multi-line labels and is useful when the label's | 161 // This is only intended for multi-line labels and is useful when the label's |
| 162 // text contains several lines separated with \n. | 162 // text contains several lines separated with \n. |
| 163 // |max_width| is the maximum width that will be used (longer lines will be | 163 // |max_width| is the maximum width that will be used (longer lines will be |
| 164 // wrapped). If 0, no maximum width is enforced. | 164 // wrapped). If 0, no maximum width is enforced. |
| 165 void SizeToFit(int max_width); | 165 void SizeToFit(int max_width); |
| 166 | 166 |
| 167 #if defined(OS_WIN) | 167 // Accessibility accessors, overridden from View. |
| 168 // TODO(port): Make portable equivalents of accessibility-related functions. | 168 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); |
| 169 | 169 virtual bool GetAccessibleName(std::wstring* name); |
| 170 // Returns the MSAA role of the current view. The role is what assistive | 170 virtual bool GetAccessibleState(AccessibilityTypes::State* state); |
| 171 // technologies (ATs) use to determine what behavior to expect from a given | |
| 172 // control. | |
| 173 bool GetAccessibleRole(VARIANT* role); | |
| 174 | |
| 175 // Returns a brief, identifying string, containing a unique, readable name. | |
| 176 bool GetAccessibleName(std::wstring* name); | |
| 177 | |
| 178 // Returns the MSAA state of the current view. Sets the input VARIANT | |
| 179 // appropriately, and returns true if a change was performed successfully. | |
| 180 // Overriden from View. | |
| 181 virtual bool GetAccessibleState(VARIANT* state); | |
| 182 #endif // defined(OS_WIN) | |
| 183 | 171 |
| 184 // Gets/sets the flag to determine whether the label should be collapsed when | 172 // 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 | 173 // 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. | 174 // preferred size of (0, 0) when it's not visible. |
| 187 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } | 175 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } |
| 188 bool collapse_when_hidden() const { return collapse_when_hidden_; } | 176 bool collapse_when_hidden() const { return collapse_when_hidden_; } |
| 189 | 177 |
| 190 void set_paint_as_focused(bool paint_as_focused) { | 178 void set_paint_as_focused(bool paint_as_focused) { |
| 191 paint_as_focused_ = paint_as_focused; | 179 paint_as_focused_ = paint_as_focused; |
| 192 } | 180 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // When embedded in a larger control that is focusable, setting this flag | 229 // 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. | 230 // allows this view to be painted as focused even when it is itself not. |
| 243 bool paint_as_focused_; | 231 bool paint_as_focused_; |
| 244 | 232 |
| 245 DISALLOW_COPY_AND_ASSIGN(Label); | 233 DISALLOW_COPY_AND_ASSIGN(Label); |
| 246 }; | 234 }; |
| 247 | 235 |
| 248 } // namespace views | 236 } // namespace views |
| 249 | 237 |
| 250 #endif // CHROME_VIEWS_CONTROLS_LABEL_H_ | 238 #endif // CHROME_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |