效果
在gtk+2.0中,可以通过gtk_widget_get_style
获取按钮的样式,并设置bg_pixmap
背景图片的方法。
其中bg_pixmap
数组有下面的枚举类型,代表不同情况下的图片类型。这意味着你可以在按钮正常,鼠标覆盖和鼠标按下的时候分别设置不同的图片。
enum GtkStateType
typedef enum
{
GTK_STATE_NORMAL,
GTK_STATE_ACTIVE,
GTK_STATE_PRELIGHT,
GTK_STATE_SELECTED,
GTK_STATE_INSENSITIVE
} GtkStateType;
This type indicates the current state of a widget; the state determines how the widget is drawn. The GtkStateType enumeration is also used to identify different colors in a GtkStyle for drawing, so states can be used for subparts of a widget as well as entire widgets.
GTK_STATE_NORMAL
State during normal operation.
GTK_STATE_ACTIVE
State of a currently active widget, such as a depressed button.
GTK_STATE_PRELIGHT
State indicating that the mouse pointer is over the widget and the widget