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

Side by Side Diff: chrome/views/tooltip_manager.cc

Issue 13235: Cleanup adding BoundsInWidget to View to convert callers... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <limits> 5 #include <limits>
6 6
7 #include "chrome/common/gfx/chrome_font.h" 7 #include "chrome/common/gfx/chrome_font.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/common/l10n_util.h" 10 #include "chrome/common/l10n_util.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 SendMessage(tooltip_hwnd_, TTM_POP, 0, 0); 377 SendMessage(tooltip_hwnd_, TTM_POP, 0, 0);
378 tooltip_text_.clear(); 378 tooltip_text_.clear();
379 } 379 }
380 HideKeyboardTooltip(); 380 HideKeyboardTooltip();
381 std::wstring tooltip_text; 381 std::wstring tooltip_text;
382 if (!focused_view->GetTooltipText(0, 0, &tooltip_text)) 382 if (!focused_view->GetTooltipText(0, 0, &tooltip_text))
383 return; 383 return;
384 gfx::Rect focused_bounds = focused_view->bounds(); 384 gfx::Rect focused_bounds = focused_view->bounds();
385 gfx::Point screen_point; 385 gfx::Point screen_point;
386 focused_view->ConvertPointToScreen(focused_view, &screen_point); 386 focused_view->ConvertPointToScreen(focused_view, &screen_point);
387 gfx::Point relative_point_coordinates; 387 gfx::Rect widget_bounds = focused_view->BoundsInWidget();
388 focused_view->ConvertPointToWidget(focused_view, &relative_point_coordinates);
389 keyboard_tooltip_hwnd_ = CreateWindowEx( 388 keyboard_tooltip_hwnd_ = CreateWindowEx(
390 WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(), 389 WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
391 TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); 390 TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
392 SendMessage(keyboard_tooltip_hwnd_, TTM_SETMAXTIPWIDTH, 0, 391 SendMessage(keyboard_tooltip_hwnd_, TTM_SETMAXTIPWIDTH, 0,
393 std::numeric_limits<short>::max()); 392 std::numeric_limits<short>::max());
394 int tooltip_width; 393 int tooltip_width;
395 int line_count; 394 int line_count;
396 TrimTooltipToFit(&tooltip_text, &tooltip_width, &line_count, 395 TrimTooltipToFit(&tooltip_text, &tooltip_width, &line_count,
397 relative_point_coordinates.x(), 396 widget_bounds.x(),
398 relative_point_coordinates.y(), keyboard_tooltip_hwnd_); 397 widget_bounds.y(), keyboard_tooltip_hwnd_);
399 TOOLINFO keyboard_toolinfo; 398 TOOLINFO keyboard_toolinfo;
400 memset(&keyboard_toolinfo, 0, sizeof(keyboard_toolinfo)); 399 memset(&keyboard_toolinfo, 0, sizeof(keyboard_toolinfo));
401 keyboard_toolinfo.cbSize = sizeof(keyboard_toolinfo); 400 keyboard_toolinfo.cbSize = sizeof(keyboard_toolinfo);
402 keyboard_toolinfo.hwnd = parent_; 401 keyboard_toolinfo.hwnd = parent_;
403 keyboard_toolinfo.uFlags = TTF_TRACK | TTF_TRANSPARENT | TTF_IDISHWND ; 402 keyboard_toolinfo.uFlags = TTF_TRACK | TTF_TRANSPARENT | TTF_IDISHWND ;
404 keyboard_toolinfo.lpszText = const_cast<WCHAR*>(tooltip_text.c_str()); 403 keyboard_toolinfo.lpszText = const_cast<WCHAR*>(tooltip_text.c_str());
405 SendMessage(keyboard_tooltip_hwnd_, TTM_ADDTOOL, 0, 404 SendMessage(keyboard_tooltip_hwnd_, TTM_ADDTOOL, 0,
406 reinterpret_cast<LPARAM>(&keyboard_toolinfo)); 405 reinterpret_cast<LPARAM>(&keyboard_toolinfo));
407 SendMessage(keyboard_tooltip_hwnd_, TTM_TRACKACTIVATE, TRUE, 406 SendMessage(keyboard_tooltip_hwnd_, TTM_TRACKACTIVATE, TRUE,
408 reinterpret_cast<LPARAM>(&keyboard_toolinfo)); 407 reinterpret_cast<LPARAM>(&keyboard_toolinfo));
(...skipping 22 matching lines...) Expand all
431 keyboard_tooltip_hwnd_ = NULL; 430 keyboard_tooltip_hwnd_ = NULL;
432 } 431 }
433 } 432 }
434 433
435 void TooltipManager::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { 434 void TooltipManager::DestroyKeyboardTooltipWindow(HWND window_to_destroy) {
436 if (keyboard_tooltip_hwnd_ == window_to_destroy) 435 if (keyboard_tooltip_hwnd_ == window_to_destroy)
437 HideKeyboardTooltip(); 436 HideKeyboardTooltip();
438 } 437 }
439 438
440 } // namespace views 439 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/hwnd_view.cc ('k') | chrome/views/view.h » ('j') | chrome/views/view.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698