| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gtk/browser_actions_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 return TRUE; | 843 return TRUE; |
| 844 } | 844 } |
| 845 | 845 |
| 846 // These three signal handlers (EnterNotify, LeaveNotify, and ButtonRelease) | 846 // These three signal handlers (EnterNotify, LeaveNotify, and ButtonRelease) |
| 847 // are used to give the gripper the resize cursor. Since it doesn't have its | 847 // are used to give the gripper the resize cursor. Since it doesn't have its |
| 848 // own window, we have to set the cursor whenever the pointer moves into the | 848 // own window, we have to set the cursor whenever the pointer moves into the |
| 849 // button or leaves the button, and be sure to leave it on when the user is | 849 // button or leaves the button, and be sure to leave it on when the user is |
| 850 // dragging. | 850 // dragging. |
| 851 gboolean BrowserActionsToolbarGtk::OnGripperEnterNotify( | 851 gboolean BrowserActionsToolbarGtk::OnGripperEnterNotify( |
| 852 GtkWidget* gripper, GdkEventCrossing* event) { | 852 GtkWidget* gripper, GdkEventCrossing* event) { |
| 853 gdk_window_set_cursor(gripper->window, | 853 gdk_window_set_cursor(gtk_widget_get_window(gripper), |
| 854 gfx::GetCursor(GDK_SB_H_DOUBLE_ARROW)); | 854 gfx::GetCursor(GDK_SB_H_DOUBLE_ARROW)); |
| 855 return FALSE; | 855 return FALSE; |
| 856 } | 856 } |
| 857 | 857 |
| 858 gboolean BrowserActionsToolbarGtk::OnGripperLeaveNotify( | 858 gboolean BrowserActionsToolbarGtk::OnGripperLeaveNotify( |
| 859 GtkWidget* gripper, GdkEventCrossing* event) { | 859 GtkWidget* gripper, GdkEventCrossing* event) { |
| 860 if (!(event->state & GDK_BUTTON1_MASK)) | 860 if (!(event->state & GDK_BUTTON1_MASK)) |
| 861 gdk_window_set_cursor(gripper->window, NULL); | 861 gdk_window_set_cursor(gtk_widget_get_window(gripper), NULL); |
| 862 return FALSE; | 862 return FALSE; |
| 863 } | 863 } |
| 864 | 864 |
| 865 gboolean BrowserActionsToolbarGtk::OnGripperButtonRelease( | 865 gboolean BrowserActionsToolbarGtk::OnGripperButtonRelease( |
| 866 GtkWidget* gripper, GdkEventButton* event) { | 866 GtkWidget* gripper, GdkEventButton* event) { |
| 867 gfx::Rect gripper_rect(0, 0, | 867 gfx::Rect gripper_rect(0, 0, |
| 868 gripper->allocation.width, gripper->allocation.height); | 868 gripper->allocation.width, gripper->allocation.height); |
| 869 gfx::Point release_point(event->x, event->y); | 869 gfx::Point release_point(event->x, event->y); |
| 870 if (!gripper_rect.Contains(release_point)) | 870 if (!gripper_rect.Contains(release_point)) |
| 871 gdk_window_set_cursor(gripper->window, NULL); | 871 gdk_window_set_cursor(gtk_widget_get_window(gripper), NULL); |
| 872 | 872 |
| 873 // After the user resizes the toolbar, we want to smartly resize it to be | 873 // After the user resizes the toolbar, we want to smartly resize it to be |
| 874 // the perfect size to fit the buttons. | 874 // the perfect size to fit the buttons. |
| 875 int visible_icon_count = | 875 int visible_icon_count = |
| 876 gtk_chrome_shrinkable_hbox_get_visible_child_count( | 876 gtk_chrome_shrinkable_hbox_get_visible_child_count( |
| 877 GTK_CHROME_SHRINKABLE_HBOX(button_hbox_.get())); | 877 GTK_CHROME_SHRINKABLE_HBOX(button_hbox_.get())); |
| 878 AnimateToShowNIcons(visible_icon_count); | 878 AnimateToShowNIcons(visible_icon_count); |
| 879 model_->SetVisibleIconCount(visible_icon_count); | 879 model_->SetVisibleIconCount(visible_icon_count); |
| 880 | 880 |
| 881 return FALSE; | 881 return FALSE; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 954 |
| 955 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 955 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
| 956 event->time); | 956 event->time); |
| 957 return TRUE; | 957 return TRUE; |
| 958 } | 958 } |
| 959 | 959 |
| 960 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 960 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
| 961 if (!resize_animation_.is_animating()) | 961 if (!resize_animation_.is_animating()) |
| 962 UpdateChevronVisibility(); | 962 UpdateChevronVisibility(); |
| 963 } | 963 } |
| OLD | NEW |