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

Side by Side Diff: ui/views/corewm/tooltip_win.cc

Issue 1915363002: Rename gfx::Display/Screen to display::Display/Screen in views/wm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanups Created 4 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
« no previous file with comments | « ui/views/corewm/tooltip_controller_unittest.cc ('k') | ui/views/drag_utils.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/corewm/tooltip_win.h" 5 #include "ui/views/corewm/tooltip_win.h"
6 6
7 #include <winuser.h> 7 #include <winuser.h>
8 8
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "ui/base/l10n/l10n_util_win.h" 12 #include "ui/base/l10n/l10n_util_win.h"
13 #include "ui/display/display.h"
14 #include "ui/display/screen.h"
13 #include "ui/display/win/screen_win.h" 15 #include "ui/display/win/screen_win.h"
14 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/screen.h"
16 #include "ui/views/corewm/cursor_height_provider_win.h" 17 #include "ui/views/corewm/cursor_height_provider_win.h"
17 18
18 namespace views { 19 namespace views {
19 namespace corewm { 20 namespace corewm {
20 21
21 TooltipWin::TooltipWin(HWND parent) 22 TooltipWin::TooltipWin(HWND parent)
22 : parent_hwnd_(parent), 23 : parent_hwnd_(parent),
23 tooltip_hwnd_(NULL), 24 tooltip_hwnd_(NULL),
24 showing_(false) { 25 showing_(false) {
25 memset(&toolinfo_, 0, sizeof(toolinfo_)); 26 memset(&toolinfo_, 0, sizeof(toolinfo_));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void TooltipWin::PositionTooltip() { 80 void TooltipWin::PositionTooltip() {
80 gfx::Point screen_point = 81 gfx::Point screen_point =
81 display::win::ScreenWin::DIPToScreenPoint(location_); 82 display::win::ScreenWin::DIPToScreenPoint(location_);
82 const int cursoroffset = GetCurrentCursorVisibleHeight(); 83 const int cursoroffset = GetCurrentCursorVisibleHeight();
83 screen_point.Offset(0, cursoroffset); 84 screen_point.Offset(0, cursoroffset);
84 85
85 DWORD tooltip_size = SendMessage(tooltip_hwnd_, TTM_GETBUBBLESIZE, 0, 86 DWORD tooltip_size = SendMessage(tooltip_hwnd_, TTM_GETBUBBLESIZE, 0,
86 reinterpret_cast<LPARAM>(&toolinfo_)); 87 reinterpret_cast<LPARAM>(&toolinfo_));
87 const gfx::Size size(LOWORD(tooltip_size), HIWORD(tooltip_size)); 88 const gfx::Size size(LOWORD(tooltip_size), HIWORD(tooltip_size));
88 89
89 const gfx::Display display( 90 const display::Display display(
90 gfx::Screen::GetScreen()->GetDisplayNearestPoint(location_)); 91 display::Screen::GetScreen()->GetDisplayNearestPoint(location_));
91 92
92 gfx::Rect tooltip_bounds(screen_point, size); 93 gfx::Rect tooltip_bounds(screen_point, size);
93 tooltip_bounds.AdjustToFit( 94 tooltip_bounds.AdjustToFit(
94 display::win::ScreenWin::DIPToScreenRect(parent_hwnd_, 95 display::win::ScreenWin::DIPToScreenRect(parent_hwnd_,
95 display.work_area())); 96 display.work_area()));
96 SetWindowPos(tooltip_hwnd_, NULL, tooltip_bounds.x(), tooltip_bounds.y(), 0, 97 SetWindowPos(tooltip_hwnd_, NULL, tooltip_bounds.x(), tooltip_bounds.y(), 0,
97 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 98 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
98 } 99 }
99 100
100 int TooltipWin::GetMaxWidth(const gfx::Point& location) const { 101 int TooltipWin::GetMaxWidth(const gfx::Point& location) const {
101 const gfx::Point screen_point = 102 const gfx::Point screen_point =
102 display::win::ScreenWin::DIPToScreenPoint(location); 103 display::win::ScreenWin::DIPToScreenPoint(location);
103 gfx::Display display( 104 display::Display display(
104 gfx::Screen::GetScreen()->GetDisplayNearestPoint(screen_point)); 105 display::Screen::GetScreen()->GetDisplayNearestPoint(screen_point));
105 const gfx::Rect monitor_bounds = display.bounds(); 106 const gfx::Rect monitor_bounds = display.bounds();
106 return (monitor_bounds.width() + 1) / 2; 107 return (monitor_bounds.width() + 1) / 2;
107 } 108 }
108 109
109 void TooltipWin::SetText(aura::Window* window, 110 void TooltipWin::SetText(aura::Window* window,
110 const base::string16& tooltip_text, 111 const base::string16& tooltip_text,
111 const gfx::Point& location) { 112 const gfx::Point& location) {
112 if (!EnsureTooltipWindow()) 113 if (!EnsureTooltipWindow())
113 return; 114 return;
114 115
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 SendMessage(tooltip_hwnd_, TTM_TRACKACTIVATE, FALSE, 149 SendMessage(tooltip_hwnd_, TTM_TRACKACTIVATE, FALSE,
149 reinterpret_cast<LPARAM>(&toolinfo_)); 150 reinterpret_cast<LPARAM>(&toolinfo_));
150 } 151 }
151 152
152 bool TooltipWin::IsVisible() { 153 bool TooltipWin::IsVisible() {
153 return showing_; 154 return showing_;
154 } 155 }
155 156
156 } // namespace corewm 157 } // namespace corewm
157 } // namespace views 158 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/tooltip_controller_unittest.cc ('k') | ui/views/drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698