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

Side by Side Diff: ui/views/widget/tooltip_manager_win.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 | « ui/views/widget/tooltip_manager_aura.cc ('k') | ui/views/widget/widget.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/views/widget/tooltip_manager_win.h" 5 #include "ui/views/widget/tooltip_manager_win.h"
6 6
7 #include <windowsx.h> 7 #include <windowsx.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 gfx::Font TooltipManager::GetDefaultFont() { 54 gfx::Font TooltipManager::GetDefaultFont() {
55 static gfx::Font* font = NULL; 55 static gfx::Font* font = NULL;
56 if (!font) 56 if (!font)
57 font = new gfx::Font(DetermineDefaultFont()); 57 font = new gfx::Font(DetermineDefaultFont());
58 return *font; 58 return *font;
59 } 59 }
60 60
61 // static 61 // static
62 int TooltipManager::GetMaxWidth(int x, int y) { 62 int TooltipManager::GetMaxWidth(int x, int y) {
63 gfx::Rect monitor_bounds = 63 gfx::Rect monitor_bounds =
64 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); 64 gfx::Screen::GetMonitorNearestPoint(gfx::Point(x, y)).bounds();
65 // Allow the tooltip to be almost as wide as the screen. 65 // Allow the tooltip to be almost as wide as the screen.
66 // Otherwise, we would truncate important text, since we're not word-wrapping 66 // Otherwise, we would truncate important text, since we're not word-wrapping
67 // the text onto multiple lines. 67 // the text onto multiple lines.
68 return monitor_bounds.width() == 0 ? 800 : monitor_bounds.width() - 30; 68 return monitor_bounds.width() == 0 ? 800 : monitor_bounds.width() - 30;
69 } 69 }
70 70
71 TooltipManagerWin::TooltipManagerWin(Widget* widget) 71 TooltipManagerWin::TooltipManagerWin(Widget* widget)
72 : widget_(widget), 72 : widget_(widget),
73 tooltip_hwnd_(NULL), 73 tooltip_hwnd_(NULL),
74 last_mouse_pos_(-1, -1), 74 last_mouse_pos_(-1, -1),
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 keyboard_tooltip_hwnd_ = NULL; 381 keyboard_tooltip_hwnd_ = NULL;
382 } 382 }
383 } 383 }
384 384
385 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { 385 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) {
386 if (keyboard_tooltip_hwnd_ == window_to_destroy) 386 if (keyboard_tooltip_hwnd_ == window_to_destroy)
387 HideKeyboardTooltip(); 387 HideKeyboardTooltip();
388 } 388 }
389 389
390 } // namespace views 390 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/tooltip_manager_aura.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698