mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-23 20:30:15 +00:00
we make an active server grab now, this way we can change the cursor
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org> * gtk/gtktipsquery.c: we make an active server grab now, this way we can change the cursor globally and don't need to tweak event masks of other windows. * gtk/gtkframe.c (gtk_frame_style_set): recompute label size. * gtk/gtkwidget.h: * gtk/gtkwidget.c: New signal GtkWidget::style_set to be emitted when a widget's style changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has been perfomed for the widget. (gtk_widget_ensure_style): New function. (gtk_widget_set_rc_style): New function. * docs/styles.txt: new file.
This commit is contained in:
parent
a36ffb12a5
commit
693fa02b83
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gtk/gtktipsquery.c: we make an active server grab now, this way we
|
||||
can change the cursor globally and don't need to tweak event masks
|
||||
of other windows.
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_style_set): recompute label size.
|
||||
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c:
|
||||
New signal GtkWidget::style_set to be emitted when a widget's style
|
||||
changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has
|
||||
been perfomed for the widget.
|
||||
(gtk_widget_ensure_style): New function.
|
||||
(gtk_widget_set_rc_style): New function.
|
||||
|
||||
* docs/styles.txt: new file.
|
||||
|
||||
Fri Feb 27 01:11:55 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c
|
||||
|
@ -1,3 +1,21 @@
|
||||
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gtk/gtktipsquery.c: we make an active server grab now, this way we
|
||||
can change the cursor globally and don't need to tweak event masks
|
||||
of other windows.
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_style_set): recompute label size.
|
||||
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c:
|
||||
New signal GtkWidget::style_set to be emitted when a widget's style
|
||||
changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has
|
||||
been perfomed for the widget.
|
||||
(gtk_widget_ensure_style): New function.
|
||||
(gtk_widget_set_rc_style): New function.
|
||||
|
||||
* docs/styles.txt: new file.
|
||||
|
||||
Fri Feb 27 01:11:55 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c
|
||||
|
@ -1,3 +1,21 @@
|
||||
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gtk/gtktipsquery.c: we make an active server grab now, this way we
|
||||
can change the cursor globally and don't need to tweak event masks
|
||||
of other windows.
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_style_set): recompute label size.
|
||||
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c:
|
||||
New signal GtkWidget::style_set to be emitted when a widget's style
|
||||
changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has
|
||||
been perfomed for the widget.
|
||||
(gtk_widget_ensure_style): New function.
|
||||
(gtk_widget_set_rc_style): New function.
|
||||
|
||||
* docs/styles.txt: new file.
|
||||
|
||||
Fri Feb 27 01:11:55 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c
|
||||
|
@ -1,3 +1,21 @@
|
||||
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gtk/gtktipsquery.c: we make an active server grab now, this way we
|
||||
can change the cursor globally and don't need to tweak event masks
|
||||
of other windows.
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_style_set): recompute label size.
|
||||
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c:
|
||||
New signal GtkWidget::style_set to be emitted when a widget's style
|
||||
changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has
|
||||
been perfomed for the widget.
|
||||
(gtk_widget_ensure_style): New function.
|
||||
(gtk_widget_set_rc_style): New function.
|
||||
|
||||
* docs/styles.txt: new file.
|
||||
|
||||
Fri Feb 27 01:11:55 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c
|
||||
|
@ -1,3 +1,21 @@
|
||||
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gtk/gtktipsquery.c: we make an active server grab now, this way we
|
||||
can change the cursor globally and don't need to tweak event masks
|
||||
of other windows.
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_style_set): recompute label size.
|
||||
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c:
|
||||
New signal GtkWidget::style_set to be emitted when a widget's style
|
||||
changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has
|
||||
been perfomed for the widget.
|
||||
(gtk_widget_ensure_style): New function.
|
||||
(gtk_widget_set_rc_style): New function.
|
||||
|
||||
* docs/styles.txt: new file.
|
||||
|
||||
Fri Feb 27 01:11:55 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c
|
||||
|
@ -1,3 +1,21 @@
|
||||
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gtk/gtktipsquery.c: we make an active server grab now, this way we
|
||||
can change the cursor globally and don't need to tweak event masks
|
||||
of other windows.
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_style_set): recompute label size.
|
||||
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c:
|
||||
New signal GtkWidget::style_set to be emitted when a widget's style
|
||||
changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has
|
||||
been perfomed for the widget.
|
||||
(gtk_widget_ensure_style): New function.
|
||||
(gtk_widget_set_rc_style): New function.
|
||||
|
||||
* docs/styles.txt: new file.
|
||||
|
||||
Fri Feb 27 01:11:55 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c
|
||||
|
@ -1,3 +1,21 @@
|
||||
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gtk/gtktipsquery.c: we make an active server grab now, this way we
|
||||
can change the cursor globally and don't need to tweak event masks
|
||||
of other windows.
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_style_set): recompute label size.
|
||||
|
||||
* gtk/gtkwidget.h:
|
||||
* gtk/gtkwidget.c:
|
||||
New signal GtkWidget::style_set to be emitted when a widget's style
|
||||
changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has
|
||||
been perfomed for the widget.
|
||||
(gtk_widget_ensure_style): New function.
|
||||
(gtk_widget_set_rc_style): New function.
|
||||
|
||||
* docs/styles.txt: new file.
|
||||
|
||||
Fri Feb 27 01:11:55 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c
|
||||
|
12
TODO
12
TODO
@ -4,6 +4,8 @@ TODO BEFORE GTK 1.0
|
||||
Bugs:
|
||||
* gtk_list_clear_items: free start_list
|
||||
|
||||
* GtkComboBox: need to destroy gdk cursor
|
||||
|
||||
* Vertical scrollbar: the expose event looks hosed and is causing
|
||||
quite a bit of flickering
|
||||
|
||||
@ -60,6 +62,12 @@ Bugs:
|
||||
-timj
|
||||
|
||||
Additions:
|
||||
* it might be good to ues stdio and getch() instead of 1-character reads.
|
||||
so one can take advantage of buffering. Currently each read() takes a separate
|
||||
syscall.
|
||||
|
||||
* implement gtk_default_draw_oval
|
||||
|
||||
* Lists should scroll to center the recently selected item if it isn't
|
||||
visible.
|
||||
|
||||
@ -74,7 +82,9 @@ Additions:
|
||||
|
||||
* Make widget attributes configurable after the widget is created (timj).
|
||||
|
||||
* Implementation of owens widget style proposal.
|
||||
* Change gtk_widget_propagate_default_style() mechanism to
|
||||
void gtk_rc_string_export (const gchar *rc_additions,
|
||||
gboolean override_rc_styles);
|
||||
|
||||
|
||||
TODO AFTER GTK 1.0
|
||||
|
@ -11,6 +11,7 @@ EXTRA_DIST = \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt
|
||||
|
||||
|
95
docs/styles.txt
Normal file
95
docs/styles.txt
Normal file
@ -0,0 +1,95 @@
|
||||
HANDLING WIDGET STYLES
|
||||
======================
|
||||
|
||||
|
||||
A widget gets created with a default style.
|
||||
The global default style can be affected by gtk_widget_set_default_style()
|
||||
and can be queried by gtk_widget_get_default_style().
|
||||
The initial style that is assigned to a widget as default style upon
|
||||
creation can be affected by wrapping the widget's creation as follows:
|
||||
gtk_widget_push_style (my_style);
|
||||
widget = gtk_type_new (gtk_button_get_type ());
|
||||
gtk_widget_pop_style ();
|
||||
|
||||
There are certain functions to affect widget styles after a widget's
|
||||
creation:
|
||||
|
||||
gtk_widget_set_style ()
|
||||
Save the default style and set a user style.
|
||||
This will override a previously set user style or
|
||||
previously set rc styles.
|
||||
|
||||
gtk_widget_set_rc_style ()
|
||||
Set GTK_RC_STYLE to indicate that an rc lookup has been performed.
|
||||
If there is an rc style for a widget, set it and save the default style,
|
||||
restore the default style otherwise.
|
||||
This will override a previously set user style or rc style.
|
||||
|
||||
gtk_widget_ensure_style ()
|
||||
Ensure taht the widget either has a user style set, or an rc lookup
|
||||
has been performed.
|
||||
|
||||
gtk_rc_get_style ()
|
||||
Return an rc style for a widget if there is one.
|
||||
|
||||
gtk_widget_set_name ()
|
||||
Change widget name, and perform a new rc lookup if no user style
|
||||
is set.
|
||||
|
||||
gtk_widget_realize ()
|
||||
Besides realizing the widget this function will:
|
||||
- perform an rc lookup if neccessary,
|
||||
- attach a widget's style.
|
||||
|
||||
gtk_widget_get_style ()
|
||||
Return a widgets style, this function will perform an rc lookup
|
||||
if neccessary.
|
||||
|
||||
gtk_widget_set_parent ()
|
||||
This function will perform rc lookups recursively for all widgets
|
||||
that do not have a user style set.
|
||||
|
||||
gtk_style_copy ()
|
||||
This function can be used to copy a widgets style.
|
||||
The style can subsequntly be changed (e.g., by modifications to the
|
||||
red/green/blue values of a certain color) and then be applied to the
|
||||
widget via gtk_widget_set_style().
|
||||
|
||||
|
||||
GtkWidget::style_set
|
||||
This signal will be emitted for a widget once its style changes with
|
||||
the previous style supplied.
|
||||
the GtkWidgetClass implements a default handler for this signal that
|
||||
will set the widget's window's background of widgets that provide their
|
||||
own windows according to the new style.
|
||||
Derived widgets need to overide this default handler, if:
|
||||
- their size requisition depends on the current style.
|
||||
(e.g., on the style's fonts)
|
||||
- they set the background of widget->window to something other than.
|
||||
style->bg. (e.g., GtkListItem)
|
||||
- the widget provides windows other than widget->window.
|
||||
- the widget has any other stored dependencies on the style.
|
||||
|
||||
|
||||
|
||||
Flag indications:
|
||||
|
||||
!GTK_RC_STYLE && !GTK_USER_STYLE:
|
||||
The widget has it's default style set, and no rc lookup has been
|
||||
performed.
|
||||
|
||||
GTK_USER_STYLE:
|
||||
GTK_RC_STYLE is not set.
|
||||
The widget has a user style assigned, and it's default style has been
|
||||
saved.
|
||||
|
||||
GTK_RC_STYLE:
|
||||
GTK_USER_STYLE is not set.
|
||||
If the widget has a saved default style, it has been assigned an
|
||||
rc style.
|
||||
If the widget does not have a saved default style, it still has its
|
||||
default style but an rc lookup has already been performed.
|
||||
|
||||
|
||||
- Tim Janik <timj@gimp.org>
|
||||
1998/02/27
|
@ -46,6 +46,8 @@ static void gtk_frame_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_frame_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_frame_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
|
||||
|
||||
static GtkBinClass *parent_class = NULL;
|
||||
@ -97,6 +99,7 @@ gtk_frame_class_init (GtkFrameClass *class)
|
||||
widget_class->expose_event = gtk_frame_expose;
|
||||
widget_class->size_request = gtk_frame_size_request;
|
||||
widget_class->size_allocate = gtk_frame_size_allocate;
|
||||
widget_class->style_set = gtk_frame_style_set;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -174,6 +177,25 @@ gtk_frame_new (const gchar *label)
|
||||
return GTK_WIDGET (frame);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_frame_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
{
|
||||
GtkFrame *frame;
|
||||
|
||||
frame = GTK_FRAME (widget);
|
||||
|
||||
if (frame->label)
|
||||
{
|
||||
frame->label_width = gdk_string_measure (GTK_WIDGET (frame)->style->font, frame->label) + 7;
|
||||
frame->label_height = (GTK_WIDGET (frame)->style->font->ascent +
|
||||
GTK_WIDGET (frame)->style->font->descent + 1);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
||||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_frame_set_label (GtkFrame *frame,
|
||||
const gchar *label)
|
||||
|
@ -153,7 +153,7 @@ static GScannerConfig gtk_rc_scanner_config =
|
||||
TRUE /* scan_float */,
|
||||
TRUE /* scan_hex */,
|
||||
TRUE /* scan_hex_dollar */,
|
||||
FALSE /* scan_string_sq */,
|
||||
TRUE /* scan_string_sq */,
|
||||
TRUE /* scan_string_dq */,
|
||||
TRUE /* numbers_2_int */,
|
||||
FALSE /* int_2_float */,
|
||||
@ -266,7 +266,7 @@ gtk_rc_get_style (GtkWidget *widget)
|
||||
}
|
||||
}
|
||||
|
||||
return widget->style;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -158,6 +158,31 @@ static GSList *unattached_styles = NULL;
|
||||
|
||||
static GMemChunk *key_mem_chunk = NULL;
|
||||
|
||||
GtkStyle*
|
||||
gtk_style_copy (GtkStyle *style)
|
||||
{
|
||||
GtkStyle *new_style;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (style != NULL, NULL);
|
||||
|
||||
new_style = gtk_style_new ();
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
new_style->fg[i] = style->fg[i];
|
||||
new_style->bg[i] = style->bg[i];
|
||||
new_style->text[i] = style->text[i];
|
||||
new_style->base[i] = style->base[i];
|
||||
|
||||
new_style->bg_pixmap[i] = style->bg_pixmap[i];
|
||||
}
|
||||
|
||||
new_style->font = style->font;
|
||||
gdk_font_ref (new_style->font);
|
||||
|
||||
return new_style;
|
||||
}
|
||||
|
||||
GtkStyle*
|
||||
gtk_style_new ()
|
||||
|
147
gtk/gtkstyle.h
147
gtk/gtkstyle.h
@ -8,7 +8,7 @@
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
@ -35,6 +35,8 @@ typedef struct _GtkStyleClass GtkStyleClass;
|
||||
/* fg, bg, light, dark, mid, text, base */
|
||||
#define GTK_STYLE_NUM_STYLECOLORS() 7*5
|
||||
|
||||
#define GTK_STYLE_ATTACHED(style) (((GtkStyle*)(style))->attach_count > 0)
|
||||
|
||||
struct _GtkStyle
|
||||
{
|
||||
GdkColor fg[5];
|
||||
@ -78,134 +80,135 @@ struct _GtkStyleClass
|
||||
void (*draw_hline) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
gint x1,
|
||||
gint x2,
|
||||
gint y);
|
||||
gint x1,
|
||||
gint x2,
|
||||
gint y);
|
||||
void (*draw_vline) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
gint y1,
|
||||
gint y2,
|
||||
gint x);
|
||||
gint y1,
|
||||
gint y2,
|
||||
gint x);
|
||||
void (*draw_shadow) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void (*draw_polygon) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
GdkPoint *point,
|
||||
gint npoints,
|
||||
gint fill);
|
||||
gint npoints,
|
||||
gint fill);
|
||||
void (*draw_arrow) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
GtkArrowType arrow_type,
|
||||
gint fill,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
gint fill,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void (*draw_diamond) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void (*draw_oval) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void (*draw_string) (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint x,
|
||||
gint y,
|
||||
const gchar *string);
|
||||
};
|
||||
|
||||
|
||||
GtkStyle* gtk_style_new (void);
|
||||
GtkStyle* gtk_style_attach (GtkStyle *style,
|
||||
GdkWindow *window);
|
||||
void gtk_style_detach (GtkStyle *style);
|
||||
GtkStyle *gtk_style_ref (GtkStyle *style);
|
||||
void gtk_style_unref (GtkStyle *style);
|
||||
void gtk_style_set_background (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStyle* gtk_style_new (void);
|
||||
GtkStyle* gtk_style_copy (GtkStyle *style);
|
||||
GtkStyle* gtk_style_attach (GtkStyle *style,
|
||||
GdkWindow *window);
|
||||
void gtk_style_detach (GtkStyle *style);
|
||||
GtkStyle* gtk_style_ref (GtkStyle *style);
|
||||
void gtk_style_unref (GtkStyle *style);
|
||||
void gtk_style_set_background (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type);
|
||||
|
||||
|
||||
void gtk_draw_hline (GtkStyle *style,
|
||||
void gtk_draw_hline (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
gint x1,
|
||||
gint x2,
|
||||
gint y);
|
||||
void gtk_draw_vline (GtkStyle *style,
|
||||
gint x1,
|
||||
gint x2,
|
||||
gint y);
|
||||
void gtk_draw_vline (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
gint y1,
|
||||
gint y2,
|
||||
gint x);
|
||||
void gtk_draw_shadow (GtkStyle *style,
|
||||
gint y1,
|
||||
gint y2,
|
||||
gint x);
|
||||
void gtk_draw_shadow (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_polygon (GtkStyle *style,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_polygon (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
GdkPoint *points,
|
||||
gint npoints,
|
||||
gint fill);
|
||||
void gtk_draw_arrow (GtkStyle *style,
|
||||
GdkPoint *points,
|
||||
gint npoints,
|
||||
gint fill);
|
||||
void gtk_draw_arrow (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
GtkArrowType arrow_type,
|
||||
gint fill,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_diamond (GtkStyle *style,
|
||||
gint fill,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_diamond (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_oval (GtkStyle *style,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_oval (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
GtkShadowType shadow_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_string (GtkStyle *style,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_draw_string (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state_type,
|
||||
gint x,
|
||||
gint y,
|
||||
gint x,
|
||||
gint y,
|
||||
const gchar *string);
|
||||
|
||||
|
||||
|
@ -67,6 +67,8 @@
|
||||
#define LAST_INDEX(t, m) ((m).index == TEXT_LENGTH(t))
|
||||
#define CACHE_DATA(c) (*(LineParams*)(c)->data)
|
||||
|
||||
#define GTK_TEXT_INDEX(t, index) ((index) < (t)->gap_position ? (t)->text[index] : \
|
||||
(t)->text[(index) + (t)->gap_size])
|
||||
|
||||
typedef struct _TextFont TextFont;
|
||||
typedef struct _TextProperty TextProperty;
|
||||
|
@ -82,7 +82,6 @@ static void gtk_tips_query_widget_entered (GtkTipsQuery *tips_query,
|
||||
/* --- variables --- */
|
||||
static GtkLabelClass *parent_class = NULL;
|
||||
static gint tips_query_signals[SIGNAL_LAST] = { 0 };
|
||||
static const gchar *key_event_mask = "gtk-tips-query-saved-event-mask";
|
||||
|
||||
|
||||
/* --- functions --- */
|
||||
@ -215,7 +214,7 @@ gtk_tips_query_init (GtkTipsQuery *tips_query)
|
||||
tips_query->label_no_tip = g_strdup ("--- No Tip ---");
|
||||
tips_query->caller = NULL;
|
||||
tips_query->last_crossed = NULL;
|
||||
tips_query->event_restore_list = NULL;
|
||||
tips_query->query_cursor = NULL;
|
||||
|
||||
gtk_label_set (GTK_LABEL (tips_query), tips_query->label_inactive);
|
||||
}
|
||||
@ -344,6 +343,7 @@ gtk_tips_query_start_query (GtkTipsQuery *tips_query)
|
||||
g_return_if_fail (tips_query != NULL);
|
||||
g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
|
||||
g_return_if_fail (tips_query->in_query == FALSE);
|
||||
g_return_if_fail (GTK_WIDGET_REALIZED (tips_query));
|
||||
|
||||
tips_query->in_query = TRUE;
|
||||
gtk_signal_emit (GTK_OBJECT (tips_query), tips_query_signals[SIGNAL_START_QUERY]);
|
||||
@ -360,51 +360,49 @@ gtk_tips_query_stop_query (GtkTipsQuery *tips_query)
|
||||
tips_query->in_query = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_tips_query_real_start_query (GtkTipsQuery *tips_query)
|
||||
{
|
||||
gint failure;
|
||||
|
||||
g_return_if_fail (tips_query != NULL);
|
||||
g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
|
||||
|
||||
|
||||
tips_query->query_cursor = gdk_cursor_new (GDK_QUESTION_ARROW);
|
||||
failure = gdk_pointer_grab (GTK_WIDGET (tips_query)->window,
|
||||
TRUE,
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK,
|
||||
NULL,
|
||||
tips_query->query_cursor,
|
||||
GDK_CURRENT_TIME);
|
||||
if (failure)
|
||||
{
|
||||
gdk_cursor_destroy (tips_query->query_cursor);
|
||||
tips_query->query_cursor = NULL;
|
||||
}
|
||||
gtk_grab_add (GTK_WIDGET (tips_query));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_tips_query_real_stop_query (GtkTipsQuery *tips_query)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
g_return_if_fail (tips_query != NULL);
|
||||
g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
|
||||
|
||||
gtk_grab_remove (GTK_WIDGET (tips_query));
|
||||
if (tips_query->query_cursor)
|
||||
{
|
||||
gdk_pointer_ungrab (GDK_CURRENT_TIME);
|
||||
gdk_cursor_destroy (tips_query->query_cursor);
|
||||
tips_query->query_cursor = NULL;
|
||||
}
|
||||
if (tips_query->last_crossed)
|
||||
{
|
||||
gtk_widget_unref (tips_query->last_crossed);
|
||||
tips_query->last_crossed = NULL;
|
||||
}
|
||||
|
||||
list = tips_query->event_restore_list;
|
||||
while (list)
|
||||
{
|
||||
GtkWidget *win_widget;
|
||||
GdkEventMask *event_mask;
|
||||
|
||||
win_widget = list->data;
|
||||
event_mask = gtk_object_get_data (GTK_OBJECT (win_widget), key_event_mask);
|
||||
if (event_mask)
|
||||
{
|
||||
gtk_object_remove_data (GTK_OBJECT (win_widget), key_event_mask);
|
||||
if (GTK_WIDGET_REALIZED (win_widget))
|
||||
gdk_window_set_events (win_widget->window, *event_mask);
|
||||
g_free (event_mask);
|
||||
}
|
||||
gtk_widget_unref (win_widget);
|
||||
list = list->next;
|
||||
}
|
||||
g_slist_free (tips_query->event_restore_list);
|
||||
tips_query->event_restore_list = NULL;
|
||||
|
||||
gtk_label_set (GTK_LABEL (tips_query), tips_query->label_inactive);
|
||||
}
|
||||
|
||||
@ -488,7 +486,6 @@ gtk_tips_query_event (GtkWidget *widget,
|
||||
event_handled = FALSE;
|
||||
switch (event->type)
|
||||
{
|
||||
GdkEventMask *event_mask;
|
||||
GdkWindow *pointer_window;
|
||||
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
@ -499,27 +496,11 @@ gtk_tips_query_event (GtkWidget *widget,
|
||||
event_widget = NULL;
|
||||
if (pointer_window)
|
||||
gdk_window_get_user_data (pointer_window, (gpointer*) &event_widget);
|
||||
/* fall through */
|
||||
gtk_tips_query_emit_widget_entered (tips_query, event_widget);
|
||||
event_handled = TRUE;
|
||||
break;
|
||||
|
||||
case GDK_ENTER_NOTIFY:
|
||||
if (event_widget)
|
||||
{
|
||||
event_mask = gtk_object_get_data (GTK_OBJECT (event_widget), key_event_mask);
|
||||
if (!event_mask)
|
||||
{
|
||||
event_mask = g_new (GdkEventMask, 1);
|
||||
*event_mask = gdk_window_get_events (event_widget->window);
|
||||
gtk_object_set_data (GTK_OBJECT (event_widget), key_event_mask, event_mask);
|
||||
gdk_window_set_events (event_widget->window,
|
||||
*event_mask |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK);
|
||||
tips_query->event_restore_list =
|
||||
g_slist_prepend (tips_query->event_restore_list, event_widget);
|
||||
gtk_widget_ref (event_widget);
|
||||
}
|
||||
}
|
||||
gtk_tips_query_emit_widget_entered (tips_query, event_widget);
|
||||
event_handled = TRUE;
|
||||
break;
|
||||
|
@ -54,7 +54,8 @@ struct _GtkTipsQuery
|
||||
|
||||
GtkWidget *caller;
|
||||
GtkWidget *last_crossed;
|
||||
GSList *event_restore_list;
|
||||
|
||||
GdkCursor *query_cursor;
|
||||
};
|
||||
|
||||
struct _GtkTipsQueryClass
|
||||
|
514
gtk/gtkwidget.c
514
gtk/gtkwidget.c
@ -123,6 +123,9 @@ typedef void (*GtkWidgetSignal5) (GtkObject *object,
|
||||
typedef void (*GtkWidgetSignal6) (GtkObject *object,
|
||||
GtkObject *arg1,
|
||||
gpointer data);
|
||||
typedef void (*GtkWidgetSignal7) (GtkObject *object,
|
||||
gpointer *arg1,
|
||||
gpointer data);
|
||||
|
||||
typedef struct _GtkStateData GtkStateData;
|
||||
|
||||
@ -157,6 +160,10 @@ static void gtk_widget_marshal_signal_6 (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg *args);
|
||||
static void gtk_widget_marshal_signal_7 (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg *args);
|
||||
|
||||
static void gtk_widget_class_init (GtkWidgetClass *klass);
|
||||
static void gtk_widget_init (GtkWidget *widget);
|
||||
@ -179,7 +186,9 @@ static void gtk_widget_real_draw (GtkWidget *widget,
|
||||
static gint gtk_widget_real_queue_draw (GtkWidget *widget);
|
||||
static void gtk_widget_real_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
static void gtk_widget_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
|
||||
static GdkColormap* gtk_widget_peek_colormap (void);
|
||||
static GdkVisual* gtk_widget_peek_visual (void);
|
||||
static GtkStyle* gtk_widget_peek_style (void);
|
||||
@ -225,6 +234,7 @@ static const gchar *event_key = "gtk-event-mask";
|
||||
static const gchar *extension_event_key = "gtk-extension-event-mode";
|
||||
static const gchar *parent_window_key = "gtk-parent-window";
|
||||
static const gchar *shape_info_key = "gtk-shape-info";
|
||||
static const gchar *saved_default_style = "gtk-saved-default-style";
|
||||
|
||||
|
||||
|
||||
@ -394,7 +404,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkWidgetClass, style_set),
|
||||
gtk_widget_marshal_signal_4,
|
||||
gtk_widget_marshal_signal_7,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_BOXED);
|
||||
widget_signals[INSTALL_ACCELERATOR] =
|
||||
@ -685,7 +695,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
klass->size_allocate = gtk_widget_real_size_allocate;
|
||||
klass->state_changed = NULL;
|
||||
klass->parent_set = NULL;
|
||||
klass->style_set = NULL;
|
||||
klass->style_set = gtk_widget_style_set;
|
||||
klass->install_accelerator = NULL;
|
||||
klass->remove_accelerator = NULL;
|
||||
klass->event = NULL;
|
||||
@ -1330,7 +1340,6 @@ gtk_widget_unmap (GtkWidget *widget)
|
||||
void
|
||||
gtk_widget_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkStyle *new_style;
|
||||
gint events;
|
||||
GdkExtensionMode mode;
|
||||
GtkWidgetShapeInfo *shape_info;
|
||||
@ -1346,13 +1355,8 @@ gtk_widget_realize (GtkWidget *widget)
|
||||
|
||||
if (widget->parent && !GTK_WIDGET_REALIZED (widget->parent))
|
||||
gtk_widget_realize (widget->parent);
|
||||
|
||||
if (!GTK_WIDGET_USER_STYLE (widget))
|
||||
{
|
||||
new_style = gtk_rc_get_style (widget);
|
||||
if (new_style != widget->style)
|
||||
gtk_widget_set_style_internal (widget, new_style);
|
||||
}
|
||||
|
||||
gtk_widget_ensure_style (widget);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[REALIZE]);
|
||||
|
||||
@ -2162,19 +2166,14 @@ void
|
||||
gtk_widget_set_name (GtkWidget *widget,
|
||||
const gchar *name)
|
||||
{
|
||||
GtkStyle *new_style;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
|
||||
if (widget->name)
|
||||
g_free (widget->name);
|
||||
widget->name = g_strdup (name);
|
||||
|
||||
|
||||
if (!GTK_WIDGET_USER_STYLE (widget))
|
||||
{
|
||||
new_style = gtk_rc_get_style (widget);
|
||||
gtk_widget_set_style_internal (widget, new_style);
|
||||
}
|
||||
gtk_widget_set_rc_style (widget);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
@ -2291,7 +2290,6 @@ void
|
||||
gtk_widget_set_parent (GtkWidget *widget,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkStateData data;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
@ -2319,13 +2317,8 @@ gtk_widget_set_parent (GtkWidget *widget,
|
||||
|
||||
if (GTK_WIDGET_TOPLEVEL (parent))
|
||||
{
|
||||
if (!GTK_WIDGET_USER_STYLE (widget))
|
||||
{
|
||||
style = gtk_rc_get_style (widget);
|
||||
if (style != widget->style)
|
||||
gtk_widget_set_style_internal (widget, style);
|
||||
}
|
||||
|
||||
gtk_widget_ensure_style (widget);
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
gtk_container_foreach (GTK_CONTAINER (widget),
|
||||
gtk_widget_set_style_recurse,
|
||||
@ -2335,6 +2328,226 @@ gtk_widget_set_parent (GtkWidget *widget,
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* Widget styles
|
||||
* see docs/styles.txt
|
||||
*****************************************/
|
||||
void
|
||||
gtk_widget_set_style (GtkWidget *widget,
|
||||
GtkStyle *style)
|
||||
{
|
||||
GtkStyle *default_style;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (style != NULL);
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
|
||||
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
|
||||
|
||||
default_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style);
|
||||
if (!default_style)
|
||||
{
|
||||
gtk_style_ref (widget->style);
|
||||
gtk_object_set_data (GTK_OBJECT (widget), saved_default_style, widget->style);
|
||||
}
|
||||
|
||||
gtk_widget_set_style_internal (widget, style);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_ensure_style (GtkWidget *widget)
|
||||
{
|
||||
if (!GTK_WIDGET_USER_STYLE (widget) &&
|
||||
!GTK_WIDGET_RC_STYLE (widget))
|
||||
gtk_widget_set_rc_style (widget);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_set_rc_style (GtkWidget *widget)
|
||||
{
|
||||
GtkStyle *saved_style;
|
||||
GtkStyle *new_style;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
|
||||
GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE);
|
||||
|
||||
saved_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style);
|
||||
new_style = gtk_rc_get_style (widget);
|
||||
if (new_style)
|
||||
{
|
||||
if (!saved_style)
|
||||
{
|
||||
gtk_style_ref (widget->style);
|
||||
gtk_object_set_data (GTK_OBJECT (widget), saved_default_style, widget->style);
|
||||
}
|
||||
gtk_widget_set_style_internal (widget, new_style);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (saved_style)
|
||||
{
|
||||
gtk_object_remove_data (GTK_OBJECT (widget), saved_default_style);
|
||||
gtk_widget_set_style_internal (widget, saved_style);
|
||||
gtk_style_unref (saved_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GtkStyle*
|
||||
gtk_widget_get_style (GtkWidget *widget)
|
||||
{
|
||||
g_return_val_if_fail (widget != NULL, NULL);
|
||||
|
||||
return widget->style;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
{
|
||||
if (GTK_WIDGET_REALIZED (widget) &&
|
||||
!GTK_WIDGET_NO_WINDOW (widget))
|
||||
gtk_style_set_background (widget->style, widget->window, widget->state);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_set_style_internal (GtkWidget *widget,
|
||||
GtkStyle *style)
|
||||
{
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (style != NULL);
|
||||
|
||||
if (widget->style != style)
|
||||
{
|
||||
GtkStyle *previous_style;
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
gtk_style_detach (widget->style);
|
||||
|
||||
previous_style = widget->style;
|
||||
widget->style = style;
|
||||
gtk_style_ref (widget->style);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[STYLE_SET], previous_style);
|
||||
gtk_style_unref (previous_style);
|
||||
|
||||
if (widget->parent)
|
||||
{
|
||||
GtkRequisition old_requisition;
|
||||
|
||||
old_requisition = widget->requisition;
|
||||
gtk_widget_size_request (widget, &widget->requisition);
|
||||
|
||||
if ((old_requisition.width != widget->requisition.width) ||
|
||||
(old_requisition.height != widget->requisition.height))
|
||||
gtk_widget_queue_resize (widget);
|
||||
else if (GTK_WIDGET_DRAWABLE (widget))
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_set_style_recurse (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
if (!GTK_WIDGET_USER_STYLE (widget))
|
||||
gtk_widget_set_rc_style (widget);
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
gtk_container_foreach (GTK_CONTAINER (widget),
|
||||
gtk_widget_set_style_recurse,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_set_default_style (GtkStyle *style)
|
||||
{
|
||||
if (style != default_style)
|
||||
{
|
||||
if (default_style)
|
||||
gtk_style_unref (default_style);
|
||||
default_style = style;
|
||||
if (default_style)
|
||||
gtk_style_ref (default_style);
|
||||
}
|
||||
}
|
||||
|
||||
GtkStyle*
|
||||
gtk_widget_get_default_style ()
|
||||
{
|
||||
if (!default_style)
|
||||
{
|
||||
default_style = gtk_style_new ();
|
||||
gtk_style_ref (default_style);
|
||||
}
|
||||
|
||||
return default_style;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_push_style (GtkStyle *style)
|
||||
{
|
||||
g_return_if_fail (style != NULL);
|
||||
|
||||
gtk_style_ref (style);
|
||||
style_stack = g_slist_prepend (style_stack, style);
|
||||
}
|
||||
|
||||
static GtkStyle*
|
||||
gtk_widget_peek_style ()
|
||||
{
|
||||
if (style_stack)
|
||||
return (GtkStyle*) style_stack->data;
|
||||
else
|
||||
return gtk_widget_get_default_style ();
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_pop_style ()
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
if (style_stack)
|
||||
{
|
||||
tmp = style_stack;
|
||||
style_stack = style_stack->next;
|
||||
gtk_style_unref ((GtkStyle*) tmp->data);
|
||||
g_slist_free_1 (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Basically, send a message to all toplevel windows telling them
|
||||
* that a new _GTK_STYLE_COLORS property is available on the root
|
||||
* window
|
||||
*/
|
||||
void
|
||||
gtk_widget_propagate_default_style (void)
|
||||
{
|
||||
GdkEventClient sev;
|
||||
int i;
|
||||
|
||||
/* Set the property on the root window */
|
||||
gdk_property_change(GDK_ROOT_PARENT(),
|
||||
gdk_atom_intern("_GTK_DEFAULT_COLORS", FALSE),
|
||||
gdk_atom_intern("STRING", FALSE),
|
||||
8*sizeof(gushort),
|
||||
GDK_PROP_MODE_REPLACE,
|
||||
(guchar *)gtk_widget_get_default_style(),
|
||||
GTK_STYLE_NUM_STYLECOLORS() * sizeof(GdkColor));
|
||||
|
||||
for(i = 0; i < 5; i++)
|
||||
sev.data.l[i] = 0;
|
||||
sev.data_format = 32;
|
||||
sev.message_type = gdk_atom_intern ("_GTK_STYLE_CHANGED", FALSE);
|
||||
gdk_event_send_clientmessage_toall ((GdkEvent *) &sev);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* gtk_widget_set_parent_window:
|
||||
* Set a non default parent window for widget
|
||||
@ -2394,25 +2607,6 @@ gtk_widget_get_parent_window (GtkWidget *widget)
|
||||
return (parent_window != NULL) ? parent_window : widget->parent->window;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_set_style:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
void
|
||||
gtk_widget_set_style (GtkWidget *widget,
|
||||
GtkStyle *style)
|
||||
{
|
||||
g_return_if_fail (widget != NULL);
|
||||
|
||||
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
|
||||
gtk_widget_set_style_internal (widget, style);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_set_uposition:
|
||||
*
|
||||
@ -2643,22 +2837,6 @@ gtk_widget_get_visual (GtkWidget *widget)
|
||||
return gdk_window_get_visual (widget->window);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_get_style:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
GtkStyle*
|
||||
gtk_widget_get_style (GtkWidget *widget)
|
||||
{
|
||||
g_return_val_if_fail (widget != NULL, NULL);
|
||||
|
||||
return widget->style;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_get_events:
|
||||
*
|
||||
@ -2812,23 +2990,6 @@ gtk_widget_push_visual (GdkVisual *visual)
|
||||
visual_stack = g_slist_prepend (visual_stack, visual);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_push_style:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
void
|
||||
gtk_widget_push_style (GtkStyle *style)
|
||||
{
|
||||
g_return_if_fail (style != NULL);
|
||||
|
||||
gtk_style_ref (style);
|
||||
style_stack = g_slist_prepend (style_stack, style);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_pop_colormap:
|
||||
*
|
||||
@ -2871,28 +3032,6 @@ gtk_widget_pop_visual ()
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_pop_style:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
void
|
||||
gtk_widget_pop_style ()
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
if (style_stack)
|
||||
{
|
||||
tmp = style_stack;
|
||||
style_stack = style_stack->next;
|
||||
gtk_style_unref ((GtkStyle*) tmp->data);
|
||||
g_slist_free_1 (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_set_default_colormap:
|
||||
*
|
||||
@ -2928,53 +3067,6 @@ gtk_widget_set_default_visual (GdkVisual *visual)
|
||||
default_visual = visual;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_set_default_style:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
void
|
||||
gtk_widget_set_default_style (GtkStyle *style)
|
||||
{
|
||||
if (style != default_style)
|
||||
{
|
||||
if (default_style)
|
||||
gtk_style_unref (default_style);
|
||||
default_style = style;
|
||||
if (default_style)
|
||||
gtk_style_ref (default_style);
|
||||
}
|
||||
}
|
||||
|
||||
/* Basically, send a message to all toplevel windows telling them
|
||||
* that a new _GTK_STYLE_COLORS property is available on the root
|
||||
* window
|
||||
*/
|
||||
void
|
||||
gtk_widget_propagate_default_style (void)
|
||||
{
|
||||
GdkEventClient sev;
|
||||
int i;
|
||||
|
||||
/* Set the property on the root window */
|
||||
gdk_property_change(GDK_ROOT_PARENT(),
|
||||
gdk_atom_intern("_GTK_DEFAULT_COLORS", FALSE),
|
||||
gdk_atom_intern("STRING", FALSE),
|
||||
8*sizeof(gushort),
|
||||
GDK_PROP_MODE_REPLACE,
|
||||
(guchar *)gtk_widget_get_default_style(),
|
||||
GTK_STYLE_NUM_STYLECOLORS() * sizeof(GdkColor));
|
||||
|
||||
for(i = 0; i < 5; i++)
|
||||
sev.data.l[i] = 0;
|
||||
sev.data_format = 32;
|
||||
sev.message_type = gdk_atom_intern ("_GTK_STYLE_CHANGED", FALSE);
|
||||
gdk_event_send_clientmessage_toall ((GdkEvent *) &sev);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_get_default_colormap:
|
||||
*
|
||||
@ -3009,27 +3101,6 @@ gtk_widget_get_default_visual ()
|
||||
return default_visual;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_get_default_style:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
GtkStyle*
|
||||
gtk_widget_get_default_style ()
|
||||
{
|
||||
if (!default_style)
|
||||
{
|
||||
default_style = gtk_style_new ();
|
||||
gtk_style_ref (default_style);
|
||||
}
|
||||
|
||||
return default_style;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_marshal_signal_1:
|
||||
*
|
||||
@ -3174,6 +3245,29 @@ gtk_widget_marshal_signal_6 (GtkObject *object,
|
||||
func_data);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_marshal_signal_7:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
static void
|
||||
gtk_widget_marshal_signal_7 (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg *args)
|
||||
{
|
||||
GtkWidgetSignal7 rfunc;
|
||||
|
||||
rfunc = (GtkWidgetSignal7) func;
|
||||
|
||||
(* rfunc) (object,
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
func_data);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_real_destroy (GtkObject *object)
|
||||
{
|
||||
@ -3548,22 +3642,6 @@ gtk_widget_peek_visual ()
|
||||
return gtk_widget_get_default_visual ();
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_peek_style:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
static GtkStyle*
|
||||
gtk_widget_peek_style ()
|
||||
{
|
||||
if (style_stack)
|
||||
return (GtkStyle*) style_stack->data;
|
||||
return gtk_widget_get_default_style ();
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* gtk_widget_propagate_state:
|
||||
* Propagate a change in the widgets state down the tree
|
||||
@ -3576,7 +3654,7 @@ gtk_widget_peek_style ()
|
||||
* results:
|
||||
*************************************************************/
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_widget_propagate_state (GtkWidget *widget,
|
||||
GtkStateData *data)
|
||||
{
|
||||
@ -3651,72 +3729,6 @@ gtk_widget_draw_children_recurse (GtkWidget *widget,
|
||||
gtk_widget_draw_children (widget);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_set_style_internal:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
static void
|
||||
gtk_widget_set_style_internal (GtkWidget *widget,
|
||||
GtkStyle *style)
|
||||
{
|
||||
GtkRequisition old_requisition;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
|
||||
if (widget->style != style)
|
||||
{
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
gtk_style_detach (widget->style);
|
||||
|
||||
gtk_style_unref (widget->style);
|
||||
widget->style = style;
|
||||
gtk_style_ref (widget->style);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
if (widget->parent)
|
||||
{
|
||||
old_requisition = widget->requisition;
|
||||
gtk_widget_size_request (widget, &widget->requisition);
|
||||
|
||||
if ((old_requisition.width != widget->requisition.width) ||
|
||||
(old_requisition.height != widget->requisition.height))
|
||||
gtk_widget_queue_resize (widget);
|
||||
else if (GTK_WIDGET_DRAWABLE (widget))
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_set_style_recurse:
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*****************************************/
|
||||
|
||||
static void
|
||||
gtk_widget_set_style_recurse (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GtkStyle *style;
|
||||
|
||||
style = gtk_rc_get_style (widget);
|
||||
if (style != widget->style)
|
||||
gtk_widget_set_style_internal (widget, style);
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
gtk_container_foreach (GTK_CONTAINER (widget),
|
||||
gtk_widget_set_style_recurse,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* gtk_widget_aux_info_new:
|
||||
*
|
||||
|
@ -49,7 +49,7 @@ enum
|
||||
GTK_HAS_GRAB = 1 << 15,
|
||||
GTK_BASIC = 1 << 16,
|
||||
GTK_RESERVED_3 = 1 << 17,
|
||||
GTK_STYLE_SET = 1 << 18
|
||||
GTK_RC_STYLE = 1 << 18
|
||||
};
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ enum
|
||||
#define GTK_WIDGET_HAS_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT)
|
||||
#define GTK_WIDGET_HAS_GRAB(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB)
|
||||
#define GTK_WIDGET_BASIC(wid) (GTK_WIDGET_FLAGS (wid) & GTK_BASIC)
|
||||
#define GTK_WIDGET_STYLE_SET(wid) (GTK_WIDGET_FLAGS (wid) & GTK_STYLE_SET)
|
||||
#define GTK_WIDGET_RC_STYLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE)
|
||||
|
||||
/* Macros for setting and clearing widget flags.
|
||||
*/
|
||||
@ -189,8 +189,8 @@ struct _GtkWidget
|
||||
/* The widgets name. If the widget does not have a name
|
||||
* (the name is NULL), then its name (as returned by
|
||||
* "gtk_widget_get_name") is its classes name.
|
||||
* The widget name is used to determine the style to
|
||||
* use for a widget.
|
||||
* Among other things, the widget name is used to determine
|
||||
* the style to use for a widget.
|
||||
*/
|
||||
gchar *name;
|
||||
|
||||
@ -430,8 +430,6 @@ void gtk_widget_set_parent (GtkWidget *widget,
|
||||
void gtk_widget_set_parent_window (GtkWidget *widget,
|
||||
GdkWindow *parent_window);
|
||||
GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget);
|
||||
void gtk_widget_set_style (GtkWidget *widget,
|
||||
GtkStyle *style);
|
||||
void gtk_widget_set_uposition (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y);
|
||||
@ -443,58 +441,69 @@ void gtk_widget_set_events (GtkWidget *widget,
|
||||
void gtk_widget_set_extension_events (GtkWidget *widget,
|
||||
GdkExtensionMode mode);
|
||||
|
||||
GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
|
||||
GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
|
||||
gint type);
|
||||
GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
|
||||
GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
|
||||
GtkStyle* gtk_widget_get_style (GtkWidget *widget);
|
||||
gint gtk_widget_get_events (GtkWidget *widget);
|
||||
GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
|
||||
void gtk_widget_get_pointer (GtkWidget *widget,
|
||||
gint *x,
|
||||
gint *y);
|
||||
GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
|
||||
GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
|
||||
GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
|
||||
gint type);
|
||||
GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
|
||||
GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
|
||||
gint gtk_widget_get_events (GtkWidget *widget);
|
||||
void gtk_widget_get_pointer (GtkWidget *widget,
|
||||
gint *x,
|
||||
gint *y);
|
||||
|
||||
gint gtk_widget_is_ancestor (GtkWidget *widget,
|
||||
GtkWidget *ancestor);
|
||||
gint gtk_widget_is_child (GtkWidget *widget,
|
||||
GtkWidget *child);
|
||||
gint gtk_widget_is_ancestor (GtkWidget *widget,
|
||||
GtkWidget *ancestor);
|
||||
gint gtk_widget_is_child (GtkWidget *widget,
|
||||
GtkWidget *child);
|
||||
|
||||
/* Widget styles.
|
||||
*/
|
||||
void gtk_widget_set_style (GtkWidget *widget,
|
||||
GtkStyle *style);
|
||||
void gtk_widget_set_rc_style (GtkWidget *widget);
|
||||
void gtk_widget_ensure_style (GtkWidget *widget);
|
||||
GtkStyle* gtk_widget_get_style (GtkWidget *widget);
|
||||
|
||||
/* Tell other Gtk applications to use the same default colors.
|
||||
*/
|
||||
void gtk_widget_propagate_default_style (void);
|
||||
|
||||
/* Push/pop pairs, to change default values upon a widget's creation.
|
||||
* This will override the values that got set by the
|
||||
* gtk_widget_set_default_* () functions.
|
||||
*/
|
||||
void gtk_widget_push_style (GtkStyle *style);
|
||||
void gtk_widget_push_colormap (GdkColormap *cmap);
|
||||
void gtk_widget_push_visual (GdkVisual *visual);
|
||||
void gtk_widget_push_style (GtkStyle *style);
|
||||
|
||||
void gtk_widget_pop_style (void);
|
||||
void gtk_widget_pop_colormap (void);
|
||||
void gtk_widget_pop_visual (void);
|
||||
void gtk_widget_pop_style (void);
|
||||
|
||||
/* Set certain default values to be used at widget creation time.
|
||||
*/
|
||||
void gtk_widget_set_default_style (GtkStyle *style);
|
||||
void gtk_widget_set_default_colormap (GdkColormap *colormap);
|
||||
void gtk_widget_set_default_visual (GdkVisual *visual);
|
||||
void gtk_widget_set_default_style (GtkStyle *style);
|
||||
/* Tells other Gtk applications to use the same default style */
|
||||
void gtk_widget_propagate_default_style(void);
|
||||
GtkStyle* gtk_widget_get_default_style (void);
|
||||
GdkColormap* gtk_widget_get_default_colormap (void);
|
||||
GdkVisual* gtk_widget_get_default_visual (void);
|
||||
GtkStyle* gtk_widget_get_default_style (void);
|
||||
|
||||
/*
|
||||
* see gdk_window_shape_combine_mask
|
||||
/* Counterpart to gdk_window_shape_combine_mask.
|
||||
*/
|
||||
void gtk_widget_shape_combine_mask (GtkWidget *widget,
|
||||
GdkBitmap *shape_mask,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
|
||||
/*
|
||||
* When you get a drag_enter event, you can use this to tell Gtk of other
|
||||
/* When you get a drag_enter event, you can use this to tell Gtk of other
|
||||
* items that are to be dragged as well...
|
||||
*/
|
||||
void gtk_widget_dnd_drag_add (GtkWidget *widget);
|
||||
|
||||
/*
|
||||
* These two functions enable drag and/or drop on a widget,
|
||||
* and also let Gtk know what data types will be accepted (use MIME type
|
||||
* naming, plus tacking "URL:" on the front for link dragging)
|
||||
/* These two functions enable drag and/or drop on a widget,
|
||||
* and also let Gtk know what data types will be accepted (use MIME
|
||||
* type naming, plus tacking "URL:" on the front for link dragging)
|
||||
*/
|
||||
void gtk_widget_dnd_drag_set (GtkWidget *widget,
|
||||
guint8 drag_enable,
|
||||
@ -506,8 +515,7 @@ void gtk_widget_dnd_drop_set (GtkWidget *widget,
|
||||
guint numtypes,
|
||||
guint8 is_destructive_operation);
|
||||
|
||||
/*
|
||||
* used to reply to a DRAG_REQUEST event - if you don't want to
|
||||
/* Used to reply to a DRAG_REQUEST event - if you don't want to
|
||||
* give the data then pass in NULL for it
|
||||
*/
|
||||
void gtk_widget_dnd_data_set (GtkWidget *widget,
|
||||
|
@ -1298,7 +1298,7 @@ create_tooltips ()
|
||||
gtk_box_set_child_packing (GTK_BOX (box3), button, FALSE, FALSE, 0, GTK_PACK_START);
|
||||
gtk_tooltips_set_tip (tooltips,
|
||||
button,
|
||||
"Push this button to start the Tooltips Inspector",
|
||||
"Start the Tooltips Inspector",
|
||||
"ContextHelp/buttons/?");
|
||||
|
||||
|
||||
|
@ -33,10 +33,10 @@ style "button"
|
||||
# bg[PRELIGHT] = { 0, 0, 0.75 }
|
||||
}
|
||||
|
||||
style "main_button" = "button"
|
||||
style 'main_button' = 'button'
|
||||
{
|
||||
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
|
||||
bg[PRELIGHT] = { 0.75, 0, 0 }
|
||||
bg[PRELIGHT] = { 0, 0x00, 0.75 }
|
||||
}
|
||||
|
||||
style "toggle_button" = "button"
|
||||
@ -54,7 +54,7 @@ style "text"
|
||||
|
||||
style "ruler"
|
||||
{
|
||||
font = "-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*"
|
||||
font = '-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*'
|
||||
}
|
||||
|
||||
style "curve"
|
||||
|
@ -1298,7 +1298,7 @@ create_tooltips ()
|
||||
gtk_box_set_child_packing (GTK_BOX (box3), button, FALSE, FALSE, 0, GTK_PACK_START);
|
||||
gtk_tooltips_set_tip (tooltips,
|
||||
button,
|
||||
"Push this button to start the Tooltips Inspector",
|
||||
"Start the Tooltips Inspector",
|
||||
"ContextHelp/buttons/?");
|
||||
|
||||
|
||||
|
@ -33,10 +33,10 @@ style "button"
|
||||
# bg[PRELIGHT] = { 0, 0, 0.75 }
|
||||
}
|
||||
|
||||
style "main_button" = "button"
|
||||
style 'main_button' = 'button'
|
||||
{
|
||||
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
|
||||
bg[PRELIGHT] = { 0.75, 0, 0 }
|
||||
bg[PRELIGHT] = { 0, 0x00, 0.75 }
|
||||
}
|
||||
|
||||
style "toggle_button" = "button"
|
||||
@ -54,7 +54,7 @@ style "text"
|
||||
|
||||
style "ruler"
|
||||
{
|
||||
font = "-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*"
|
||||
font = '-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*'
|
||||
}
|
||||
|
||||
style "curve"
|
||||
|
Loading…
Reference in New Issue
Block a user