| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/panels/panel_browser_titlebar_gtk.h" | 5 #include "chrome/browser/ui/panels/panel_browser_titlebar_gtk.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/gtk/custom_button.h" | 9 #include "chrome/browser/ui/gtk/custom_button.h" |
| 10 #include "chrome/browser/ui/gtk/gtk_util.h" | 10 #include "chrome/browser/ui/gtk/gtk_util.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 g_free(escaped_title); | 90 g_free(escaped_title); |
| 91 g_free(title_with_markup); | 91 g_free(title_with_markup); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool PanelBrowserTitlebarGtk::BuildButton(const std::string& button_token, | 94 bool PanelBrowserTitlebarGtk::BuildButton(const std::string& button_token, |
| 95 bool left_side) { | 95 bool left_side) { |
| 96 // Panel only shows close and minimize/restore buttons. | 96 // Panel only shows close and minimize/restore buttons. |
| 97 if (button_token != "close" && button_token != "minimize") | 97 if (button_token != "close" && button_token != "minimize") |
| 98 return false; | 98 return false; |
| 99 | 99 |
| 100 // Create unminimze button in order to show it to expand the minimized panel. | 100 if (!BrowserTitlebar::BuildButton(button_token, left_side)) |
| 101 if (button_token == "minimize") | 101 return false; |
| 102 |
| 103 if (button_token == "minimize") { |
| 104 // Create unminimze button, used to expand the minimized panel. |
| 102 unminimize_button_.reset(CreateTitlebarButton("unminimize", left_side)); | 105 unminimize_button_.reset(CreateTitlebarButton("unminimize", left_side)); |
| 103 | 106 |
| 104 return BrowserTitlebar::BuildButton(button_token, left_side); | 107 // We control visibility of minimize and unminimize buttons. |
| 108 gtk_widget_set_no_show_all(minimize_button()->widget(), TRUE); |
| 109 gtk_widget_set_no_show_all(unminimize_button_->widget(), TRUE); |
| 110 } |
| 111 return true; |
| 105 } | 112 } |
| 106 | 113 |
| 107 void PanelBrowserTitlebarGtk::GetButtonResources(const std::string& button_name, | 114 void PanelBrowserTitlebarGtk::GetButtonResources(const std::string& button_name, |
| 108 int* normal_image_id, | 115 int* normal_image_id, |
| 109 int* pressed_image_id, | 116 int* pressed_image_id, |
| 110 int* hover_image_id, | 117 int* hover_image_id, |
| 111 int* tooltip_id) const { | 118 int* tooltip_id) const { |
| 112 if (button_name == "close") { | 119 if (button_name == "close") { |
| 113 *normal_image_id = IDR_PANEL_CLOSE; | 120 *normal_image_id = IDR_PANEL_CLOSE; |
| 114 *pressed_image_id = 0; | 121 *pressed_image_id = 0; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 event->crossing.y_root = widget_allocation.y; | 218 event->crossing.y_root = widget_allocation.y; |
| 212 event->crossing.mode = GDK_CROSSING_NORMAL; | 219 event->crossing.mode = GDK_CROSSING_NORMAL; |
| 213 event->crossing.detail = GDK_NOTIFY_ANCESTOR; | 220 event->crossing.detail = GDK_NOTIFY_ANCESTOR; |
| 214 event->crossing.focus = true; | 221 event->crossing.focus = true; |
| 215 event->crossing.state = 0; | 222 event->crossing.state = 0; |
| 216 | 223 |
| 217 g_signal_emit_by_name(GTK_OBJECT(close_button()->widget()), | 224 g_signal_emit_by_name(GTK_OBJECT(close_button()->widget()), |
| 218 "enter-notify-event", event, | 225 "enter-notify-event", event, |
| 219 &return_value); | 226 &return_value); |
| 220 } | 227 } |
| OLD | NEW |