OLD | NEW |
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 "chrome/browser/views/bookmark_table_view.h" | 5 #include "chrome/browser/views/bookmark_table_view.h" |
6 | 6 |
7 #include <commctrl.h> | 7 #include <commctrl.h> |
8 | 8 |
9 #include "app/drag_drop_types.h" | 9 #include "app/drag_drop_types.h" |
10 #include "app/gfx/chrome_canvas.h" | 10 #include "app/gfx/chrome_canvas.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 for (size_t i = 0; i < columns.size(); ++i) | 411 for (size_t i = 0; i < columns.size(); ++i) |
412 SetColumnVisibility(columns[i].id, true); | 412 SetColumnVisibility(columns[i].id, true); |
413 OnModelChanged(); | 413 OnModelChanged(); |
414 } | 414 } |
415 | 415 |
416 void BookmarkTableView::PaintAltText() { | 416 void BookmarkTableView::PaintAltText() { |
417 if (alt_text_.empty()) | 417 if (alt_text_.empty()) |
418 return; | 418 return; |
419 | 419 |
420 HDC dc = GetDC(GetNativeControlHWND()); | 420 HDC dc = GetDC(GetNativeControlHWND()); |
421 ChromeFont font = GetAltTextFont(); | 421 gfx::Font font = GetAltTextFont(); |
422 gfx::Rect bounds = GetAltTextBounds(); | 422 gfx::Rect bounds = GetAltTextBounds(); |
423 ChromeCanvas canvas(bounds.width(), bounds.height(), false); | 423 ChromeCanvas canvas(bounds.width(), bounds.height(), false); |
424 // Pad by 1 for halo. | 424 // Pad by 1 for halo. |
425 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, | 425 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, |
426 1, bounds.width() - 2, bounds.height() - 2, | 426 1, bounds.width() - 2, bounds.height() - 2, |
427 l10n_util::DefaultCanvasTextAlignment()); | 427 l10n_util::DefaultCanvasTextAlignment()); |
428 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); | 428 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); |
429 ReleaseDC(GetNativeControlHWND(), dc); | 429 ReleaseDC(GetNativeControlHWND(), dc); |
430 } | 430 } |
431 | 431 |
432 gfx::Rect BookmarkTableView::GetAltTextBounds() { | 432 gfx::Rect BookmarkTableView::GetAltTextBounds() { |
433 static const int kXOffset = 16; | 433 static const int kXOffset = 16; |
434 DCHECK(GetNativeControlHWND()); | 434 DCHECK(GetNativeControlHWND()); |
435 RECT client_rect_rect; | 435 RECT client_rect_rect; |
436 GetClientRect(GetNativeControlHWND(), &client_rect_rect); | 436 GetClientRect(GetNativeControlHWND(), &client_rect_rect); |
437 gfx::Rect client_rect(client_rect_rect); | 437 gfx::Rect client_rect(client_rect_rect); |
438 ChromeFont font = GetAltTextFont(); | 438 gfx::Font font = GetAltTextFont(); |
439 // Pad height by 2 for halo. | 439 // Pad height by 2 for halo. |
440 return gfx::Rect(kXOffset, content_offset(), client_rect.width() - kXOffset, | 440 return gfx::Rect(kXOffset, content_offset(), client_rect.width() - kXOffset, |
441 std::max(kImageSize, font.height() + 2)); | 441 std::max(kImageSize, font.height() + 2)); |
442 } | 442 } |
443 | 443 |
444 ChromeFont BookmarkTableView::GetAltTextFont() { | 444 gfx::Font BookmarkTableView::GetAltTextFont() { |
445 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); | 445 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); |
446 } | 446 } |
OLD | NEW |