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

Side by Side Diff: chrome/views/controls/label.h

Issue 100013: Allow words to be wrapped in message box.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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 | « chrome/common/gfx/chrome_canvas_win.cc ('k') | chrome/views/controls/label.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) 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // to every label that originates from the Chrome UI. However, if the label 114 // to every label that originates from the Chrome UI. However, if the label
115 // originates from a web page, its alignment should not be flipped around for 115 // originates from a web page, its alignment should not be flipped around for
116 // RTL locales. For such labels, we need to set the RTL alignment mode to 116 // RTL locales. For such labels, we need to set the RTL alignment mode to
117 // AUTO_DETECT_ALIGNMENT so that subsequent SetHorizontalAlignment() calls 117 // AUTO_DETECT_ALIGNMENT so that subsequent SetHorizontalAlignment() calls
118 // will not flip the label's alignment around. 118 // will not flip the label's alignment around.
119 void SetRTLAlignmentMode(RTLAlignmentMode mode); 119 void SetRTLAlignmentMode(RTLAlignmentMode mode);
120 120
121 RTLAlignmentMode GetRTLAlignmentMode() const; 121 RTLAlignmentMode GetRTLAlignmentMode() const;
122 122
123 // Set whether the label text can wrap on multiple lines. 123 // Set whether the label text can wrap on multiple lines.
124 // Default is false 124 // Default is false.
125 void SetMultiLine(bool f); 125 void SetMultiLine(bool f);
126 126
127 // Set whether the label text can be split on words.
128 // Default is false. This only works when is_multi_line is true.
129 void SetAllowCharacterBreak(bool f);
130
127 // Return whether the label text can wrap on multiple lines 131 // Return whether the label text can wrap on multiple lines
128 bool IsMultiLine(); 132 bool IsMultiLine();
129 133
130 // Sets the tooltip text. Default behavior for a label (single-line) is to 134 // Sets the tooltip text. Default behavior for a label (single-line) is to
131 // show the full text if it is wider than its bounds. Calling this overrides 135 // show the full text if it is wider than its bounds. Calling this overrides
132 // the default behavior and lets you set a custom tooltip. To revert to 136 // the default behavior and lets you set a custom tooltip. To revert to
133 // default behavior, call this with an empty string. 137 // default behavior, call this with an empty string.
134 void SetTooltipText(const std::wstring& tooltip_text); 138 void SetTooltipText(const std::wstring& tooltip_text);
135 139
136 // Gets the tooltip text for labels that are wider than their bounds, except 140 // Gets the tooltip text for labels that are wider than their bounds, except
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 int ComputeMultiLineFlags(); 226 int ComputeMultiLineFlags();
223 gfx::Size GetTextSize(); 227 gfx::Size GetTextSize();
224 void Init(const std::wstring& text, const ChromeFont& font); 228 void Init(const std::wstring& text, const ChromeFont& font);
225 std::wstring text_; 229 std::wstring text_;
226 GURL url_; 230 GURL url_;
227 ChromeFont font_; 231 ChromeFont font_;
228 SkColor color_; 232 SkColor color_;
229 gfx::Size text_size_; 233 gfx::Size text_size_;
230 bool text_size_valid_; 234 bool text_size_valid_;
231 bool is_multi_line_; 235 bool is_multi_line_;
236 bool allow_character_break_;
232 bool url_set_; 237 bool url_set_;
233 Alignment horiz_alignment_; 238 Alignment horiz_alignment_;
234 std::wstring tooltip_text_; 239 std::wstring tooltip_text_;
235 // Whether the mouse is over this label. 240 // Whether the mouse is over this label.
236 bool contains_mouse_; 241 bool contains_mouse_;
237 scoped_ptr<Background> mouse_over_background_; 242 scoped_ptr<Background> mouse_over_background_;
238 // Whether to collapse the label when it's not visible. 243 // Whether to collapse the label when it's not visible.
239 bool collapse_when_hidden_; 244 bool collapse_when_hidden_;
240 // The following member variable is used to control whether the alignment 245 // The following member variable is used to control whether the alignment
241 // needs to be flipped around for RTL locales. Please refer to the definition 246 // needs to be flipped around for RTL locales. Please refer to the definition
242 // of RTLAlignmentMode for more information. 247 // of RTLAlignmentMode for more information.
243 RTLAlignmentMode rtl_alignment_mode_; 248 RTLAlignmentMode rtl_alignment_mode_;
244 // When embedded in a larger control that is focusable, setting this flag 249 // When embedded in a larger control that is focusable, setting this flag
245 // allows this view to be painted as focused even when it is itself not. 250 // allows this view to be painted as focused even when it is itself not.
246 bool paint_as_focused_; 251 bool paint_as_focused_;
247 // When embedded in a larger control that is focusable, setting this flag 252 // 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 253 // allows this view to reserve space for a focus border that it otherwise
249 // might not have because it is not itself focusable. 254 // might not have because it is not itself focusable.
250 bool has_focus_border_; 255 bool has_focus_border_;
251 256
252 DISALLOW_COPY_AND_ASSIGN(Label); 257 DISALLOW_COPY_AND_ASSIGN(Label);
253 }; 258 };
254 259
255 } // namespace views 260 } // namespace views
256 261
257 #endif // CHROME_VIEWS_CONTROLS_LABEL_H_ 262 #endif // CHROME_VIEWS_CONTROLS_LABEL_H_
OLDNEW
« no previous file with comments | « chrome/common/gfx/chrome_canvas_win.cc ('k') | chrome/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698