| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 gtk_widget_show(titlebar_left_spy_frame_); | 461 gtk_widget_show(titlebar_left_spy_frame_); |
| 462 gtk_widget_hide(titlebar_right_spy_frame_); | 462 gtk_widget_hide(titlebar_right_spy_frame_); |
| 463 } else { | 463 } else { |
| 464 gtk_container_add(GTK_CONTAINER(titlebar_right_spy_frame_), spy_guy); | 464 gtk_container_add(GTK_CONTAINER(titlebar_right_spy_frame_), spy_guy); |
| 465 gtk_widget_show(titlebar_right_spy_frame_); | 465 gtk_widget_show(titlebar_right_spy_frame_); |
| 466 gtk_widget_hide(titlebar_left_spy_frame_); | 466 gtk_widget_hide(titlebar_left_spy_frame_); |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 // Now show the correct widgets in the two hierarchies. | 470 // Now show the correct widgets in the two hierarchies. |
| 471 gtk_widget_show_all(titlebar_left_buttons_vbox_); | 471 if (using_custom_frame_) { |
| 472 gtk_widget_show_all(titlebar_right_buttons_vbox_); | 472 gtk_widget_show_all(titlebar_left_buttons_vbox_); |
| 473 gtk_widget_show_all(titlebar_right_buttons_vbox_); |
| 474 } |
| 473 UpdateMaximizeRestoreVisibility(); | 475 UpdateMaximizeRestoreVisibility(); |
| 474 } | 476 } |
| 475 | 477 |
| 476 GtkWidget* BrowserTitlebar::GetButtonHBox(bool left_side) { | 478 GtkWidget* BrowserTitlebar::GetButtonHBox(bool left_side) { |
| 477 if (left_side && titlebar_left_buttons_hbox_) | 479 if (left_side && titlebar_left_buttons_hbox_) |
| 478 return titlebar_left_buttons_hbox_; | 480 return titlebar_left_buttons_hbox_; |
| 479 else if (!left_side && titlebar_right_buttons_hbox_) | 481 else if (!left_side && titlebar_right_buttons_hbox_) |
| 480 return titlebar_right_buttons_hbox_; | 482 return titlebar_right_buttons_hbox_; |
| 481 | 483 |
| 482 // We put the min/max/restore/close buttons in a vbox so they are top aligned | 484 // We put the min/max/restore/close buttons in a vbox so they are top aligned |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 gtk_widget_set_tooltip_text(button->widget(), | 517 gtk_widget_set_tooltip_text(button->widget(), |
| 516 localized_tooltip.c_str()); | 518 localized_tooltip.c_str()); |
| 517 gtk_box_pack_start(GTK_BOX(box), button->widget(), FALSE, FALSE, 0); | 519 gtk_box_pack_start(GTK_BOX(box), button->widget(), FALSE, FALSE, 0); |
| 518 return button; | 520 return button; |
| 519 } | 521 } |
| 520 | 522 |
| 521 void BrowserTitlebar::UpdateCustomFrame(bool use_custom_frame) { | 523 void BrowserTitlebar::UpdateCustomFrame(bool use_custom_frame) { |
| 522 using_custom_frame_ = use_custom_frame; | 524 using_custom_frame_ = use_custom_frame; |
| 523 if (use_custom_frame) { | 525 if (use_custom_frame) { |
| 524 if (titlebar_left_buttons_vbox_) | 526 if (titlebar_left_buttons_vbox_) |
| 525 gtk_widget_show(titlebar_left_buttons_vbox_); | 527 gtk_widget_show_all(titlebar_left_buttons_vbox_); |
| 526 if (titlebar_right_buttons_vbox_) | 528 if (titlebar_right_buttons_vbox_) |
| 527 gtk_widget_show(titlebar_right_buttons_vbox_); | 529 gtk_widget_show_all(titlebar_right_buttons_vbox_); |
| 528 } else { | 530 } else { |
| 529 if (titlebar_left_buttons_vbox_) | 531 if (titlebar_left_buttons_vbox_) |
| 530 gtk_widget_hide(titlebar_left_buttons_vbox_); | 532 gtk_widget_hide(titlebar_left_buttons_vbox_); |
| 531 if (titlebar_right_buttons_vbox_) | 533 if (titlebar_right_buttons_vbox_) |
| 532 gtk_widget_hide(titlebar_right_buttons_vbox_); | 534 gtk_widget_hide(titlebar_right_buttons_vbox_); |
| 533 } | 535 } |
| 534 UpdateTitlebarAlignment(); | 536 UpdateTitlebarAlignment(); |
| 535 } | 537 } |
| 536 | 538 |
| 537 void BrowserTitlebar::UpdateTitleAndIcon() { | 539 void BrowserTitlebar::UpdateTitleAndIcon() { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 menus::SimpleMenuModel::Delegate* delegate) | 939 menus::SimpleMenuModel::Delegate* delegate) |
| 938 : SimpleMenuModel(delegate) { | 940 : SimpleMenuModel(delegate) { |
| 939 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 941 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
| 940 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 942 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
| 941 AddSeparator(); | 943 AddSeparator(); |
| 942 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 944 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
| 943 AddSeparator(); | 945 AddSeparator(); |
| 944 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 946 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
| 945 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 947 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
| 946 } | 948 } |
| OLD | NEW |