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