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