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_LABEL_H__ | 5 #ifndef CHROME_VIEWS_LABEL_H__ |
6 #define CHROME_VIEWS_LABEL_H__ | 6 #define CHROME_VIEWS_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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 virtual void SetEnabled(bool enabled); | 119 virtual void SetEnabled(bool enabled); |
120 | 120 |
121 // Resizes the label so its width is set to the width of the longest line and | 121 // Resizes the label so its width is set to the width of the longest line and |
122 // its height deduced accordingly. | 122 // its height deduced accordingly. |
123 // This is only intended for multi-line labels and is useful when the label's | 123 // This is only intended for multi-line labels and is useful when the label's |
124 // text contains several lines separated with \n. | 124 // text contains several lines separated with \n. |
125 // |max_width| is the maximum width that will be used (longer lines will be | 125 // |max_width| is the maximum width that will be used (longer lines will be |
126 // wrapped). If 0, no maximum width is enforced. | 126 // wrapped). If 0, no maximum width is enforced. |
127 void SizeToFit(int max_width); | 127 void SizeToFit(int max_width); |
128 | 128 |
| 129 #if defined(OS_WIN) |
| 130 // TODO(port): Make portable equivalents of accessibility-related functions. |
| 131 |
129 // Returns the MSAA role of the current view. The role is what assistive | 132 // Returns the MSAA role of the current view. The role is what assistive |
130 // technologies (ATs) use to determine what behavior to expect from a given | 133 // technologies (ATs) use to determine what behavior to expect from a given |
131 // control. | 134 // control. |
132 bool GetAccessibleRole(VARIANT* role); | 135 bool GetAccessibleRole(VARIANT* role); |
133 | 136 |
134 // Returns a brief, identifying string, containing a unique, readable name. | 137 // Returns a brief, identifying string, containing a unique, readable name. |
135 bool GetAccessibleName(std::wstring* name); | 138 bool GetAccessibleName(std::wstring* name); |
136 | 139 |
137 // Returns the MSAA state of the current view. Sets the input VARIANT | 140 // Returns the MSAA state of the current view. Sets the input VARIANT |
138 // appropriately, and returns true if a change was performed successfully. | 141 // appropriately, and returns true if a change was performed successfully. |
139 // Overriden from View. | 142 // Overriden from View. |
140 virtual bool GetAccessibleState(VARIANT* state); | 143 virtual bool GetAccessibleState(VARIANT* state); |
| 144 #endif // defined(OS_WIN) |
141 | 145 |
142 private: | 146 private: |
143 // These tests call CalculateDrawStringParams in order to verify the | 147 // These tests call CalculateDrawStringParams in order to verify the |
144 // calculations done for drawing text. | 148 // calculations done for drawing text. |
145 FRIEND_TEST(LabelTest, DrawSingleLineString); | 149 FRIEND_TEST(LabelTest, DrawSingleLineString); |
146 FRIEND_TEST(LabelTest, DrawMultiLineString); | 150 FRIEND_TEST(LabelTest, DrawMultiLineString); |
147 | 151 |
148 static ChromeFont GetDefaultFont(); | 152 static ChromeFont GetDefaultFont(); |
149 | 153 |
150 // Returns parameters to be used for the DrawString call. | 154 // Returns parameters to be used for the DrawString call. |
(...skipping 27 matching lines...) Expand all Loading... |
178 Alignment horiz_alignment_; | 182 Alignment horiz_alignment_; |
179 std::wstring tooltip_text_; | 183 std::wstring tooltip_text_; |
180 // Whether the mouse is over this label. | 184 // Whether the mouse is over this label. |
181 bool contains_mouse_; | 185 bool contains_mouse_; |
182 scoped_ptr<Background> mouse_over_background_; | 186 scoped_ptr<Background> mouse_over_background_; |
183 }; | 187 }; |
184 | 188 |
185 } // namespace views | 189 } // namespace views |
186 | 190 |
187 #endif // CHROME_VIEWS_VIEW_H__ | 191 #endif // CHROME_VIEWS_VIEW_H__ |
OLD | NEW |