+Tue Jan 12 13:47:07 1999 Tim Janik <timj@gtk.org>
+
+ * reworked the redrawing heuristics somewhat, this fixed a bunch of
+ existing redrawing problems and majorly reduces overall redrawing needs
+ during normal operation. basically we now only queue redraws when
+ neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+ to optimize the queued portions. widgets will now upon reallocation only
+ get redrawed if their allocation has changed. upon hide/show only the
+ area allocated by the child will be queued for the parent, this has the
+ side effect that parents which change their appearance in dependance on
+ the numer of visible children have to keep track of their children's
+ visiblity and eventually fully redraw themselves. this is a minor
+ constrain with great benefits in terms of redraw reduction, and only got
+ triggered by the notebook widget.
+
+ * gtk/gtkwidget.c:
+ (gtk_widget_queue_clear): don't bother if width and height == 0.
+ (gtk_widget_queue_clear_child): new static function to queue a redraw of
+ the area obscured by a child on a parent.
+ (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+ (gtk_widget_show): queue resize on the widget before showing.
+ (gtk_widget_hide): queue resize on the widget after hiding.
+ (gtk_widget_map): queue_draw the widget after mapping.
+ (gtk_widget_unmap): queue_clear_child the widget.
+ (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+ widget's allocation changed.
+ (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+ portions.
+ (gtk_widget_real_show):
+ (gtk_widget_real_hide):
+ (gtk_widget_real_map):
+ (gtk_widget_real_unmap):
+ (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+ descendants that override these functions don't do either and we handle
+ all redrawing/resizing related stuff before or after the signal emission
+ now.
+
+ * gtk/gtkcontainer.c:
+ (gtk_container_resize_children): don't bother about redrawing anymore
+ since gtk_widget_size_allocate handles that for us now.
+
+ * gtk/gtknotebook.h:
+ * gtk/gtknotebook.c:
+ added a flag have_visible_child to indicate whether we need to draw
+ non child related portions at all, e.g. shadows etc.
+ (gtk_notebook_draw): if have_visible_child changed, do a full paint
+ instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+ gtk_style_apply_default_background which takes an extra argument
+ copy_area to determine NO_WINDOW widget pixmap copying.
+ changed callers accordingly.
+
+ * gtk/gtktogglebutton.c:
+ (gtk_toggle_size_allocate):
+ (gtk_toggle_button_expose):
+ (gtk_toggle_button_paint): avoid messing with our parent's window if
+ toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+ the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+ * gtk/check-n.xpm:
+ * gtk/check-y.xpm:
+ * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+ bg_pixmaps.
+
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
+Tue Jan 12 13:47:07 1999 Tim Janik <timj@gtk.org>
+
+ * reworked the redrawing heuristics somewhat, this fixed a bunch of
+ existing redrawing problems and majorly reduces overall redrawing needs
+ during normal operation. basically we now only queue redraws when
+ neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+ to optimize the queued portions. widgets will now upon reallocation only
+ get redrawed if their allocation has changed. upon hide/show only the
+ area allocated by the child will be queued for the parent, this has the
+ side effect that parents which change their appearance in dependance on
+ the numer of visible children have to keep track of their children's
+ visiblity and eventually fully redraw themselves. this is a minor
+ constrain with great benefits in terms of redraw reduction, and only got
+ triggered by the notebook widget.
+
+ * gtk/gtkwidget.c:
+ (gtk_widget_queue_clear): don't bother if width and height == 0.
+ (gtk_widget_queue_clear_child): new static function to queue a redraw of
+ the area obscured by a child on a parent.
+ (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+ (gtk_widget_show): queue resize on the widget before showing.
+ (gtk_widget_hide): queue resize on the widget after hiding.
+ (gtk_widget_map): queue_draw the widget after mapping.
+ (gtk_widget_unmap): queue_clear_child the widget.
+ (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+ widget's allocation changed.
+ (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+ portions.
+ (gtk_widget_real_show):
+ (gtk_widget_real_hide):
+ (gtk_widget_real_map):
+ (gtk_widget_real_unmap):
+ (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+ descendants that override these functions don't do either and we handle
+ all redrawing/resizing related stuff before or after the signal emission
+ now.
+
+ * gtk/gtkcontainer.c:
+ (gtk_container_resize_children): don't bother about redrawing anymore
+ since gtk_widget_size_allocate handles that for us now.
+
+ * gtk/gtknotebook.h:
+ * gtk/gtknotebook.c:
+ added a flag have_visible_child to indicate whether we need to draw
+ non child related portions at all, e.g. shadows etc.
+ (gtk_notebook_draw): if have_visible_child changed, do a full paint
+ instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+ gtk_style_apply_default_background which takes an extra argument
+ copy_area to determine NO_WINDOW widget pixmap copying.
+ changed callers accordingly.
+
+ * gtk/gtktogglebutton.c:
+ (gtk_toggle_size_allocate):
+ (gtk_toggle_button_expose):
+ (gtk_toggle_button_paint): avoid messing with our parent's window if
+ toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+ the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+ * gtk/check-n.xpm:
+ * gtk/check-y.xpm:
+ * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+ bg_pixmaps.
+
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
+Tue Jan 12 13:47:07 1999 Tim Janik <timj@gtk.org>
+
+ * reworked the redrawing heuristics somewhat, this fixed a bunch of
+ existing redrawing problems and majorly reduces overall redrawing needs
+ during normal operation. basically we now only queue redraws when
+ neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+ to optimize the queued portions. widgets will now upon reallocation only
+ get redrawed if their allocation has changed. upon hide/show only the
+ area allocated by the child will be queued for the parent, this has the
+ side effect that parents which change their appearance in dependance on
+ the numer of visible children have to keep track of their children's
+ visiblity and eventually fully redraw themselves. this is a minor
+ constrain with great benefits in terms of redraw reduction, and only got
+ triggered by the notebook widget.
+
+ * gtk/gtkwidget.c:
+ (gtk_widget_queue_clear): don't bother if width and height == 0.
+ (gtk_widget_queue_clear_child): new static function to queue a redraw of
+ the area obscured by a child on a parent.
+ (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+ (gtk_widget_show): queue resize on the widget before showing.
+ (gtk_widget_hide): queue resize on the widget after hiding.
+ (gtk_widget_map): queue_draw the widget after mapping.
+ (gtk_widget_unmap): queue_clear_child the widget.
+ (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+ widget's allocation changed.
+ (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+ portions.
+ (gtk_widget_real_show):
+ (gtk_widget_real_hide):
+ (gtk_widget_real_map):
+ (gtk_widget_real_unmap):
+ (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+ descendants that override these functions don't do either and we handle
+ all redrawing/resizing related stuff before or after the signal emission
+ now.
+
+ * gtk/gtkcontainer.c:
+ (gtk_container_resize_children): don't bother about redrawing anymore
+ since gtk_widget_size_allocate handles that for us now.
+
+ * gtk/gtknotebook.h:
+ * gtk/gtknotebook.c:
+ added a flag have_visible_child to indicate whether we need to draw
+ non child related portions at all, e.g. shadows etc.
+ (gtk_notebook_draw): if have_visible_child changed, do a full paint
+ instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+ gtk_style_apply_default_background which takes an extra argument
+ copy_area to determine NO_WINDOW widget pixmap copying.
+ changed callers accordingly.
+
+ * gtk/gtktogglebutton.c:
+ (gtk_toggle_size_allocate):
+ (gtk_toggle_button_expose):
+ (gtk_toggle_button_paint): avoid messing with our parent's window if
+ toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+ the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+ * gtk/check-n.xpm:
+ * gtk/check-y.xpm:
+ * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+ bg_pixmaps.
+
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
+Tue Jan 12 13:47:07 1999 Tim Janik <timj@gtk.org>
+
+ * reworked the redrawing heuristics somewhat, this fixed a bunch of
+ existing redrawing problems and majorly reduces overall redrawing needs
+ during normal operation. basically we now only queue redraws when
+ neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+ to optimize the queued portions. widgets will now upon reallocation only
+ get redrawed if their allocation has changed. upon hide/show only the
+ area allocated by the child will be queued for the parent, this has the
+ side effect that parents which change their appearance in dependance on
+ the numer of visible children have to keep track of their children's
+ visiblity and eventually fully redraw themselves. this is a minor
+ constrain with great benefits in terms of redraw reduction, and only got
+ triggered by the notebook widget.
+
+ * gtk/gtkwidget.c:
+ (gtk_widget_queue_clear): don't bother if width and height == 0.
+ (gtk_widget_queue_clear_child): new static function to queue a redraw of
+ the area obscured by a child on a parent.
+ (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+ (gtk_widget_show): queue resize on the widget before showing.
+ (gtk_widget_hide): queue resize on the widget after hiding.
+ (gtk_widget_map): queue_draw the widget after mapping.
+ (gtk_widget_unmap): queue_clear_child the widget.
+ (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+ widget's allocation changed.
+ (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+ portions.
+ (gtk_widget_real_show):
+ (gtk_widget_real_hide):
+ (gtk_widget_real_map):
+ (gtk_widget_real_unmap):
+ (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+ descendants that override these functions don't do either and we handle
+ all redrawing/resizing related stuff before or after the signal emission
+ now.
+
+ * gtk/gtkcontainer.c:
+ (gtk_container_resize_children): don't bother about redrawing anymore
+ since gtk_widget_size_allocate handles that for us now.
+
+ * gtk/gtknotebook.h:
+ * gtk/gtknotebook.c:
+ added a flag have_visible_child to indicate whether we need to draw
+ non child related portions at all, e.g. shadows etc.
+ (gtk_notebook_draw): if have_visible_child changed, do a full paint
+ instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+ gtk_style_apply_default_background which takes an extra argument
+ copy_area to determine NO_WINDOW widget pixmap copying.
+ changed callers accordingly.
+
+ * gtk/gtktogglebutton.c:
+ (gtk_toggle_size_allocate):
+ (gtk_toggle_button_expose):
+ (gtk_toggle_button_paint): avoid messing with our parent's window if
+ toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+ the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+ * gtk/check-n.xpm:
+ * gtk/check-y.xpm:
+ * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+ bg_pixmaps.
+
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
+Tue Jan 12 13:47:07 1999 Tim Janik <timj@gtk.org>
+
+ * reworked the redrawing heuristics somewhat, this fixed a bunch of
+ existing redrawing problems and majorly reduces overall redrawing needs
+ during normal operation. basically we now only queue redraws when
+ neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+ to optimize the queued portions. widgets will now upon reallocation only
+ get redrawed if their allocation has changed. upon hide/show only the
+ area allocated by the child will be queued for the parent, this has the
+ side effect that parents which change their appearance in dependance on
+ the numer of visible children have to keep track of their children's
+ visiblity and eventually fully redraw themselves. this is a minor
+ constrain with great benefits in terms of redraw reduction, and only got
+ triggered by the notebook widget.
+
+ * gtk/gtkwidget.c:
+ (gtk_widget_queue_clear): don't bother if width and height == 0.
+ (gtk_widget_queue_clear_child): new static function to queue a redraw of
+ the area obscured by a child on a parent.
+ (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+ (gtk_widget_show): queue resize on the widget before showing.
+ (gtk_widget_hide): queue resize on the widget after hiding.
+ (gtk_widget_map): queue_draw the widget after mapping.
+ (gtk_widget_unmap): queue_clear_child the widget.
+ (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+ widget's allocation changed.
+ (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+ portions.
+ (gtk_widget_real_show):
+ (gtk_widget_real_hide):
+ (gtk_widget_real_map):
+ (gtk_widget_real_unmap):
+ (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+ descendants that override these functions don't do either and we handle
+ all redrawing/resizing related stuff before or after the signal emission
+ now.
+
+ * gtk/gtkcontainer.c:
+ (gtk_container_resize_children): don't bother about redrawing anymore
+ since gtk_widget_size_allocate handles that for us now.
+
+ * gtk/gtknotebook.h:
+ * gtk/gtknotebook.c:
+ added a flag have_visible_child to indicate whether we need to draw
+ non child related portions at all, e.g. shadows etc.
+ (gtk_notebook_draw): if have_visible_child changed, do a full paint
+ instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+ gtk_style_apply_default_background which takes an extra argument
+ copy_area to determine NO_WINDOW widget pixmap copying.
+ changed callers accordingly.
+
+ * gtk/gtktogglebutton.c:
+ (gtk_toggle_size_allocate):
+ (gtk_toggle_button_expose):
+ (gtk_toggle_button_paint): avoid messing with our parent's window if
+ toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+ the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+ * gtk/check-n.xpm:
+ * gtk/check-y.xpm:
+ * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+ bg_pixmaps.
+
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
+Tue Jan 12 13:47:07 1999 Tim Janik <timj@gtk.org>
+
+ * reworked the redrawing heuristics somewhat, this fixed a bunch of
+ existing redrawing problems and majorly reduces overall redrawing needs
+ during normal operation. basically we now only queue redraws when
+ neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+ to optimize the queued portions. widgets will now upon reallocation only
+ get redrawed if their allocation has changed. upon hide/show only the
+ area allocated by the child will be queued for the parent, this has the
+ side effect that parents which change their appearance in dependance on
+ the numer of visible children have to keep track of their children's
+ visiblity and eventually fully redraw themselves. this is a minor
+ constrain with great benefits in terms of redraw reduction, and only got
+ triggered by the notebook widget.
+
+ * gtk/gtkwidget.c:
+ (gtk_widget_queue_clear): don't bother if width and height == 0.
+ (gtk_widget_queue_clear_child): new static function to queue a redraw of
+ the area obscured by a child on a parent.
+ (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+ (gtk_widget_show): queue resize on the widget before showing.
+ (gtk_widget_hide): queue resize on the widget after hiding.
+ (gtk_widget_map): queue_draw the widget after mapping.
+ (gtk_widget_unmap): queue_clear_child the widget.
+ (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+ widget's allocation changed.
+ (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+ portions.
+ (gtk_widget_real_show):
+ (gtk_widget_real_hide):
+ (gtk_widget_real_map):
+ (gtk_widget_real_unmap):
+ (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+ descendants that override these functions don't do either and we handle
+ all redrawing/resizing related stuff before or after the signal emission
+ now.
+
+ * gtk/gtkcontainer.c:
+ (gtk_container_resize_children): don't bother about redrawing anymore
+ since gtk_widget_size_allocate handles that for us now.
+
+ * gtk/gtknotebook.h:
+ * gtk/gtknotebook.c:
+ added a flag have_visible_child to indicate whether we need to draw
+ non child related portions at all, e.g. shadows etc.
+ (gtk_notebook_draw): if have_visible_child changed, do a full paint
+ instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+ gtk_style_apply_default_background which takes an extra argument
+ copy_area to determine NO_WINDOW widget pixmap copying.
+ changed callers accordingly.
+
+ * gtk/gtktogglebutton.c:
+ (gtk_toggle_size_allocate):
+ (gtk_toggle_button_expose):
+ (gtk_toggle_button_paint): avoid messing with our parent's window if
+ toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+ the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+ * gtk/check-n.xpm:
+ * gtk/check-y.xpm:
+ * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+ bg_pixmaps.
+
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
+Tue Jan 12 13:47:07 1999 Tim Janik <timj@gtk.org>
+
+ * reworked the redrawing heuristics somewhat, this fixed a bunch of
+ existing redrawing problems and majorly reduces overall redrawing needs
+ during normal operation. basically we now only queue redraws when
+ neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+ to optimize the queued portions. widgets will now upon reallocation only
+ get redrawed if their allocation has changed. upon hide/show only the
+ area allocated by the child will be queued for the parent, this has the
+ side effect that parents which change their appearance in dependance on
+ the numer of visible children have to keep track of their children's
+ visiblity and eventually fully redraw themselves. this is a minor
+ constrain with great benefits in terms of redraw reduction, and only got
+ triggered by the notebook widget.
+
+ * gtk/gtkwidget.c:
+ (gtk_widget_queue_clear): don't bother if width and height == 0.
+ (gtk_widget_queue_clear_child): new static function to queue a redraw of
+ the area obscured by a child on a parent.
+ (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+ (gtk_widget_show): queue resize on the widget before showing.
+ (gtk_widget_hide): queue resize on the widget after hiding.
+ (gtk_widget_map): queue_draw the widget after mapping.
+ (gtk_widget_unmap): queue_clear_child the widget.
+ (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+ widget's allocation changed.
+ (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+ portions.
+ (gtk_widget_real_show):
+ (gtk_widget_real_hide):
+ (gtk_widget_real_map):
+ (gtk_widget_real_unmap):
+ (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+ descendants that override these functions don't do either and we handle
+ all redrawing/resizing related stuff before or after the signal emission
+ now.
+
+ * gtk/gtkcontainer.c:
+ (gtk_container_resize_children): don't bother about redrawing anymore
+ since gtk_widget_size_allocate handles that for us now.
+
+ * gtk/gtknotebook.h:
+ * gtk/gtknotebook.c:
+ added a flag have_visible_child to indicate whether we need to draw
+ non child related portions at all, e.g. shadows etc.
+ (gtk_notebook_draw): if have_visible_child changed, do a full paint
+ instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+ gtk_style_apply_default_background which takes an extra argument
+ copy_area to determine NO_WINDOW widget pixmap copying.
+ changed callers accordingly.
+
+ * gtk/gtktogglebutton.c:
+ (gtk_toggle_size_allocate):
+ (gtk_toggle_button_expose):
+ (gtk_toggle_button_paint): avoid messing with our parent's window if
+ toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+ * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+ the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+ * gtk/check-n.xpm:
+ * gtk/check-y.xpm:
+ * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+ bg_pixmaps.
+
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
--- /dev/null
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+" 10 9 5 1",
+/* colors */
+". c None",
+"# c #000000",
+"y c #666666",
+"i c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
--- /dev/null
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+" 10 9 5 1",
+/* colors */
+". c None",
+"# c #000000",
+"i c #ff0fff",
+"y c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
if (GTK_TOGGLE_BUTTON (widget)->active)
- shadow_type = GTK_SHADOW_IN;
+ {
+ state_type = GTK_STATE_ACTIVE;
+ shadow_type = GTK_SHADOW_IN;
+ }
else
- shadow_type = GTK_SHADOW_OUT;
-
+ {
+ shadow_type = GTK_SHADOW_OUT;
+ state_type = GTK_WIDGET_STATE (widget);
+ }
+
gtk_paint_check (widget->style, window,
- GTK_WIDGET_STATE (widget), shadow_type,
+ state_type, shadow_type,
area, widget, "checkbutton",
x + 1, y + 1, width, height);
}
widget->requisition.height > widget->allocation.height)
{
if (GTK_IS_RESIZE_CONTAINER (container))
- {
- gtk_widget_size_allocate (GTK_WIDGET (container),
- >K_WIDGET (container)->allocation);
- gtk_widget_queue_draw (GTK_WIDGET (container));
- }
+ gtk_widget_size_allocate (GTK_WIDGET (container),
+ >K_WIDGET (container)->allocation);
else
gtk_widget_queue_resize (widget);
}
if (resize_container->parent)
gtk_container_queue_resize (container);
else
- {
- gtk_widget_size_allocate (GTK_WIDGET (container),
- >K_WIDGET (container)->allocation);
- gtk_widget_queue_draw (GTK_WIDGET (container));
- }
+ gtk_widget_size_allocate (GTK_WIDGET (container),
+ >K_WIDGET (container)->allocation);
return;
}
widget = node->data;
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
+
gtk_widget_size_allocate (widget, &widget->allocation);
- gtk_widget_queue_draw (widget);
+
gtk_widget_unref (widget);
}
g_slist_free (resize_containers);
- /* GTK - The GIMP Toolkit
+/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
{
GdkWChar *beginning;
gint length;
-
+
/* FIXME:
* We need (space,width) only before we've set (x,y), so to save
* memory, these pairs should really be wrapped in a union.
gtk_object_add_arg_type ("GtkLabel::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
gtk_object_add_arg_type ("GtkLabel::pattern", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_PATTERN);
gtk_object_add_arg_type ("GtkLabel::justify", GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFY);
-
+
object_class->set_arg = gtk_label_set_arg;
object_class->get_arg = gtk_label_get_arg;
object_class->finalize = gtk_label_finalize;
guint arg_id)
{
GtkLabel *label;
-
+
label = GTK_LABEL (object);
-
+
switch (arg_id)
{
case ARG_LABEL:
guint arg_id)
{
GtkLabel *label;
-
+
label = GTK_LABEL (object);
-
+
switch (arg_id)
{
case ARG_LABEL:
label->jtype = GTK_JUSTIFY_CENTER;
label->pattern = NULL;
label->wrap = FALSE;
-
+
gtk_label_set_text (label, "");
}
gtk_label_new (const char *str)
{
GtkLabel *label;
-
+
g_return_val_if_fail (str != NULL, NULL);
-
+
label = gtk_type_new (gtk_label_get_type ());
-
+
gtk_label_set_text (label, str);
-
+
return GTK_WIDGET (label);
}
g_free (label->label);
if (label->label_wc)
g_free (label->label_wc);
-
+
label->label = str;
label->label_wc = str_wc;
-
+
gtk_label_free_words (label);
-
+
if (GTK_WIDGET_VISIBLE (label))
{
if (GTK_WIDGET_MAPPED (label))
gtk_widget_queue_clear (GTK_WIDGET (label));
-
+
gtk_widget_queue_resize (GTK_WIDGET (label));
}
}
g_return_if_fail (label != NULL);
g_return_if_fail (GTK_IS_LABEL (label));
g_return_if_fail (str != NULL);
-
+
/* Convert text to wide characters */
len = strlen (str);
str_wc = g_new (GdkWChar, len + 1);
wc_len = gdk_mbstowcs (str_wc, str, len + 1);
str_wc[wc_len] = '\0';
-
+
gtk_label_set_text_internal (label, g_strdup (str), str_wc);
}
{
g_return_if_fail (label != NULL);
g_return_if_fail (GTK_IS_LABEL (label));
-
+
if ((GtkJustification) label->jtype != jtype)
{
if ((label->jtype == GTK_JUSTIFY_FILL) ||
(jtype == GTK_JUSTIFY_FILL))
/* FIXME: think about this a little */
- gtk_label_free_words (label);
-
+ gtk_label_free_words (label);
+
label->jtype = jtype;
if (GTK_WIDGET_VISIBLE (label))
{
g_return_if_fail (label != NULL);
g_return_if_fail (GTK_IS_LABEL (label));
-
+
if (label->wrap != wrap) {
if (GTK_WIDGET_VISIBLE (label))
{
g_return_if_fail (label != NULL);
g_return_if_fail (GTK_IS_LABEL (label));
g_return_if_fail (str != NULL);
-
+
*str = label->label;
}
gtk_label_word_alloc ()
{
GtkLabelWord * word;
-
+
if (!word_chunk)
{
word_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
{
word = g_mem_chunk_alloc (word_chunk);
}
-
+
word->next = 0;
word->uline = 0;
return word;
gtk_label_free_words (GtkLabel *label)
{
GtkLabelWord * last;
-
+
if (label->words)
{
for (last = label->words; last->next != 0; last = last->next)
gtk_label_uline_alloc (void)
{
GtkLabelULine * uline;
-
+
if (!uline_chunk)
{
uline_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
{
uline = g_mem_chunk_alloc (uline_chunk);
}
-
+
uline->next = NULL;
-
+
return uline;
}
if (word->uline)
{
for (last = word->uline; last->next != 0; last = last->next)
- ;
+ ;
last->next = free_ulines;
free_ulines = word->uline;
word->uline = 0;
max_line_width = 0;
tailp = &label->words;
str = label->label_wc;
-
+
while (*str)
{
word = gtk_label_word_alloc ();
*tailp = word;
tailp = &word->next;
}
-
+
/* Add an empty word to represent an empty line
*/
if ((str == label->label_wc) || (str[-1] == '\n'))
{
word = gtk_label_word_alloc ();
-
+
word->space = 0;
word->beginning = str;
word->length = 0;
g_return_if_fail (!label->wrap);
ptrn = label->pattern;
-
+
y = 0;
baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 2;
for (line = label->words; line; line = line->next)
{
if (label->jtype == GTK_JUSTIFY_CENTER)
- line->x = (line_width - line->width) / 2;
+ line->x = (line_width - line->width) / 2;
else if (label->jtype == GTK_JUSTIFY_RIGHT)
- line->x = line_width - line->width;
+ line->x = line_width - line->width;
else
- line->x = 0;
-
+ line->x = 0;
+
line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
y_max = 0;
else if (ptrn[j] == ' ')
break;
}
-
+
/* good. Now we have an underlined segment.
* let's measure it and record it.
*/
gint x, y, space, extra_width, add_space, baseline_skip;
g_return_if_fail (label->wrap);
-
+
ptrn = label->pattern;
y = 0;
baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 1;
for (next_line = line->next; next_line; next_line = next_line->next)
{
if (next_line->space == 0)
- break; /* New paragraph */
+ break; /* New paragraph */
if (next_line->space + next_line->width > extra_width)
- break;
+ break;
extra_width -= next_line->space + next_line->width;
space += next_line->space;
}
-
+
line->x = 0;
line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
x = line->width;
add_space = 0;
-
+
for (word = line->next; word != next_line; word = word->next)
{
if (next_line && next_line->space)
word->y = line->y;
x = word->x + word->width;
}
-
+
y += (baseline_skip);
}
-
+
label->max_width = line_width;
widget = GTK_WIDGET (label);
widget->requisition.width = line_width + 2 * label->misc.xpad;
widget->requisition.height = y + 2 * label->misc.ypad + 1;
}
-
+
static void
gtk_label_size_request (GtkWidget *widget,
GtkRequisition *requisition)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_LABEL (widget));
g_return_if_fail (requisition != NULL);
-
+
label = GTK_LABEL (widget);
-
+
/*
* There are a number of conditions which will necessitate re-filling
* our text:
* Too much of a pain to detect all these case, so always re-fill. I
* don't think it's really that slow.
*/
-
+
if (label->wrap)
{
GtkWidgetAuxInfo *aux_info;
else
{
label->max_width = gdk_string_width (GTK_WIDGET (label)->style->font,
- "This is a good enough length for any line to have.");
+ "This is a good enough length for any line to have.");
label->max_width = MIN (label->max_width, (gdk_screen_width () + 1) / 2);
label->max_width = MIN (label->max_width, longest_paragraph);
if (longest_paragraph > 0)
nlines = (longest_paragraph + label->max_width - 1) / label->max_width;
perfect_width = (longest_paragraph + nlines - 1) / nlines;
label->max_width = gtk_label_pick_width (label,
- perfect_width,
- label->max_width);
+ perfect_width,
+ label->max_width);
}
}
gtk_label_finalize_lines_wrap (label, label->max_width);
label->max_width = gtk_label_split_text (label);
gtk_label_finalize_lines (label, label->max_width);
}
-
+
if (requisition != &widget->requisition)
*requisition = widget->requisition;
}
+
static void
-gtk_label_paint_word (GtkLabel *label,
- gint x,
- gint y,
+gtk_label_paint_word (GtkLabel *label,
+ gint x,
+ gint y,
GtkLabelWord *word,
GdkRectangle *area)
{
GtkWidget *widget = GTK_WIDGET (label);
GtkLabelULine *uline;
gchar *tmp_str;
-
+
tmp_str = gdk_wcstombs (word->beginning);
gtk_paint_string (widget->style, widget->window, widget->state,
area, widget, "label",
tmp_str);
g_free (tmp_str);
- for (uline = word->uline;uline;uline = uline->next)
+ for (uline = word->uline; uline; uline = uline->next)
gtk_paint_hline (widget->style, widget->window,
widget->state, area,
widget, "label",
- x + uline->x1, x +uline->x2, y + uline->y);
-
-
+ x + uline->x1, x + uline->x2, y + uline->y);
+
+
}
+
static gint
gtk_label_expose (GtkWidget *widget,
GdkEventExpose *event)
GtkMisc *misc;
GtkLabelWord *word;
gint x, y;
-
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_LABEL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
-
+
label = GTK_LABEL (widget);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
label->label && (*label->label != '\0'))
{
misc = GTK_MISC (widget);
-
+
/*
* GC Clipping
*/
gdk_gc_set_clip_rectangle (widget->style->white_gc, &event->area);
gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state], &event->area);
-
+
x = widget->allocation.x + misc->xpad +
(widget->allocation.width - label->max_width)
* misc->xalign + 0.5;
-
+
y = (widget->allocation.y
+ (widget->allocation.height
- widget->requisition.height) * misc->yalign
gtk_label_paint_word (label, x, y, word, &event->area);
word->beginning[word->length] = save;
}
-
+
gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL);
}
+
return TRUE;
}
+
guint
-gtk_label_parse_uline (GtkLabel *label,
- const gchar *string)
+gtk_label_parse_uline (GtkLabel *label,
+ const gchar *string)
{
guint accel_key = GDK_VoidSymbol;
GdkWChar *p, *q, *string_wc;
gchar *pattern;
gint length, wc_length;
gboolean underscore;
-
+
/* Convert text to wide characters */
length = strlen (string);
string_wc = g_new (GdkWChar, length + 1);
string_wc[wc_length] = '\0';
pattern = g_new (gchar, length+1);
-
+
underscore = FALSE;
-
+
p = q = string_wc;
r = pattern;
-
+
while (*p)
{
if (underscore)
if (accel_key == GDK_VoidSymbol)
accel_key = gdk_keyval_to_lower (*p);
}
-
+
*q++ = *p;
underscore = FALSE;
}
}
*q = 0;
*r = 0;
-
+
gtk_label_set_text_internal (label, gdk_wcstombs (string_wc), string_wc);
gtk_label_set_pattern (label, pattern);
g_free (pattern);
-
+
return accel_key;
}
notebook->button = 0;
notebook->need_timer = 0;
notebook->child_has_focus = FALSE;
+ notebook->have_visible_child = FALSE;
}
GtkWidget*
g_return_if_fail (GTK_IS_NOTEBOOK (widget));
g_return_if_fail (area != NULL);
+ notebook = GTK_NOTEBOOK (widget);
+
if (GTK_WIDGET_DRAWABLE (widget))
{
- notebook = GTK_NOTEBOOK (widget);
+ gboolean have_visible_child;
+
+ have_visible_child = notebook->cur_page && GTK_WIDGET_VISIBLE (notebook->cur_page->child);
+
+ if (have_visible_child != notebook->have_visible_child)
+ {
+ GdkRectangle full_area;
+
+ notebook->have_visible_child = have_visible_child;
+ full_area.x = 0;
+ full_area.y = 0;
+ full_area.width = widget->allocation.width;
+ full_area.height = widget->allocation.height;
+ gtk_notebook_paint (widget, &full_area);
+ }
+ else
+ gtk_notebook_paint (widget, area);
- gtk_notebook_paint (widget, area);
gtk_widget_draw_focus (widget);
- if (notebook->cur_page &&
+ if (notebook->cur_page && GTK_WIDGET_VISIBLE (notebook->cur_page->child) &&
gtk_widget_intersect (notebook->cur_page->child, area, &child_area))
gtk_widget_draw (notebook->cur_page->child, &child_area);
}
+ else
+ notebook->have_visible_child = FALSE;
}
static gint
if (notebook->show_border && (!notebook->show_tabs || !notebook->children))
{
-
- gtk_paint_box(widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- area, widget, "notebook",
- x, y, width, height);
+ gtk_paint_box (widget->style, widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+ area, widget, "notebook",
+ x, y, width, height);
return;
}
guint16 tab_hborder;
guint16 tab_vborder;
- guint show_tabs : 1;
- guint homogeneous : 1;
- guint show_border : 1;
- guint tab_pos : 2;
- guint scrollable : 1;
- guint in_child : 2;
- guint click_child : 2;
- guint button : 2;
- guint need_timer : 1;
- guint child_has_focus : 1;
+ guint show_tabs : 1;
+ guint homogeneous : 1;
+ guint show_border : 1;
+ guint tab_pos : 2;
+ guint scrollable : 1;
+ guint in_child : 2;
+ guint click_child : 2;
+ guint button : 2;
+ guint need_timer : 1;
+ guint child_has_focus : 1;
+ guint have_visible_child : 1;
};
struct _GtkNotebookClass
if (GTK_WIDGET_STATE (button) != new_state)
gtk_widget_set_state (GTK_WIDGET (button), new_state);
+
if (toggled)
gtk_toggle_button_toggled (toggle_button);
+
gtk_widget_queue_draw (GTK_WIDGET (button));
}
g_free (style);
}
-void
-gtk_style_set_background (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type)
-{
- GdkPixmap *pixmap;
- gint parent_relative;
-
- if (style->engine && style->engine->set_background)
- {
- (*style->engine->set_background) (style, window, state_type);
- return;
- }
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if (style->bg_pixmap[state_type])
- {
- if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
- {
- pixmap = NULL;
- parent_relative = TRUE;
- }
- else
- {
- pixmap = style->bg_pixmap[state_type];
- parent_relative = FALSE;
- }
-
- gdk_window_set_back_pixmap (window, pixmap, parent_relative);
- }
- else
- gdk_window_set_background (window, &style->bg[state_type]);
-}
-
-
void
gtk_draw_hline (GtkStyle *style,
GdkWindow *window,
(*style->klass->draw_handle) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
}
+void
+gtk_style_set_background (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type)
+{
+ GdkPixmap *pixmap;
+ gint parent_relative;
+
+ if (style->engine && style->engine->set_background)
+ {
+ (*style->engine->set_background) (style, window, state_type);
+ return;
+ }
+
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ if (style->bg_pixmap[state_type])
+ {
+ if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
+ {
+ pixmap = NULL;
+ parent_relative = TRUE;
+ }
+ else
+ {
+ pixmap = style->bg_pixmap[state_type];
+ parent_relative = FALSE;
+ }
+
+ gdk_window_set_back_pixmap (window, pixmap, parent_relative);
+ }
+ else
+ gdk_window_set_background (window, &style->bg[state_type]);
+}
+
+
/* Default functions */
void
-gtk_style_apply_default_pixmap (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- gint x,
- gint y,
- gint width,
- gint height)
+gtk_style_apply_default_background (GtkStyle *style,
+ GdkWindow *window,
+ gboolean copy_area,
+ GtkStateType state_type,
+ GdkRectangle *area,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
GdkRectangle new_rect, old_rect;
GdkGC *gc;
gdk_draw_rectangle (window, gc, TRUE,
x, y, width, height);
}
- else
+ else if (!copy_area || style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
{
- if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
- gdk_window_set_back_pixmap (window, NULL, TRUE);
- else
- gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
+ if (!copy_area)
+ {
+ if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
+ gdk_window_set_back_pixmap (window, NULL, TRUE);
+ else
+ gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
+ }
old_rect.x = x;
old_rect.y = y;
else
gdk_window_clear_area (window, x, y, width, height);
}
+ else
+ {
+ old_rect.x = x;
+ old_rect.y = y;
+ old_rect.width = width;
+ old_rect.height = height;
+
+ if (area && gdk_rectangle_intersect (area, &old_rect, &new_rect))
+ gdk_window_copy_area (window, style->bg_gc[state_type], new_rect.x, new_rect.y,
+ style->bg_pixmap[state_type], 0, 0, new_rect.width, new_rect.height);
+ else
+ {
+ gdk_window_clear_area (window, x, y, width, height);
+ gdk_window_copy_area (window, style->bg_gc[state_type], x, y,
+ style->bg_pixmap[state_type], 0, 0, width, height);
+ }
+ }
}
static void
}
}
else
- gtk_style_apply_default_pixmap (style, window, state_type, area, x, y, width, height);
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ state_type, area, x, y, width, height);
gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
x, y, width, height);
}
}
else
- gtk_style_apply_default_pixmap(style, window, state_type, area, x, y, width, height);
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ state_type, area, x, y, width, height);
}
static void
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
- gtk_style_apply_default_pixmap(style, window, state_type, area,
- x, y, width, height);
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ state_type, area, x, y, width, height);
if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height);
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
- gtk_style_apply_default_pixmap(style, window, GTK_STATE_NORMAL, area,
- x, y, width, height);
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ GTK_STATE_NORMAL, area, x, y, width, height);
if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height);
switch (gap_side)
{
case GTK_POS_TOP:
- gtk_style_apply_default_pixmap(style, window, state_type, area,
- x + style->klass->xthickness,
- y,
- width - (2 * style->klass->xthickness),
- height - (style->klass->ythickness));
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ state_type, area,
+ x + style->klass->xthickness,
+ y,
+ width - (2 * style->klass->xthickness),
+ height - (style->klass->ythickness));
gdk_draw_line (window, gc1,
x, y, x, y + height - 2);
gdk_draw_line (window, gc2,
x + width - 1, y, x + width - 1, y + height - 2);
break;
case GTK_POS_BOTTOM:
- gtk_style_apply_default_pixmap(style, window, state_type, area,
- x + style->klass->xthickness,
- y + style->klass->ythickness,
- width - (2 * style->klass->xthickness),
- height - (style->klass->ythickness));
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ state_type, area,
+ x + style->klass->xthickness,
+ y + style->klass->ythickness,
+ width - (2 * style->klass->xthickness),
+ height - (style->klass->ythickness));
gdk_draw_line (window, gc1,
x + 1, y, x + width - 2, y);
gdk_draw_line (window, gc1,
x + width - 1, y + 1, x + width - 1, y + height - 1);
break;
case GTK_POS_LEFT:
- gtk_style_apply_default_pixmap(style, window, state_type, area,
- x,
- y + style->klass->ythickness,
- width - (style->klass->xthickness),
- height - (2 * style->klass->ythickness));
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ state_type, area,
+ x,
+ y + style->klass->ythickness,
+ width - (style->klass->xthickness),
+ height - (2 * style->klass->ythickness));
gdk_draw_line (window, gc1,
x, y, x + width - 2, y);
gdk_draw_line (window, gc2,
x + width - 1, y + 1, x + width - 1, y + height - 2);
break;
case GTK_POS_RIGHT:
- gtk_style_apply_default_pixmap(style, window, state_type, area,
- x + style->klass->xthickness,
- y + style->klass->ythickness,
- width - (style->klass->xthickness),
- height - (2 * style->klass->ythickness));
+ gtk_style_apply_default_background (style, window,
+ widget && GTK_WIDGET_NO_WINDOW (widget),
+ state_type, area,
+ x + style->klass->xthickness,
+ y + style->klass->ythickness,
+ width - (style->klass->xthickness),
+ height - (2 * style->klass->ythickness));
gdk_draw_line (window, gc1,
x + 1, y, x + width - 1, y);
gdk_draw_line (window, gc1,
GtkOrientation orientation);
};
-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_style_apply_default_pixmap(GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- gint x,
- gint y,
- gint width,
- gint height);
+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_style_apply_default_background (GtkStyle *style,
+ GdkWindow *window,
+ gboolean copy_area,
+ GtkStateType state_type,
+ GdkRectangle *area,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
void gtk_draw_hline (GtkStyle *style,
GdkWindow *window,
static void gtk_toggle_button_init (GtkToggleButton *toggle_button);
static void gtk_toggle_button_paint (GtkWidget *widget,
GdkRectangle *area);
+static void gtk_toggle_button_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
static void gtk_toggle_button_draw (GtkWidget *widget,
GdkRectangle *area);
+static gint gtk_toggle_button_expose (GtkWidget *widget,
+ GdkEventExpose *event);
static void gtk_toggle_button_pressed (GtkButton *button);
static void gtk_toggle_button_released (GtkButton *button);
static void gtk_toggle_button_clicked (GtkButton *button);
object_class->set_arg = gtk_toggle_button_set_arg;
object_class->get_arg = gtk_toggle_button_get_arg;
+ widget_class->size_allocate = gtk_toggle_button_size_allocate;
widget_class->draw = gtk_toggle_button_draw;
+ widget_class->expose_event = gtk_toggle_button_expose;
widget_class->realize = gtk_toggle_button_realize;
widget_class->unrealize = gtk_toggle_button_unrealize;
widget_class->map = gtk_toggle_button_map;
{
toggle_button->active = FALSE;
toggle_button->draw_indicator = FALSE;
+ GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
}
gtk_widget_unrealize (widget);
toggle_button->draw_indicator = draw_indicator;
+
+ if (toggle_button->draw_indicator)
+ GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
+ else
+ GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
+
gtk_widget_realize (widget);
if (visible)
gtk_widget_show (widget);
}
else
- toggle_button->draw_indicator = draw_indicator;
+ {
+ toggle_button->draw_indicator = draw_indicator;
+
+ if (toggle_button->draw_indicator)
+ GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
+ else
+ GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
+ }
if (GTK_WIDGET_VISIBLE (toggle_button))
gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
gint width, height;
gint x, y;
+ button = GTK_BUTTON (widget);
+ toggle_button = GTK_TOGGLE_BUTTON (widget);
+
if (GTK_WIDGET_DRAWABLE (widget))
{
- button = GTK_BUTTON (widget);
- toggle_button = GTK_TOGGLE_BUTTON (widget);
-
x = 0;
y = 0;
width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
}
}
+static void
+gtk_toggle_button_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ if (!GTK_WIDGET_NO_WINDOW (widget) &&
+ GTK_WIDGET_CLASS (parent_class)->size_allocate)
+ GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+}
+
+static gint
+gtk_toggle_button_expose (GtkWidget *widget,
+ GdkEventExpose *event)
+{
+ if (!GTK_WIDGET_NO_WINDOW (widget) &&
+ GTK_WIDGET_CLASS (parent_class)->expose_event)
+ return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+ else
+ return FALSE;
+}
+
static void
gtk_toggle_button_draw (GtkWidget *widget,
GdkRectangle *area)
bin = GTK_BIN (widget);
- if (GTK_WIDGET_DRAWABLE (widget))
+ if (GTK_WIDGET_DRAWABLE (widget) && !GTK_WIDGET_NO_WINDOW (widget))
{
tmp_area = *area;
tmp_area.x -= GTK_CONTAINER (widget)->border_width;
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
- if (toggle_button->draw_indicator)
+ if (GTK_WIDGET_NO_WINDOW (widget))
{
- GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
attributes.wclass = GDK_INPUT_ONLY;
attributes_mask = GDK_WA_X | GDK_WA_Y;
}
else
{
- GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
attributes.wclass = GDK_INPUT_OUTPUT;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.visual = gtk_widget_get_visual (widget);
widget->style = gtk_style_attach (widget->style, widget->window);
- if (!toggle_button->draw_indicator)
+ if (!GTK_WIDGET_NO_WINDOW (widget))
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
toggle_button = GTK_TOGGLE_BUTTON (widget);
- if (toggle_button->draw_indicator)
+ if (GTK_WIDGET_NO_WINDOW (widget))
{
gdk_window_set_user_data (toggle_button->event_window, NULL);
gdk_window_destroy (toggle_button->event_window);
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
- if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
+ if (GTK_WIDGET_NO_WINDOW (widget))
gdk_window_show (GTK_TOGGLE_BUTTON (widget)->event_window);
GTK_WIDGET_CLASS (parent_class)->map (widget);
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
- if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
+ if (GTK_WIDGET_NO_WINDOW (widget))
gdk_window_hide (GTK_TOGGLE_BUTTON (widget)->event_window);
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
gtk_object_setv (GTK_OBJECT (widget), nargs, args);
}
-/*****************************************
- * gtk_widget_unparent:
- * do any cleanup necessary necessary
- * for setting parent = NULL.
- *
- * arguments:
- *
- * results:
- *****************************************/
+static inline void
+gtk_widget_queue_clear_child (GtkWidget *widget)
+{
+ GtkWidget *parent;
+
+ parent = widget->parent;
+ if (parent && GTK_WIDGET_DRAWABLE (parent))
+ gtk_widget_queue_clear_area (parent,
+ widget->allocation.x,
+ widget->allocation.y,
+ widget->allocation.width,
+ widget->allocation.height);
+}
void
gtk_widget_unparent (GtkWidget *widget)
toplevel = toplevel->parent;
}
- if (widget->window &&
- GTK_WIDGET_NO_WINDOW (widget) &&
- GTK_WIDGET_DRAWABLE (widget))
- gtk_widget_queue_clear (widget);
+
+ gtk_widget_queue_clear_child (widget);
/* Reset the width and height here, to force reallocation if we
* get added back to a new parent. This won't work if our new
g_return_if_fail (GTK_IS_WIDGET (widget));
if (!GTK_WIDGET_VISIBLE (widget))
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
+ {
+ gtk_widget_queue_resize (widget);
+ gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
+ }
}
+static void
+gtk_widget_real_show (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (!GTK_WIDGET_VISIBLE (widget))
+ {
+ GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+
+ if (widget->parent && GTK_WIDGET_MAPPED (widget->parent))
+ gtk_widget_map (widget);
+ }
+}
/*************************************************************
* gtk_widget_show_now:
g_return_if_fail (GTK_IS_WIDGET (widget));
if (GTK_WIDGET_VISIBLE (widget))
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
+ {
+ gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
+ gtk_widget_queue_resize (widget);
+ }
+}
+
+static void
+gtk_widget_real_hide (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (GTK_WIDGET_VISIBLE (widget))
+ {
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+
+ if (GTK_WIDGET_MAPPED (widget))
+ gtk_widget_unmap (widget);
+ }
}
gint
{
if (!GTK_WIDGET_REALIZED (widget))
gtk_widget_realize (widget);
-
+
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[MAP]);
+
+ gtk_widget_queue_draw (widget);
}
}
g_return_if_fail (GTK_IS_WIDGET (widget));
if (GTK_WIDGET_MAPPED (widget))
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNMAP]);
+ {
+ gtk_widget_queue_clear_child (widget);
+ gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNMAP]);
+ }
}
/*****************************************
}
void
-gtk_widget_queue_clear (GtkWidget *widget)
+gtk_widget_queue_clear (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
- if (GTK_WIDGET_NO_WINDOW (widget))
- gtk_widget_queue_clear_area (widget, widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- else
- gtk_widget_queue_clear_area (widget, 0, 0,
- widget->allocation.width,
- widget->allocation.height);
+ if (widget->allocation.width || widget->allocation.height)
+ {
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ gtk_widget_queue_clear_area (widget, widget->allocation.x,
+ widget->allocation.y,
+ widget->allocation.width,
+ widget->allocation.height);
+ else
+ gtk_widget_queue_clear_area (widget, 0, 0,
+ widget->allocation.width,
+ widget->allocation.height);
+ }
}
static gint
if (GTK_IS_RESIZE_CONTAINER (widget))
gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
+ if (GTK_WIDGET_DRAWABLE (widget))
+ gtk_widget_queue_clear (widget);
+
if (widget->parent)
gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
else if (GTK_WIDGET_TOPLEVEL (widget))
{
GtkWidgetAuxInfo *aux_info;
GtkAllocation real_allocation;
+ gboolean needs_draw = FALSE;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
real_allocation.y = aux_info->y;
}
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ {
+ if (widget->allocation.x != real_allocation.x ||
+ widget->allocation.y != real_allocation.y ||
+ widget->allocation.width != real_allocation.width ||
+ widget->allocation.height != real_allocation.height)
+ {
+ gtk_widget_queue_clear_child (widget);
+ needs_draw = TRUE;
+ }
+ }
+ else if (widget->allocation.width != real_allocation.width ||
+ widget->allocation.height != real_allocation.height)
+ {
+ gtk_widget_queue_clear_child (widget);
+ needs_draw = TRUE;
+ }
+
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_ALLOCATE], &real_allocation);
+
+ if (needs_draw)
+ gtk_widget_queue_draw (widget);
+}
+
+static void
+gtk_widget_real_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ widget->allocation = *allocation;
+
+ if (GTK_WIDGET_REALIZED (widget) &&
+ !GTK_WIDGET_NO_WINDOW (widget))
+ {
+ gdk_window_move_resize (widget->window,
+ allocation->x, allocation->y,
+ allocation->width, allocation->height);
+ }
}
static void
parent_class->finalize (object);
}
-/*****************************************
- * gtk_widget_real_show:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_show (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (!GTK_WIDGET_VISIBLE (widget))
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
-
- if (widget->parent)
- {
- gtk_widget_queue_resize (widget->parent);
-
- if (GTK_WIDGET_MAPPED (widget->parent))
- gtk_widget_map (widget);
- }
- }
-}
-
-/*****************************************
- * gtk_widget_real_hide:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_hide (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (GTK_WIDGET_VISIBLE (widget))
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
-
- if (GTK_WIDGET_MAPPED (widget))
- gtk_widget_unmap (widget);
-
- if (widget->parent)
- gtk_widget_queue_resize (widget->parent);
- }
-}
-
/*****************************************
* gtk_widget_real_map:
*
if (!GTK_WIDGET_NO_WINDOW (widget))
gdk_window_show (widget->window);
- else
- gtk_widget_queue_draw (widget);
}
}
if (GTK_WIDGET_MAPPED (widget))
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- gtk_widget_queue_clear (widget);
- else
+
+ if (!GTK_WIDGET_NO_WINDOW (widget))
gdk_window_hide (widget->window);
}
}
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
}
-/*****************************************
- * gtk_widget_real_draw:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
static void
gtk_widget_real_draw (GtkWidget *widget,
GdkRectangle *area)
requisition->height = widget->requisition.height;
}
-static void
-gtk_widget_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (GTK_WIDGET_NO_WINDOW (widget) &&
- GTK_WIDGET_MAPPED (widget) &&
- ((widget->allocation.x != allocation->x) ||
- (widget->allocation.y != allocation->y) ||
- (widget->allocation.width != allocation->width) ||
- (widget->allocation.height != allocation->height)) &&
- (widget->allocation.width != 0) &&
- (widget->allocation.height != 0))
- gtk_widget_queue_clear (widget);
-
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget) &&
- !GTK_WIDGET_NO_WINDOW (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
- }
-}
-
/*****************************************
* gtk_widget_peek_colormap:
*
style "window"
{
-# bg_pixmap[NORMAL] = "marble.xpm"
+ # bg_pixmap[NORMAL] = "marble.xpm"
}
-style "pix"
-{
-# bg_pixmap[NORMAL] = "<parent>" # "marble.xpm" # "test.xpm"
-}
-widget_class "*Button*" style "pix"
-
style "scale"
{
fg[NORMAL] = { 1.0, 0, 0 }
{
fg[NORMAL] = { 1.0, 0, 0 }
fg[ACTIVE] = { 1.0, 0, 0 }
- bg_pixmap[NORMAL] = "<parent>"
+ bg_pixmap[ACTIVE] = "check-y.xpm"
+ bg_pixmap[NORMAL] = "check-n.xpm"
}
style "text"
--- /dev/null
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+" 10 9 5 1",
+/* colors */
+". c None",
+"# c #000000",
+"y c #666666",
+"i c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
--- /dev/null
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+" 10 9 5 1",
+/* colors */
+". c None",
+"# c #000000",
+"i c #ff0fff",
+"y c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
style "window"
{
-# bg_pixmap[NORMAL] = "marble.xpm"
+ # bg_pixmap[NORMAL] = "marble.xpm"
}
-style "pix"
-{
-# bg_pixmap[NORMAL] = "<parent>" # "marble.xpm" # "test.xpm"
-}
-widget_class "*Button*" style "pix"
-
style "scale"
{
fg[NORMAL] = { 1.0, 0, 0 }
{
fg[NORMAL] = { 1.0, 0, 0 }
fg[ACTIVE] = { 1.0, 0, 0 }
- bg_pixmap[NORMAL] = "<parent>"
+ bg_pixmap[ACTIVE] = "check-y.xpm"
+ bg_pixmap[NORMAL] = "check-n.xpm"
}
style "text"