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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_GTK_GTK_CHROME_BUTTON_H_ 6 #define CHROME_BROWSER_UI_GTK_GTK_CHROME_BUTTON_H_ 7 8 #include <gtk/gtk.h> 9 10 G_BEGIN_DECLS 11 12 #define GTK_TYPE_CHROME_BUTTON (gtk_chrome_button_get_type ()) 13 #define GTK_CHROME_BUTTON(obj) \ 14 (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CHROME_BUTTON, GtkChromeButton)) 15 #define GTK_CHROME_BUTTON_CLASS(klass) \ 16 (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CHROME_BUTTON, \ 17 GtkChromeButtonClass)) 18 #define GTK_IS_CHROME_BUTTON(obj) \ 19 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHROME_BUTTON)) 20 #define GTK_IS_CHROME_BUTTON_CLASS(klass) \ 21 (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHROME_BUTTON)) 22 #define GTK_CHROME_BUTTON_GET_CLASS(obj) \ 23 (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHROME_BUTTON, GtkChromeButton)) 24 25 typedef struct _GtkChromeButton GtkChromeButton; 26 typedef struct _GtkChromeButtonClass GtkChromeButtonClass; 27 28 struct _GtkChromeButton { 29 GtkButton button; 30 }; 31 32 struct _GtkChromeButtonClass { 33 GtkButtonClass parent_class; 34 }; 35 36 GtkWidget* gtk_chrome_button_new(); 37 38 GType gtk_chrome_button_get_type(); 39 40 // Set the paint state to |state|. This overrides the widget's current state. 41 void gtk_chrome_button_set_paint_state(GtkChromeButton* button, 42 GtkStateType state); 43 44 // Revert to using the widget's current state for painting. 45 void gtk_chrome_button_unset_paint_state(GtkChromeButton* button); 46 47 // Whether we should use custom theme images or let GTK take care of it. 48 void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button, 49 gboolean value); 50 51 // Sets the partial hover state of the button. The acceptable range is 0.0 to 52 // 1.0. If |state| is outside of that range, then revert the button to normal 53 // hovering. This can be overridden by gtk_chrome_button_set_paint_state. 54 void gtk_chrome_button_set_hover_state(GtkChromeButton* button, 55 gdouble state); 56 57 G_END_DECLS 58 59 #endif // CHROME_BROWSER_UI_GTK_GTK_CHROME_BUTTON_H_ 60