GtkStyle arguments for GtkWidget
- From: Tim Janik <timj gtk org>
- To: Gtk+ Developers <gtk-devel-list redhat com>
- Subject: GtkStyle arguments for GtkWidget
- Date: Sun, 25 Oct 1998 15:56:13 +0100 (CET)
hi all,
i'm about to implement editing facilities for a widget's GtkStyle in
GLE. i first intended to implement special knowledge about styles in
GLE, but come to think of it, it's actually much more usefull to export
the style fields through the widget arguments (besides the obvious
reduction of code duplication in interface builders and language bindings).
currently, a GtkWidget only supports
"GtkWidget::style" of type GtkStyle*
if the style args get implemented as
widget arguments, we will also get:
"GtkWidget::style_fg::STATE" of type GtkColorValue
"GtkWidget::style_bg::STATE" of type GtkColorValue
"GtkWidget::style_light::STATE" of type GtkColorValue
"GtkWidget::style_dark::STATE" of type GtkColorValue
"GtkWidget::style_mid::STATE" of type GtkColorValue
"GtkWidget::style_text::STATE" of type GtkColorValue
"GtkWidget::style_base::STATE" of type GtkColorValue
"GtkWidget::style_black" of type GtkColorValue
"GtkWidget::style_white" of type GtkColorValue
"GtkWidget::style_font" of type GtkFontName
STATE is an enum value from GtkStateType and thus may consist of
{ 0, 1, 2, 3, 4, GTK_STATE_NORMAL, GTK_STATE_ACTIVE, GTK_STATE_PRELIGHT,
GTK_STATE_SELECTED, GTK_STATE_INSENSITIVE, normal, active, prelight,
selected, insensitive }
GtkColorValue is an new type derived from GTK_TYPE_UINT and will consist
of #oobbggrr, where oo stands for the opacity (opacity isn't really used
by the styles, but this would also be the correct type to be returned
from GtkColorSelection).
GtkFontName is a new type derived from GTK_TYPE_STRING (similar to
GTK_TYPE_IDENTIFIER) describing the fontname.
to get the STATE -> GtkStateType mapping working, GtkArgInfo will gain
a new member GtkType name_parameter_type; indicating what the third
part of an argument name may consist of (we need this anyways for
the "GtkObject::*signal::" arguments which take a signal name as
third parameter). the name_parameter_type can be queried through an
extended query_args interface, e.g. gtk_object_query_args_extended or _full).
besides the advantage that GUI builders would gain from the style args, this
interface would also come in handy for language bindings and even C code,
where one can then easily change a widgets appearance through
button =
gtk_widget_new (GTK_TYPE_ENTRY,
"visible", TRUE,
"style_fg::normal", 0xffff00 /* yellow */,
"style_base::normal", 0xff00ff /* purple */,
"style_fg::selected", 0x000000 /* black */,
"style_base::normal", 0xffffff /* white */,
"style_font", "-freefont-brushstroke-*-*-*-*-*-*-*-*-*-*-*-*",
NULL);
without going through all the hassle of copying and attaching new styles
(especially in language bindings).
the actuall code requirements to implement this in gtk (name_parameter_type
needs to be done anyways) is pretty small, and imho the advantages we gain
are more than worth it.
commentaries are welcome.
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]