| 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 #ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 // TabStripModelObserver implementation: | 105 // TabStripModelObserver implementation: |
| 106 virtual void TabInsertedAt(TabContentsWrapper* contents, | 106 virtual void TabInsertedAt(TabContentsWrapper* contents, |
| 107 int index, | 107 int index, |
| 108 bool foreground); | 108 bool foreground); |
| 109 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); | 109 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); |
| 110 virtual void TabMoved(TabContentsWrapper* contents, | 110 virtual void TabMoved(TabContentsWrapper* contents, |
| 111 int from_index, | 111 int from_index, |
| 112 int to_index); | 112 int to_index); |
| 113 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | |
| 114 TabContentsWrapper* new_contents, | |
| 115 int index, | |
| 116 bool user_gesture); | |
| 117 virtual void TabSelectionChanged(const TabStripSelectionModel& old_model); | 113 virtual void TabSelectionChanged(const TabStripSelectionModel& old_model); |
| 118 virtual void TabChangedAt(TabContentsWrapper* contents, int index, | 114 virtual void TabChangedAt(TabContentsWrapper* contents, int index, |
| 119 TabChangeType change_type); | 115 TabChangeType change_type); |
| 120 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 116 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 121 TabContentsWrapper* old_contents, | 117 TabContentsWrapper* old_contents, |
| 122 TabContentsWrapper* new_contents, | 118 TabContentsWrapper* new_contents, |
| 123 int index); | 119 int index); |
| 124 virtual void TabMiniStateChanged(TabContentsWrapper* contents, int index); | 120 virtual void TabMiniStateChanged(TabContentsWrapper* contents, int index); |
| 125 virtual void TabBlockedStateChanged(TabContentsWrapper* contents, | 121 virtual void TabBlockedStateChanged(TabContentsWrapper* contents, |
| 126 int index); | 122 int index); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // tabstrip and toolbar. | 221 // tabstrip and toolbar. |
| 226 GtkWidget* container; | 222 GtkWidget* container; |
| 227 | 223 |
| 228 // The drop indicator image. | 224 // The drop indicator image. |
| 229 GdkPixbuf* drop_arrow; | 225 GdkPixbuf* drop_arrow; |
| 230 | 226 |
| 231 private: | 227 private: |
| 232 DISALLOW_COPY_AND_ASSIGN(DropInfo); | 228 DISALLOW_COPY_AND_ASSIGN(DropInfo); |
| 233 }; | 229 }; |
| 234 | 230 |
| 235 // Map signal handler that sets initial z-ordering. The widgets need to be | |
| 236 // realized before we can set the stacking. We use the "map" signal since the | |
| 237 // "realize" signal is called before the child widgets get realized. | |
| 238 CHROMEGTK_CALLBACK_0(TabStripGtk, void, OnMap); | |
| 239 | |
| 240 // expose-event handler that redraws the tabstrip | 231 // expose-event handler that redraws the tabstrip |
| 241 CHROMEGTK_CALLBACK_1(TabStripGtk, gboolean, OnExpose, GdkEventExpose*); | 232 CHROMEGTK_CALLBACK_1(TabStripGtk, gboolean, OnExpose, GdkEventExpose*); |
| 242 | 233 |
| 243 // size-allocate handler that gets the new bounds of the tabstrip. | 234 // size-allocate handler that gets the new bounds of the tabstrip. |
| 244 CHROMEGTK_CALLBACK_1(TabStripGtk, void, OnSizeAllocate, GtkAllocation*); | 235 CHROMEGTK_CALLBACK_1(TabStripGtk, void, OnSizeAllocate, GtkAllocation*); |
| 245 | 236 |
| 246 // drag-motion handler that is signaled when the user performs a drag in the | 237 // drag-motion handler that is signaled when the user performs a drag in the |
| 247 // tabstrip bounds. | 238 // tabstrip bounds. |
| 248 CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragMotion, GdkDragContext*, | 239 CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragMotion, GdkDragContext*, |
| 249 gint, gint, guint); | 240 gint, gint, guint); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 int tab_start_x() const; | 314 int tab_start_x() const; |
| 324 | 315 |
| 325 // Perform an animated resize-relayout of the TabStrip immediately. The | 316 // Perform an animated resize-relayout of the TabStrip immediately. The |
| 326 // value returned indicates whether a resize actually took place. | 317 // value returned indicates whether a resize actually took place. |
| 327 bool ResizeLayoutTabs(); | 318 bool ResizeLayoutTabs(); |
| 328 | 319 |
| 329 // Returns whether or not the cursor is currently in the "tab strip zone" | 320 // Returns whether or not the cursor is currently in the "tab strip zone" |
| 330 // which is defined as the region above the TabStrip and a bit below it. | 321 // which is defined as the region above the TabStrip and a bit below it. |
| 331 bool IsCursorInTabStripZone() const; | 322 bool IsCursorInTabStripZone() const; |
| 332 | 323 |
| 333 // Reset the Z-ordering of tabs. | |
| 334 void ReStack(); | |
| 335 | |
| 336 // Ensure that the message loop observer used for event spying is added and | 324 // Ensure that the message loop observer used for event spying is added and |
| 337 // removed appropriately so we can tell when to resize layout the tab strip. | 325 // removed appropriately so we can tell when to resize layout the tab strip. |
| 338 void AddMessageLoopObserver(); | 326 void AddMessageLoopObserver(); |
| 339 void RemoveMessageLoopObserver(); | 327 void RemoveMessageLoopObserver(); |
| 340 | 328 |
| 341 // Calculates the available width for tabs, assuming a Tab is to be closed. | 329 // Calculates the available width for tabs, assuming a Tab is to be closed. |
| 342 int GetAvailableWidthForTabs(TabGtk* last_tab) const; | 330 int GetAvailableWidthForTabs(TabGtk* last_tab) const; |
| 343 | 331 |
| 344 // Finds the index of the TabContents corresponding to |tab| in our | 332 // Finds the index of the TabContents corresponding to |tab| in our |
| 345 // associated TabStripModel, or -1 if there is none (e.g. the specified |tab| | 333 // associated TabStripModel, or -1 if there is none (e.g. the specified |tab| |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 // True if the tabstrip has already been added as a MessageLoop observer. | 465 // True if the tabstrip has already been added as a MessageLoop observer. |
| 478 bool added_as_message_loop_observer_; | 466 bool added_as_message_loop_observer_; |
| 479 | 467 |
| 480 // Helper for performing tab selection as a result of dragging over a tab. | 468 // Helper for performing tab selection as a result of dragging over a tab. |
| 481 HoverTabSelector hover_tab_selector_; | 469 HoverTabSelector hover_tab_selector_; |
| 482 | 470 |
| 483 DISALLOW_COPY_AND_ASSIGN(TabStripGtk); | 471 DISALLOW_COPY_AND_ASSIGN(TabStripGtk); |
| 484 }; | 472 }; |
| 485 | 473 |
| 486 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_ | 474 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_GTK_H_ |
| OLD | NEW |