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 #ifndef CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ |
6 #define CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ | 6 #define CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "app/gtk_signal.h" |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/task.h" | 13 #include "base/task.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "chrome/browser/gtk/tabstrip_origin_provider.h" | 15 #include "chrome/browser/gtk/tabstrip_origin_provider.h" |
15 #include "chrome/browser/gtk/tabs/tab_gtk.h" | 16 #include "chrome/browser/gtk/tabs/tab_gtk.h" |
16 #include "chrome/browser/gtk/view_id_util.h" | 17 #include "chrome/browser/gtk/view_id_util.h" |
17 #include "chrome/browser/tabs/tab_strip_model.h" | 18 #include "chrome/browser/tabs/tab_strip_model.h" |
18 #include "chrome/common/notification_observer.h" | 19 #include "chrome/common/notification_observer.h" |
19 #include "chrome/common/owned_widget_gtk.h" | 20 #include "chrome/common/owned_widget_gtk.h" |
20 #include "gfx/rect.h" | 21 #include "gfx/rect.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Used during a drop session of a url. Tracks the position of the drop as | 170 // Used during a drop session of a url. Tracks the position of the drop as |
170 // well as a window used to highlight where the drop occurs. | 171 // well as a window used to highlight where the drop occurs. |
171 class DropInfo { | 172 class DropInfo { |
172 public: | 173 public: |
173 DropInfo(int index, bool drop_before, bool point_down); | 174 DropInfo(int index, bool drop_before, bool point_down); |
174 ~DropInfo(); | 175 ~DropInfo(); |
175 | 176 |
176 // TODO(jhawkins): Factor out this code into a TransparentContainer class. | 177 // TODO(jhawkins): Factor out this code into a TransparentContainer class. |
177 | 178 |
178 // expose-event handler that redraws the drop indicator. | 179 // expose-event handler that redraws the drop indicator. |
179 static gboolean OnExposeEvent(GtkWidget* widget, GdkEventExpose* event, | 180 CHROMEGTK_CALLBACK_1(DropInfo, gboolean, OnExposeEvent, GdkEventExpose*); |
180 DropInfo* drop_info); | |
181 | 181 |
182 // Sets the color map of the container window to allow the window to be | 182 // Sets the color map of the container window to allow the window to be |
183 // transparent. | 183 // transparent. |
184 void SetContainerColorMap(); | 184 void SetContainerColorMap(); |
185 | 185 |
186 // Sets full transparency for the container window. This is used if | 186 // Sets full transparency for the container window. This is used if |
187 // compositing is available for the screen. | 187 // compositing is available for the screen. |
188 void SetContainerTransparency(); | 188 void SetContainerTransparency(); |
189 | 189 |
190 // Sets the shape mask for the container window to emulate a transparent | 190 // Sets the shape mask for the container window to emulate a transparent |
(...skipping 24 matching lines...) Expand all Loading... |
215 GtkWidget* container; | 215 GtkWidget* container; |
216 | 216 |
217 // The drop indicator image. | 217 // The drop indicator image. |
218 GdkPixbuf* drop_arrow; | 218 GdkPixbuf* drop_arrow; |
219 | 219 |
220 private: | 220 private: |
221 DISALLOW_COPY_AND_ASSIGN(DropInfo); | 221 DISALLOW_COPY_AND_ASSIGN(DropInfo); |
222 }; | 222 }; |
223 | 223 |
224 // expose-event handler that redraws the tabstrip | 224 // expose-event handler that redraws the tabstrip |
225 static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, | 225 CHROMEGTK_CALLBACK_1(TabStripGtk, gboolean, OnExpose, GdkEventExpose*); |
226 TabStripGtk* tabstrip); | |
227 | 226 |
228 // size-allocate handler that gets the new bounds of the tabstrip. | 227 // size-allocate handler that gets the new bounds of the tabstrip. |
229 static void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation, | 228 CHROMEGTK_CALLBACK_1(TabStripGtk, void, OnSizeAllocate, GtkAllocation*); |
230 TabStripGtk* tabstrip); | |
231 | 229 |
232 // drag-motion handler that is signaled when the user performs a drag in the | 230 // drag-motion handler that is signaled when the user performs a drag in the |
233 // tabstrip bounds. | 231 // tabstrip bounds. |
234 static gboolean OnDragMotion(GtkWidget* widget, GdkDragContext* context, | 232 CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragMotion, GdkDragContext*, |
235 gint x, gint y, guint time, | 233 gint, gint, guint); |
236 TabStripGtk* tabstrip); | |
237 | 234 |
238 // drag-drop handler that is notified when the user finishes a drag. | 235 // drag-drop handler that is notified when the user finishes a drag. |
239 static gboolean OnDragDrop(GtkWidget* widget, GdkDragContext* context, | 236 CHROMEGTK_CALLBACK_4(TabStripGtk, gboolean, OnDragDrop, GdkDragContext*, |
240 gint x, gint y, guint time, | 237 gint, gint, guint); |
241 TabStripGtk* tabstrip); | |
242 | 238 |
243 // drag-leave handler that is signaled when the mouse leaves the tabstrip | 239 // drag-leave handler that is signaled when the mouse leaves the tabstrip |
244 // during a drag. | 240 // during a drag. |
245 static gboolean OnDragLeave(GtkWidget* widget, GdkDragContext* context, | 241 CHROMEGTK_CALLBACK_2(TabStripGtk, gboolean, OnDragLeave, GdkDragContext*, |
246 guint time, TabStripGtk* tabstrip); | 242 guint); |
247 | |
248 // drag-failed handler that is signaled when the drag fails or is canceled. | |
249 static gboolean OnDragFailed(GtkWidget* widget, GdkDragContext* context, | |
250 GtkDragResult result, TabStripGtk* tabstrip); | |
251 | 243 |
252 // drag-data-received handler that receives the data associated with the drag. | 244 // drag-data-received handler that receives the data associated with the drag. |
253 static gboolean OnDragDataReceived(GtkWidget* widget, GdkDragContext* context, | 245 CHROMEGTK_CALLBACK_6(TabStripGtk, gboolean, OnDragDataReceived, |
254 gint x, gint y, GtkSelectionData* data, | 246 GdkDragContext*, gint, gint, GtkSelectionData*, |
255 guint info, guint time, | 247 guint, guint); |
256 TabStripGtk* tabstrip); | |
257 | 248 |
258 // Handles the clicked signal from the new tab button. | 249 // Handles the clicked signal from the new tab button. |
259 static void OnNewTabClicked(GtkWidget* widget, TabStripGtk* tabstrip); | 250 CHROMEGTK_CALLBACK_0(TabStripGtk, void, OnNewTabClicked); |
260 | 251 |
261 // Sets the bounds of the tab and moves the tab widget to those bounds. | 252 // Sets the bounds of the tab and moves the tab widget to those bounds. |
262 void SetTabBounds(TabGtk* tab, const gfx::Rect& bounds); | 253 void SetTabBounds(TabGtk* tab, const gfx::Rect& bounds); |
263 | 254 |
264 // Returns true if |rects| are all areas that match up with tab favicons. | 255 // Returns true if |rects| are all areas that match up with tab favicons. |
265 // |rects| must be sorted from left to right. |tabs_to_paint| are the tab | 256 // |rects| must be sorted from left to right. |tabs_to_paint| are the tab |
266 // positions that match the rects. | 257 // positions that match the rects. |
267 bool CanPaintOnlyFavIcons(const GdkRectangle* rects, | 258 bool CanPaintOnlyFavIcons(const GdkRectangle* rects, |
268 int num_rects, | 259 int num_rects, |
269 std::vector<int>* tabs_to_paint); | 260 std::vector<int>* tabs_to_paint); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 // ResizeLayoutTabsNow method. | 451 // ResizeLayoutTabsNow method. |
461 ScopedRunnableMethodFactory<TabStripGtk> resize_layout_factory_; | 452 ScopedRunnableMethodFactory<TabStripGtk> resize_layout_factory_; |
462 | 453 |
463 // True if the tabstrip has already been added as a MessageLoop observer. | 454 // True if the tabstrip has already been added as a MessageLoop observer. |
464 bool added_as_message_loop_observer_; | 455 bool added_as_message_loop_observer_; |
465 | 456 |
466 DISALLOW_COPY_AND_ASSIGN(TabStripGtk); | 457 DISALLOW_COPY_AND_ASSIGN(TabStripGtk); |
467 }; | 458 }; |
468 | 459 |
469 #endif // CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ | 460 #endif // CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ |
OLD | NEW |