Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/browser/gtk/tabs/tab_renderer_gtk.cc

Issue 160512: gtk: Move the enter/leave-notify-event handling to TabRendererGtk and hook up... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" 5 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/gfx/canvas_paint.h" 9 #include "app/gfx/canvas_paint.h"
10 #include "app/gfx/favicon_size.h" 10 #include "app/gfx/favicon_size.h"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 798 }
799 799
800 CustomDrawButton* TabRendererGtk::MakeCloseButton() { 800 CustomDrawButton* TabRendererGtk::MakeCloseButton() {
801 CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE, 801 CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE,
802 IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE); 802 IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE);
803 803
804 g_signal_connect(G_OBJECT(button->widget()), "clicked", 804 g_signal_connect(G_OBJECT(button->widget()), "clicked",
805 G_CALLBACK(OnCloseButtonClicked), this); 805 G_CALLBACK(OnCloseButtonClicked), this);
806 g_signal_connect(G_OBJECT(button->widget()), "button-release-event", 806 g_signal_connect(G_OBJECT(button->widget()), "button-release-event",
807 G_CALLBACK(OnCloseButtonMouseRelease), this); 807 G_CALLBACK(OnCloseButtonMouseRelease), this);
808 g_signal_connect(G_OBJECT(button->widget()), "enter-notify-event",
809 G_CALLBACK(OnEnterNotifyEvent), this);
810 g_signal_connect(G_OBJECT(button->widget()), "leave-notify-event",
811 G_CALLBACK(OnLeaveNotifyEvent), this);
808 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); 812 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS);
809 gtk_fixed_put(GTK_FIXED(tab_.get()), button->widget(), 0, 0); 813 gtk_fixed_put(GTK_FIXED(tab_.get()), button->widget(), 0, 0);
810 814
811 return button; 815 return button;
812 } 816 }
813 817
814 void TabRendererGtk::CloseButtonClicked() { 818 void TabRendererGtk::CloseButtonClicked() {
815 // Nothing to do. 819 // Nothing to do.
816 } 820 }
817 821
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 855
852 // Nothing to do if the bounds are the same. If we don't catch this, we'll 856 // Nothing to do if the bounds are the same. If we don't catch this, we'll
853 // get an infinite loop of size-allocate signals. 857 // get an infinite loop of size-allocate signals.
854 if (tab->bounds_ == bounds) 858 if (tab->bounds_ == bounds)
855 return; 859 return;
856 860
857 tab->bounds_ = bounds; 861 tab->bounds_ = bounds;
858 tab->Layout(); 862 tab->Layout();
859 } 863 }
860 864
861 void TabRendererGtk::OnMouseEntered() { 865 // static
862 hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); 866 gboolean TabRendererGtk::OnEnterNotifyEvent(GtkWidget* widget,
863 hover_animation_->Show(); 867 GdkEventCrossing* event,
Elliot Glaysher 2009/08/03 03:30:29 Spacing?
James Hawkins 2009/08/03 03:40:16 I'm not sure what you're pointing out. Little hel
Elliot Glaysher 2009/08/03 03:41:46 "GdkEventCrossing* event," and "TabRenderGtk* tab)
James Hawkins 2009/08/03 03:45:02 In my editor and this CL, The G's in GtkWidget and
Elliot Glaysher 2009/08/03 18:39:40 Build of Chromium Linux from Friday: Off by one sp
864 } 868 TabRendererGtk* tab) {
865 869 tab->hover_animation_->SetTweenType(SlideAnimation::EASE_OUT);
866 void TabRendererGtk::OnMouseExited() { 870 tab->hover_animation_->Show();
867 hover_animation_->SetTweenType(SlideAnimation::EASE_IN); 871 return FALSE;
868 hover_animation_->Hide();
869 } 872 }
870 873
871 // static 874 // static
875 gboolean TabRendererGtk::OnLeaveNotifyEvent(GtkWidget* widget,
876 GdkEventCrossing* event,
877 TabRendererGtk* tab) {
878 tab->hover_animation_->SetTweenType(SlideAnimation::EASE_IN);
879 tab->hover_animation_->Hide();
880 return FALSE;
881 }
882
883 // static
872 void TabRendererGtk::InitResources() { 884 void TabRendererGtk::InitResources() {
873 if (initialized_) 885 if (initialized_)
874 return; 886 return;
875 887
876 LoadTabImages(); 888 LoadTabImages();
877 889
878 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 890 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
879 // Force the font size to 8pt. 891 // Force the font size to 8pt.
880 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); 892 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont);
881 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 8)); 893 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 8));
882 title_font_height_ = title_font_->height(); 894 title_font_height_ = title_font_->height();
883 895
884 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); 896 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON);
885 897
886 initialized_ = true; 898 initialized_ = true;
887 } 899 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698