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

Unified Diff: ui/views/corewm/tooltip_aura.h

Issue 340543004: views: Support longer tooltips. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more simplification Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/corewm/tooltip_aura.cc » ('j') | ui/views/corewm/tooltip_aura.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/tooltip_aura.h
diff --git a/ui/views/corewm/tooltip_aura.h b/ui/views/corewm/tooltip_aura.h
index ead119f5d95889c4a1e2e5fc1a5f72f4d807ef4c..5ac7c5091a10ec974e70783c5c28f5f38efa5472 100644
--- a/ui/views/corewm/tooltip_aura.h
+++ b/ui/views/corewm/tooltip_aura.h
@@ -23,28 +23,32 @@ namespace corewm {
// Implementation of Tooltip that shows the tooltip using a Widget and Label.
class VIEWS_EXPORT TooltipAura : public Tooltip, public WidgetObserver {
public:
+ // Preferred maximum tooltip width, in pixels. If a tooltip's text is wider
+ // than this width, it will be wrapped (unless doing so would truncate words
+ // in the text).
+ static const int kPreferredWidthPixels;
+
explicit TooltipAura(gfx::ScreenType screen_type);
virtual ~TooltipAura();
- // Trims the tooltip to fit in the width |max_width|, setting |text| to the
- // clipped result, |width| to the width (in pixels) of the clipped text
- // and |line_count| to the number of lines of text in the tooltip. |font_list|
- // is used to layout |text|. |max_width| comes from GetMaxWidth().
+ // Trims |text| to fit in |max_size|, setting |text| to the clipped result,
+ // |width| to the width (in pixels) of the clipped text and |line_count| to
+ // the number of lines of text in the tooltip. |font_list| is used to layout
+ // |text|. |max_size| comes from GetMaxSize().
static void TrimTooltipToFit(const gfx::FontList& font_list,
- int max_width,
+ const gfx::Size& max_size,
base::string16* text,
int* width,
int* line_count);
private:
- // Returns the max width of the tooltip when shown at the specified location.
- int GetMaxWidth(const gfx::Point& location) const;
+ // Returns the max size of the tooltip when shown at the specified location.
+ gfx::Size GetMaxSize(const gfx::Point& location) const;
// Adjusts the bounds given by the arguments to fit inside the desktop
- // and applies the adjusted bounds to the label_.
+ // and applies the adjusted bounds to |label_|.
void SetTooltipBounds(const gfx::Point& mouse_pos,
- int tooltip_width,
- int tooltip_height);
+ const gfx::Size& tooltip_size);
// Destroys |widget_|.
void DestroyWidget();
« no previous file with comments | « no previous file | ui/views/corewm/tooltip_aura.cc » ('j') | ui/views/corewm/tooltip_aura.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698