Gtkstyle is an important abstract between GTK and gdk. It allows you to customize the external representation of the component, instead of directly processing the external representation of the gdk, gtkstyle is one of the members of gtkwidget: Typedef struct {
/* The style for the widget. The style contains
* Colors the widget shocould be drawn in for each State
* Along with graphics contexts used to draw with and
* The font to use for text.
*/
Gtkstyle * gseal (style );
....
} Gtkwidget;
For example, the gtkstyle described in the file includes the pixel color information of the component and how to encrypt the information in each region:
Typedef struct _ gtkstyle;
Struct _ gtkstyle
{
Gtkstyleclass * Klass;
Gdkcolor FG [5];
Gdkcolor BG [5];
Gdkcolor light [5];
Gdkcolor dark [5];
Gdkcolor mid [5];
Gdkcolor text [5];
Gdkcolor base [5];
Gdkcolor black;
Gdkcolor white;
Gdkfont * font;
Gdkgc * fg_gc [5];
Gdkgc * bg_gc [5];
Gdkgc * light_gc [5];
Gdkgc * dark_gc [5];
Gdkgc * mid_gc [5];
Gdkgc * text_gc [5];
Gdkgc * base_gc [5];
Gdkgc * black_gc;
Gdkgc * white_gc;
Gdkpixmap * bg_pixmap [5];
/* Private */
Gint ref_count;
Gint attach_count;
Gint depth;
Gdkcolormap * colormap;
Gtkthemeengine * engine;
Gpointer engine_data;
Gtkrcstyle * rc_style;
Gslist * styles;
};
You can use gtk_widget_style_get () of the gtkwidget to obtain the gtkstyle. You can use the gtk_widget_set_style () function to set the gtkstyle. For example
Gtkcolorbutton And Gtkcolorselectiondialog
You can find that, in the definition of gtkstyle, you can find that they all have a limit column with five elements, this is because it can be divided into five different regions. Colors:
- Gtk_state_normal: normal
Operation Zookeeper
- Gtk_state_active
- Gtk_state_prelight: If
The component can respond When the mouse is pressed, the mouse moves over the component
- Gtk_state_selected: Selected zookeeper
- Gtk_state_insensitive: indicates that the user's dynamic response is not responded.
The gtkstyle format can be written into an information source case. For example, A. RC file is as follows:
style "widgets" { fg[ACTIVE] = "#FF0000" fg[SELECTED] = "#003366" fg[NORMAL] = "#FFFFFF" fg[PRELIGHT] = "#FFFFFF" fg[INSENSITIVE] = "#999999"
bg[ACTIVE] = "#003366" bg[SELECTED] = "#FFFFFF" bg[NORMAL] = "#000000" bg[PRELIGHT] = "#003366" bg[INSENSITIVE] = "#666666" }
style "labels" = "widgets" { font_name = "Algerian 14" } style "buttons" = "widgets" { GtkButton::inner-border = { 10, 10, 10, 10 } }
style "radios" = "buttons" { GtkCheckButton::indicator-size = 10 }
style "checks" = "buttons" { GtkCheckButton::indicator-size = 25 }
class "GtkWindow" style "widgets" class "GtkLabel" style "labels" class "GtkCheckButton" style "checks" class "GtkRadioButton" style "radios" class "Gtk*Button" style "buttons" The statement method is very simple. Each style can have a namespace and specify the specification to be modified. The formula can also be accepted, for example, in the above setting, "labels" = "Widgets" indicates "labels" Accept Parameter settings of "widgets". The bottom line is the name of the similar name, and the last line, "GTK * button" indicates that the start of GTK is set, and all the other names at the end of the button are consistent.
This. RC case can be applied
Gtkcheckbutton And gtkradiobutton
In the example, as long as the gtk_rc_parse () function is deleted after the gtk_init () operation and the format scheme is specified: ....
Gtk_init (& argc, & argv );
Gtk_rc_parse ("styles. RC ");
....
Repeat and adjust the itinerary. The following figure shows a specific line: |
|
Anti-bot pro |
|
Yamaha YSP provides tailored health care for your car. You can enjoy excellent health care when you come to the store during the activity period. |
More messages .. |
|
Eee regions Real-time surprise |
|
If you wish your friends an EEE, you will have the chance to see other big prizes, such as the "time-honored Eee PC" and "Daily Luxury Tour! |
More messages .. |
|
|
Impr |