diff options
author | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 19:24:48 +0000 |
---|---|---|
committer | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 19:24:48 +0000 |
commit | dfc8db9d8df51c51f89de2044695ce0993f80228 (patch) | |
tree | 3898e261b28252b3f7c332513250c49108616015 /chrome/browser/gtk/sad_tab_gtk.h | |
parent | 34812353c4b42a30e17da31b081c8c049d4fd28c (diff) | |
download | chromium_src-dfc8db9d8df51c51f89de2044695ce0993f80228.zip chromium_src-dfc8db9d8df51c51f89de2044695ce0993f80228.tar.gz chromium_src-dfc8db9d8df51c51f89de2044695ce0993f80228.tar.bz2 |
This cl reimplements the entire "Aw Snap" page to use gtk widgets to layout and draw the icon, title, message and add new "Learn more" link; the old implementation used skia to do simple drawing, but couldn't be used for link, hence the rewrite.
BUG=27211
TEST=Verify that "Aw Snap" page is displayed correctly, and new "Learn more" link shows up centralized beneath the message, and when window is resized bi-directionally, especially smaller to force wrapping of message.
Review URL: http://codereview.chromium.org/385145
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/sad_tab_gtk.h')
-rw-r--r-- | chrome/browser/gtk/sad_tab_gtk.h | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/chrome/browser/gtk/sad_tab_gtk.h b/chrome/browser/gtk/sad_tab_gtk.h index aed2454..cc140f8 100644 --- a/chrome/browser/gtk/sad_tab_gtk.h +++ b/chrome/browser/gtk/sad_tab_gtk.h @@ -16,34 +16,37 @@ class SadTabGtk { SadTabGtk(); ~SadTabGtk(); - GtkWidget* widget() { return widget_.get(); } + GtkWidget* widget() { return event_box_.get(); } private: - // expose-event handler that redraws the SadTabGtk. - static gboolean OnExposeThunk(GtkWidget* widget, - GdkEventExpose* event, - const SadTabGtk* sad_tab); + // expose-event handler that draws the gradient background of the SadTabGtk. + static gboolean OnBackgroundExposeThunk(GtkWidget* widget, + GdkEventExpose* event, + SadTabGtk* sad_tab) { + return sad_tab->OnBackgroundExpose(widget, event); + } - gboolean OnExpose(GtkWidget* widget, GdkEventExpose* event) const; + gboolean OnBackgroundExpose(GtkWidget* widget, GdkEventExpose* event); - // configure-event handler that gets the new bounds of the SadTabGtk. - static gboolean OnConfigureThunk(GtkWidget* widget, - GdkEventConfigure* event, - SadTabGtk* sad_tab); + // size-allocate handler to adjust dimensions for children widgets. + static void OnSizeAllocateThunk(GtkWidget* widget, + GtkAllocation* allocation, + SadTabGtk* sad_tab) { + sad_tab->OnSizeAllocate(widget, allocation); + } - gboolean OnConfigure(GtkWidget* widget, GdkEventConfigure* event); + void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); - // Track the view's width and height from configure-event signals. + // click-event handler that opens the url of the clicked link. + static void OnLinkButtonClick(GtkWidget* button, const char* url); + + // Track the view's width and height from size-allocate signals. int width_; int height_; - // Regions within the display for different components, set on a - // configure-event. These are relative to the bounds of the widget. - gfx::Rect icon_bounds_; - int title_y_; - int message_y_; - - OwnedWidgetGtk widget_; + OwnedWidgetGtk event_box_; + GtkWidget* top_padding_; + GtkWidget* message_; DISALLOW_COPY_AND_ASSIGN(SadTabGtk); }; |