Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/browser_titlebar.h" | 5 #include "chrome/browser/gtk/browser_titlebar.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 // margin of FrameBorderThickness + kClientEdgeThickness. This offset is to | 76 // margin of FrameBorderThickness + kClientEdgeThickness. This offset is to |
| 77 // account for kClientEdgeThickness. | 77 // account for kClientEdgeThickness. |
| 78 const int kTabStripLeftPadding = 1; | 78 const int kTabStripLeftPadding = 1; |
| 79 | 79 |
| 80 // Spacing between buttons of the titlebar. | 80 // Spacing between buttons of the titlebar. |
| 81 const int kButtonSpacing = 2; | 81 const int kButtonSpacing = 2; |
| 82 | 82 |
| 83 // Spacing around outside of titlebar buttons. | 83 // Spacing around outside of titlebar buttons. |
| 84 const int kButtonOuterPadding = 2; | 84 const int kButtonOuterPadding = 2; |
| 85 | 85 |
| 86 // Spacing between tabstrip and window control buttons (when the window is | |
| 87 // maximized). | |
| 88 const int kMaximizedTabstripPadding = 16; | |
| 89 | |
| 86 gboolean OnMouseMoveEvent(GtkWidget* widget, GdkEventMotion* event, | 90 gboolean OnMouseMoveEvent(GtkWidget* widget, GdkEventMotion* event, |
| 87 BrowserWindowGtk* browser_window) { | 91 BrowserWindowGtk* browser_window) { |
| 88 // Reset to the default mouse cursor. | 92 // Reset to the default mouse cursor. |
| 89 browser_window->ResetCustomFrameCursor(); | 93 browser_window->ResetCustomFrameCursor(); |
| 90 return TRUE; | 94 return TRUE; |
| 91 } | 95 } |
| 92 | 96 |
| 93 GdkPixbuf* GetOTRAvatar() { | 97 GdkPixbuf* GetOTRAvatar() { |
| 94 static GdkPixbuf* otr_avatar = NULL; | 98 static GdkPixbuf* otr_avatar = NULL; |
| 95 if (!otr_avatar) { | 99 if (!otr_avatar) { |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 475 } else { | 479 } else { |
| 476 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), | 480 gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), |
| 477 rb.GetPixbufNamed(IDR_PRODUCT_LOGO_16)); | 481 rb.GetPixbufNamed(IDR_PRODUCT_LOGO_16)); |
| 478 } | 482 } |
| 479 throbber_.Reset(); | 483 throbber_.Reset(); |
| 480 } | 484 } |
| 481 } | 485 } |
| 482 | 486 |
| 483 void BrowserTitlebar::UpdateTitlebarAlignment() { | 487 void BrowserTitlebar::UpdateTitlebarAlignment() { |
| 484 if (browser_window_->browser()->type() == Browser::TYPE_NORMAL) { | 488 if (browser_window_->browser()->type() == Browser::TYPE_NORMAL) { |
| 485 if (using_custom_frame_ && !browser_window_->IsMaximized()) { | 489 int top_padding = 0; |
| 486 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_alignment_), | 490 int side_padding = 0; |
| 487 kTitlebarHeight, 0, kTabStripLeftPadding, 0); | 491 int vertical_offset = kNormalVerticalOffset; |
| 488 } else { | 492 |
| 489 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_alignment_), 0, 0, | 493 if (using_custom_frame_) { |
| 490 kTabStripLeftPadding, 0); | 494 if (!browser_window_->IsMaximized()) { |
| 495 top_padding = kTitlebarHeight; | |
| 496 } else if (using_custom_frame_ && browser_window_->IsMaximized()) { | |
| 497 vertical_offset = 0; | |
| 498 side_padding = kMaximizedTabstripPadding; | |
| 499 } | |
| 491 } | 500 } |
| 492 | 501 |
| 493 if (using_custom_frame_) { | 502 int right_padding = 0; |
| 494 browser_window_->tabstrip()->SetVerticalOffset( | 503 int left_padding = kTabStripLeftPadding; |
| 495 browser_window_->IsMaximized() ? 0 : kNormalVerticalOffset); | 504 if (titlebar_right_buttons_hbox_) |
| 496 } else { | 505 right_padding = side_padding; |
| 497 browser_window_->tabstrip()->SetVerticalOffset(kNormalVerticalOffset); | 506 if (titlebar_left_buttons_hbox_) |
| 498 } | 507 left_padding = side_padding; |
|
tony
2010/07/01 05:04:13
Heh, I bet this looks kind of weird with buttons o
| |
| 508 | |
| 509 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_alignment_), | |
| 510 top_padding, 0, | |
| 511 left_padding, right_padding); | |
| 512 browser_window_->tabstrip()->SetVerticalOffset(vertical_offset); | |
| 499 } else { | 513 } else { |
| 500 if (using_custom_frame_ && !browser_window_->IsFullscreen()) { | 514 if (using_custom_frame_ && !browser_window_->IsFullscreen()) { |
| 501 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_alignment_), | 515 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_alignment_), |
| 502 kAppModePaddingTop, kAppModePaddingBottom, kAppModePaddingLeft, 0); | 516 kAppModePaddingTop, kAppModePaddingBottom, kAppModePaddingLeft, 0); |
| 503 gtk_widget_show(titlebar_alignment_); | 517 gtk_widget_show(titlebar_alignment_); |
| 504 } else { | 518 } else { |
| 505 gtk_widget_hide(titlebar_alignment_); | 519 gtk_widget_hide(titlebar_alignment_); |
| 506 } | 520 } |
| 507 } | 521 } |
| 508 | 522 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 815 menus::SimpleMenuModel::Delegate* delegate) | 829 menus::SimpleMenuModel::Delegate* delegate) |
| 816 : SimpleMenuModel(delegate) { | 830 : SimpleMenuModel(delegate) { |
| 817 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 831 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
| 818 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 832 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
| 819 AddSeparator(); | 833 AddSeparator(); |
| 820 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 834 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
| 821 AddSeparator(); | 835 AddSeparator(); |
| 822 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 836 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
| 823 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 837 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
| 824 } | 838 } |
| OLD | NEW |