| 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_SAD_TAB_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_SAD_TAB_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_SAD_TAB_GTK_H_ | 6 #define CHROME_BROWSER_GTK_SAD_TAB_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/gfx/rect.h" | 11 #include "base/gfx/rect.h" |
| 12 #include "chrome/common/owned_widget_gtk.h" | 12 #include "chrome/common/owned_widget_gtk.h" |
| 13 | 13 |
| 14 class TabContents; |
| 15 |
| 14 class SadTabGtk { | 16 class SadTabGtk { |
| 15 public: | 17 public: |
| 16 SadTabGtk(); | 18 explicit SadTabGtk(TabContents* tab_contents); |
| 17 ~SadTabGtk(); | 19 ~SadTabGtk(); |
| 18 | 20 |
| 19 GtkWidget* widget() { return event_box_.get(); } | 21 GtkWidget* widget() { return event_box_.get(); } |
| 20 | 22 |
| 21 private: | 23 private: |
| 22 // expose-event handler that draws the gradient background of the SadTabGtk. | 24 // Expose-event handler that draws the gradient background of the SadTabGtk. |
| 23 static gboolean OnBackgroundExposeThunk(GtkWidget* widget, | 25 static gboolean OnBackgroundExposeThunk(GtkWidget* widget, |
| 24 GdkEventExpose* event, | 26 GdkEventExpose* event, |
| 25 SadTabGtk* sad_tab) { | 27 SadTabGtk* sad_tab) { |
| 26 return sad_tab->OnBackgroundExpose(widget, event); | 28 return sad_tab->OnBackgroundExpose(widget, event); |
| 27 } | 29 } |
| 28 | 30 |
| 29 gboolean OnBackgroundExpose(GtkWidget* widget, GdkEventExpose* event); | 31 gboolean OnBackgroundExpose(GtkWidget* widget, GdkEventExpose* event); |
| 30 | 32 |
| 31 // size-allocate handler to adjust dimensions for children widgets. | 33 // Size-allocate handler to adjust dimensions for children widgets. |
| 32 static void OnSizeAllocateThunk(GtkWidget* widget, | 34 static void OnSizeAllocateThunk(GtkWidget* widget, |
| 33 GtkAllocation* allocation, | 35 GtkAllocation* allocation, |
| 34 SadTabGtk* sad_tab) { | 36 SadTabGtk* sad_tab) { |
| 35 sad_tab->OnSizeAllocate(widget, allocation); | 37 sad_tab->OnSizeAllocate(widget, allocation); |
| 36 } | 38 } |
| 37 | 39 |
| 38 void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); | 40 void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); |
| 39 | 41 |
| 40 // click-event handler that opens the url of the clicked link. | 42 // Clicked-event handler for link to launch associated url. |
| 41 static void OnLinkButtonClick(GtkWidget* button, const char* url); | 43 static void OnLinkButtonClickThunk(GtkWidget* widget, |
| 44 SadTabGtk* sad_tab) { |
| 45 sad_tab->OnLinkButtonClick(); |
| 46 } |
| 47 |
| 48 void OnLinkButtonClick(); |
| 42 | 49 |
| 43 // Track the view's width and height from size-allocate signals. | 50 // Track the view's width and height from size-allocate signals. |
| 44 int width_; | 51 int width_; |
| 45 int height_; | 52 int height_; |
| 46 | 53 |
| 54 TabContents* tab_contents_; |
| 47 OwnedWidgetGtk event_box_; | 55 OwnedWidgetGtk event_box_; |
| 48 GtkWidget* top_padding_; | 56 GtkWidget* top_padding_; |
| 49 GtkWidget* message_; | 57 GtkWidget* message_; |
| 50 | 58 |
| 51 DISALLOW_COPY_AND_ASSIGN(SadTabGtk); | 59 DISALLOW_COPY_AND_ASSIGN(SadTabGtk); |
| 52 }; | 60 }; |
| 53 | 61 |
| 54 #endif // CHROME_BROWSER_GTK_SAD_TAB_GTK_H__ | 62 #endif // CHROME_BROWSER_GTK_SAD_TAB_GTK_H__ |
| OLD | NEW |