| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "app/slide_animation.h" | 8 #include "app/slide_animation.h" |
| 9 #include "base/gfx/gtk_util.h" | 9 #include "base/gfx/gtk_util.h" |
| 10 #include "base/gfx/point.h" | 10 #include "base/gfx/point.h" |
| 11 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
| 12 #include "chrome/browser/gtk/custom_button.h" | 12 #include "chrome/browser/gtk/custom_button.h" |
| 13 #include "chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h" | 13 #include "chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h" |
| 14 #include "chrome/browser/gtk/tabs/tab_button_gtk.h" | |
| 15 #include "chrome/browser/tab_contents/tab_contents.h" | 14 #include "chrome/browser/tab_contents/tab_contents.h" |
| 16 #include "chrome/common/gfx/chrome_canvas.h" | 15 #include "chrome/common/gfx/chrome_canvas.h" |
| 17 #include "chrome/common/l10n_util.h" | 16 #include "chrome/common/l10n_util.h" |
| 18 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 19 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 const int kDefaultAnimationDurationMs = 100; | 22 const int kDefaultAnimationDurationMs = 100; |
| 24 const int kResizeLayoutAnimationDurationMs = 166; | 23 const int kResizeLayoutAnimationDurationMs = 166; |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 void TabStripGtk::FinishAnimation(TabStripGtk::TabAnimation* animation, | 971 void TabStripGtk::FinishAnimation(TabStripGtk::TabAnimation* animation, |
| 973 bool layout) { | 972 bool layout) { |
| 974 active_animation_.reset(NULL); | 973 active_animation_.reset(NULL); |
| 975 if (layout) | 974 if (layout) |
| 976 Layout(); | 975 Layout(); |
| 977 } | 976 } |
| 978 | 977 |
| 979 // static | 978 // static |
| 980 gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event, | 979 gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event, |
| 981 TabStripGtk* tabstrip) { | 980 TabStripGtk* tabstrip) { |
| 982 | |
| 983 if (gdk_region_empty(event->region)) | 981 if (gdk_region_empty(event->region)) |
| 984 return TRUE; | 982 return TRUE; |
| 985 | 983 |
| 986 // TODO(jhawkins): Ideally we'd like to only draw what's needed in the damage | 984 // TODO(jhawkins): Ideally we'd like to only draw what's needed in the damage |
| 987 // rect, but the tab widgets overlap each other, and painting on one widget | 985 // rect, but the tab widgets overlap each other, and painting on one widget |
| 988 // will cause an expose-event to be sent to the widgets underneath. The | 986 // will cause an expose-event to be sent to the widgets underneath. The |
| 989 // underlying widget does not need to be redrawn as we control the order of | 987 // underlying widget does not need to be redrawn as we control the order of |
| 990 // expose-events. Currently we hack it to redraw the entire tabstrip. We | 988 // expose-events. Currently we hack it to redraw the entire tabstrip. We |
| 991 // could change the damage rect to just contain the tabs + the new tab button. | 989 // could change the damage rect to just contain the tabs + the new tab button. |
| 992 event->area.x = 0; | 990 event->area.x = 0; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 CustomDrawButton* button = new CustomDrawButton(IDR_NEWTAB_BUTTON, | 1073 CustomDrawButton* button = new CustomDrawButton(IDR_NEWTAB_BUTTON, |
| 1076 IDR_NEWTAB_BUTTON_P, IDR_NEWTAB_BUTTON_H, 0); | 1074 IDR_NEWTAB_BUTTON_P, IDR_NEWTAB_BUTTON_H, 0); |
| 1077 | 1075 |
| 1078 g_signal_connect(G_OBJECT(button->widget()), "clicked", | 1076 g_signal_connect(G_OBJECT(button->widget()), "clicked", |
| 1079 G_CALLBACK(OnNewTabClicked), this); | 1077 G_CALLBACK(OnNewTabClicked), this); |
| 1080 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); | 1078 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); |
| 1081 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); | 1079 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); |
| 1082 | 1080 |
| 1083 return button; | 1081 return button; |
| 1084 } | 1082 } |
| OLD | NEW |