Index: ui/views/controls/styled_label.h |
=================================================================== |
--- ui/views/controls/styled_label.h (revision 239550) |
+++ ui/views/controls/styled_label.h (working copy) |
@@ -5,8 +5,8 @@ |
#ifndef UI_VIEWS_CONTROLS_STYLED_LABEL_H_ |
#define UI_VIEWS_CONTROLS_STYLED_LABEL_H_ |
+#include <list> |
#include <map> |
-#include <queue> |
#include "base/basictypes.h" |
#include "base/strings/string16.h" |
@@ -85,6 +85,9 @@ |
virtual int GetHeightForWidth(int w) OVERRIDE; |
virtual void Layout() OVERRIDE; |
virtual void PreferredSizeChanged() OVERRIDE; |
+ virtual void ViewHierarchyChanged( |
+ const ViewHierarchyChangedDetails& details) OVERRIDE; |
+ virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; |
// LinkListener implementation: |
virtual void LinkClicked(Link* source, int event_flags) OVERRIDE; |
@@ -103,12 +106,13 @@ |
gfx::Range range; |
RangeStyleInfo style_info; |
}; |
+ typedef std::list<StyleRange> StyleRanges; |
// Calculates how to layout child views, creates them and sets their size |
// and position. |width| is the horizontal space, in pixels, that the view |
// has to work with. If |dry_run| is true, the view hierarchy is not touched. |
- // The return value is the height in pixels. |
- int CalculateAndDoLayout(int width, bool dry_run); |
+ // The return value is the necessary size. |
+ gfx::Size CalculateAndDoLayout(int width, bool dry_run); |
// The text to display. |
string16 text_; |
@@ -121,7 +125,7 @@ |
StyledLabelListener* listener_; |
// The ranges that should be linkified, sorted by start position. |
- std::priority_queue<StyleRange> style_ranges_; |
+ StyleRanges style_ranges_; |
// A mapping from a view to the range it corresponds to in |text_|. Only views |
// that correspond to ranges with is_link style set will be added to the map. |
@@ -131,6 +135,10 @@ |
// to avoid repeated calculation. |
gfx::Size calculated_size_; |
+ // Saves the most recent value of IsDrawn() as of the last call to |
+ // GetInsets(), since if this changes, we may need to recalulate our size. |
+ mutable bool is_drawn_; |
+ |
// Background color on which the label is drawn, for auto color readability. |
SkColor displayed_on_background_color_; |
bool displayed_on_background_color_set_; |