| Index: ui/views/controls/styled_label.h
|
| diff --git a/ui/views/controls/styled_label.h b/ui/views/controls/styled_label.h
|
| index ee0780e494d44cf08a7ed05b03bdd1f1f09a721b..d5a7895110460afbe63e16f57d43b79fb9379dab 100644
|
| --- a/ui/views/controls/styled_label.h
|
| +++ b/ui/views/controls/styled_label.h
|
| @@ -73,6 +73,11 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener {
|
| // |range| must be contained in |text_|.
|
| void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info);
|
|
|
| + // Inserts a |view| into the given |position| within |text_|. |position| must
|
| + // be contained in |text_|. Takes ownership of |view| (which should not
|
| + // already be parented within the views hierarchy).
|
| + void AddEmbeddedView(uint32_t position, scoped_ptr<View> view);
|
| +
|
| // Sets the default style to use for any part of the text that isn't within
|
| // a range set by AddStyleRange.
|
| void SetDefaultStyle(const RangeStyleInfo& style_info);
|
| @@ -116,16 +121,18 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener {
|
| private:
|
| struct StyleRange {
|
| StyleRange(const gfx::Range& range,
|
| - const RangeStyleInfo& style_info)
|
| - : range(range),
|
| - style_info(style_info) {
|
| - }
|
| + const RangeStyleInfo& style_info,
|
| + View* embedded_view)
|
| + : range(range), style_info(style_info), embedded_view(embedded_view) {}
|
| ~StyleRange() {}
|
|
|
| bool operator<(const StyleRange& other) const;
|
|
|
| gfx::Range range;
|
| RangeStyleInfo style_info;
|
| + // Pointer to an element of |embedded_views_|. Can be null. If non-null, the
|
| + // text range is replaced by the embedded view and |style_info| is ignored.
|
| + View* embedded_view;
|
| };
|
| typedef std::list<StyleRange> StyleRanges;
|
|
|
| @@ -159,6 +166,10 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener {
|
| // that correspond to ranges with is_link style set will be added to the map.
|
| std::map<View*, gfx::Range> link_targets_;
|
|
|
| + // List of views embedded within the label. These views have owned_by_client
|
| + // set so get deleted by the scoped_ptr destructor (not the views hierarchy).
|
| + std::vector<scoped_ptr<View>> embedded_views_;
|
| +
|
| // This variable saves the result of the last GetHeightForWidth call in order
|
| // to avoid repeated calculation.
|
| mutable gfx::Size calculated_size_;
|
|
|