mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-24 12:41:16 +00:00
reworked the redrawing heuristics somewhat, this fixed a bunch of existing
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.
This commit is contained in:
parent
8b0955954c
commit
d7bd87f2ea
69
ChangeLog
69
ChangeLog
@ -1,3 +1,72 @@
|
|||||||
|
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>
|
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
|
||||||
|
|
||||||
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
||||||
|
@ -1,3 +1,72 @@
|
|||||||
|
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>
|
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
|
||||||
|
|
||||||
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
||||||
|
@ -1,3 +1,72 @@
|
|||||||
|
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>
|
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
|
||||||
|
|
||||||
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
||||||
|
@ -1,3 +1,72 @@
|
|||||||
|
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>
|
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
|
||||||
|
|
||||||
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
||||||
|
@ -1,3 +1,72 @@
|
|||||||
|
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>
|
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
|
||||||
|
|
||||||
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
||||||
|
@ -1,3 +1,72 @@
|
|||||||
|
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>
|
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
|
||||||
|
|
||||||
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
||||||
|
@ -1,3 +1,72 @@
|
|||||||
|
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>
|
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
|
||||||
|
|
||||||
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
* gtk/gtklist.c (gtk_list_signal_drag_begin)
|
||||||
|
21
gtk/check-n.xpm
Normal file
21
gtk/check-n.xpm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* 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.....",
|
||||||
|
"..........",
|
||||||
|
"..........",
|
||||||
|
};
|
21
gtk/check-y.xpm
Normal file
21
gtk/check-y.xpm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* 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.....",
|
||||||
|
"..........",
|
||||||
|
"..........",
|
||||||
|
};
|
@ -365,12 +365,18 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
|
|||||||
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
|
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
|
||||||
|
|
||||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||||
shadow_type = GTK_SHADOW_IN;
|
{
|
||||||
|
state_type = GTK_STATE_ACTIVE;
|
||||||
|
shadow_type = GTK_SHADOW_IN;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
shadow_type = GTK_SHADOW_OUT;
|
{
|
||||||
|
shadow_type = GTK_SHADOW_OUT;
|
||||||
|
state_type = GTK_WIDGET_STATE (widget);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_paint_check (widget->style, window,
|
gtk_paint_check (widget->style, window,
|
||||||
GTK_WIDGET_STATE (widget), shadow_type,
|
state_type, shadow_type,
|
||||||
area, widget, "checkbutton",
|
area, widget, "checkbutton",
|
||||||
x + 1, y + 1, width, height);
|
x + 1, y + 1, width, height);
|
||||||
}
|
}
|
||||||
|
@ -936,11 +936,8 @@ gtk_container_real_check_resize (GtkContainer *container)
|
|||||||
widget->requisition.height > widget->allocation.height)
|
widget->requisition.height > widget->allocation.height)
|
||||||
{
|
{
|
||||||
if (GTK_IS_RESIZE_CONTAINER (container))
|
if (GTK_IS_RESIZE_CONTAINER (container))
|
||||||
{
|
gtk_widget_size_allocate (GTK_WIDGET (container),
|
||||||
gtk_widget_size_allocate (GTK_WIDGET (container),
|
>K_WIDGET (container)->allocation);
|
||||||
>K_WIDGET (container)->allocation);
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (container));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
gtk_widget_queue_resize (widget);
|
gtk_widget_queue_resize (widget);
|
||||||
}
|
}
|
||||||
@ -1009,11 +1006,8 @@ gtk_container_resize_children (GtkContainer *container)
|
|||||||
if (resize_container->parent)
|
if (resize_container->parent)
|
||||||
gtk_container_queue_resize (container);
|
gtk_container_queue_resize (container);
|
||||||
else
|
else
|
||||||
{
|
gtk_widget_size_allocate (GTK_WIDGET (container),
|
||||||
gtk_widget_size_allocate (GTK_WIDGET (container),
|
>K_WIDGET (container)->allocation);
|
||||||
>K_WIDGET (container)->allocation);
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (container));
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1084,8 +1078,9 @@ gtk_container_resize_children (GtkContainer *container)
|
|||||||
widget = node->data;
|
widget = node->data;
|
||||||
|
|
||||||
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
|
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
|
||||||
|
|
||||||
gtk_widget_size_allocate (widget, &widget->allocation);
|
gtk_widget_size_allocate (widget, &widget->allocation);
|
||||||
gtk_widget_queue_draw (widget);
|
|
||||||
gtk_widget_unref (widget);
|
gtk_widget_unref (widget);
|
||||||
}
|
}
|
||||||
g_slist_free (resize_containers);
|
g_slist_free (resize_containers);
|
||||||
|
158
gtk/gtklabel.c
158
gtk/gtklabel.c
@ -1,4 +1,4 @@
|
|||||||
/* GTK - The GIMP Toolkit
|
/* GTK - The GIMP Toolkit
|
||||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -32,7 +32,7 @@ struct _GtkLabelWord
|
|||||||
{
|
{
|
||||||
GdkWChar *beginning;
|
GdkWChar *beginning;
|
||||||
gint length;
|
gint length;
|
||||||
|
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
* We need (space,width) only before we've set (x,y), so to save
|
* We need (space,width) only before we've set (x,y), so to save
|
||||||
* memory, these pairs should really be wrapped in a union.
|
* memory, these pairs should really be wrapped in a union.
|
||||||
@ -126,7 +126,7 @@ gtk_label_class_init (GtkLabelClass *class)
|
|||||||
gtk_object_add_arg_type ("GtkLabel::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
|
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::pattern", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_PATTERN);
|
||||||
gtk_object_add_arg_type ("GtkLabel::justify", GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFY);
|
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->set_arg = gtk_label_set_arg;
|
||||||
object_class->get_arg = gtk_label_get_arg;
|
object_class->get_arg = gtk_label_get_arg;
|
||||||
object_class->finalize = gtk_label_finalize;
|
object_class->finalize = gtk_label_finalize;
|
||||||
@ -141,9 +141,9 @@ gtk_label_set_arg (GtkObject *object,
|
|||||||
guint arg_id)
|
guint arg_id)
|
||||||
{
|
{
|
||||||
GtkLabel *label;
|
GtkLabel *label;
|
||||||
|
|
||||||
label = GTK_LABEL (object);
|
label = GTK_LABEL (object);
|
||||||
|
|
||||||
switch (arg_id)
|
switch (arg_id)
|
||||||
{
|
{
|
||||||
case ARG_LABEL:
|
case ARG_LABEL:
|
||||||
@ -166,9 +166,9 @@ gtk_label_get_arg (GtkObject *object,
|
|||||||
guint arg_id)
|
guint arg_id)
|
||||||
{
|
{
|
||||||
GtkLabel *label;
|
GtkLabel *label;
|
||||||
|
|
||||||
label = GTK_LABEL (object);
|
label = GTK_LABEL (object);
|
||||||
|
|
||||||
switch (arg_id)
|
switch (arg_id)
|
||||||
{
|
{
|
||||||
case ARG_LABEL:
|
case ARG_LABEL:
|
||||||
@ -197,7 +197,7 @@ gtk_label_init (GtkLabel *label)
|
|||||||
label->jtype = GTK_JUSTIFY_CENTER;
|
label->jtype = GTK_JUSTIFY_CENTER;
|
||||||
label->pattern = NULL;
|
label->pattern = NULL;
|
||||||
label->wrap = FALSE;
|
label->wrap = FALSE;
|
||||||
|
|
||||||
gtk_label_set_text (label, "");
|
gtk_label_set_text (label, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,13 +205,13 @@ GtkWidget*
|
|||||||
gtk_label_new (const char *str)
|
gtk_label_new (const char *str)
|
||||||
{
|
{
|
||||||
GtkLabel *label;
|
GtkLabel *label;
|
||||||
|
|
||||||
g_return_val_if_fail (str != NULL, NULL);
|
g_return_val_if_fail (str != NULL, NULL);
|
||||||
|
|
||||||
label = gtk_type_new (gtk_label_get_type ());
|
label = gtk_type_new (gtk_label_get_type ());
|
||||||
|
|
||||||
gtk_label_set_text (label, str);
|
gtk_label_set_text (label, str);
|
||||||
|
|
||||||
return GTK_WIDGET (label);
|
return GTK_WIDGET (label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,17 +224,17 @@ gtk_label_set_text_internal (GtkLabel *label,
|
|||||||
g_free (label->label);
|
g_free (label->label);
|
||||||
if (label->label_wc)
|
if (label->label_wc)
|
||||||
g_free (label->label_wc);
|
g_free (label->label_wc);
|
||||||
|
|
||||||
label->label = str;
|
label->label = str;
|
||||||
label->label_wc = str_wc;
|
label->label_wc = str_wc;
|
||||||
|
|
||||||
gtk_label_free_words (label);
|
gtk_label_free_words (label);
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (label))
|
if (GTK_WIDGET_VISIBLE (label))
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_MAPPED (label))
|
if (GTK_WIDGET_MAPPED (label))
|
||||||
gtk_widget_queue_clear (GTK_WIDGET (label));
|
gtk_widget_queue_clear (GTK_WIDGET (label));
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (label));
|
gtk_widget_queue_resize (GTK_WIDGET (label));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,13 +250,13 @@ gtk_label_set_text (GtkLabel *label,
|
|||||||
g_return_if_fail (label != NULL);
|
g_return_if_fail (label != NULL);
|
||||||
g_return_if_fail (GTK_IS_LABEL (label));
|
g_return_if_fail (GTK_IS_LABEL (label));
|
||||||
g_return_if_fail (str != NULL);
|
g_return_if_fail (str != NULL);
|
||||||
|
|
||||||
/* Convert text to wide characters */
|
/* Convert text to wide characters */
|
||||||
len = strlen (str);
|
len = strlen (str);
|
||||||
str_wc = g_new (GdkWChar, len + 1);
|
str_wc = g_new (GdkWChar, len + 1);
|
||||||
wc_len = gdk_mbstowcs (str_wc, str, len + 1);
|
wc_len = gdk_mbstowcs (str_wc, str, len + 1);
|
||||||
str_wc[wc_len] = '\0';
|
str_wc[wc_len] = '\0';
|
||||||
|
|
||||||
gtk_label_set_text_internal (label, g_strdup (str), str_wc);
|
gtk_label_set_text_internal (label, g_strdup (str), str_wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,14 +285,14 @@ gtk_label_set_justify (GtkLabel *label, GtkJustification jtype)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (label != NULL);
|
g_return_if_fail (label != NULL);
|
||||||
g_return_if_fail (GTK_IS_LABEL (label));
|
g_return_if_fail (GTK_IS_LABEL (label));
|
||||||
|
|
||||||
if ((GtkJustification) label->jtype != jtype)
|
if ((GtkJustification) label->jtype != jtype)
|
||||||
{
|
{
|
||||||
if ((label->jtype == GTK_JUSTIFY_FILL) ||
|
if ((label->jtype == GTK_JUSTIFY_FILL) ||
|
||||||
(jtype == GTK_JUSTIFY_FILL))
|
(jtype == GTK_JUSTIFY_FILL))
|
||||||
/* FIXME: think about this a little */
|
/* FIXME: think about this a little */
|
||||||
gtk_label_free_words (label);
|
gtk_label_free_words (label);
|
||||||
|
|
||||||
label->jtype = jtype;
|
label->jtype = jtype;
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (label))
|
if (GTK_WIDGET_VISIBLE (label))
|
||||||
@ -310,7 +310,7 @@ gtk_label_set_line_wrap (GtkLabel *label, gboolean wrap)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (label != NULL);
|
g_return_if_fail (label != NULL);
|
||||||
g_return_if_fail (GTK_IS_LABEL (label));
|
g_return_if_fail (GTK_IS_LABEL (label));
|
||||||
|
|
||||||
if (label->wrap != wrap) {
|
if (label->wrap != wrap) {
|
||||||
if (GTK_WIDGET_VISIBLE (label))
|
if (GTK_WIDGET_VISIBLE (label))
|
||||||
{
|
{
|
||||||
@ -330,7 +330,7 @@ gtk_label_get (GtkLabel *label,
|
|||||||
g_return_if_fail (label != NULL);
|
g_return_if_fail (label != NULL);
|
||||||
g_return_if_fail (GTK_IS_LABEL (label));
|
g_return_if_fail (GTK_IS_LABEL (label));
|
||||||
g_return_if_fail (str != NULL);
|
g_return_if_fail (str != NULL);
|
||||||
|
|
||||||
*str = label->label;
|
*str = label->label;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ static GtkLabelWord*
|
|||||||
gtk_label_word_alloc ()
|
gtk_label_word_alloc ()
|
||||||
{
|
{
|
||||||
GtkLabelWord * word;
|
GtkLabelWord * word;
|
||||||
|
|
||||||
if (!word_chunk)
|
if (!word_chunk)
|
||||||
{
|
{
|
||||||
word_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
|
word_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
|
||||||
@ -373,7 +373,7 @@ gtk_label_word_alloc ()
|
|||||||
{
|
{
|
||||||
word = g_mem_chunk_alloc (word_chunk);
|
word = g_mem_chunk_alloc (word_chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
word->next = 0;
|
word->next = 0;
|
||||||
word->uline = 0;
|
word->uline = 0;
|
||||||
return word;
|
return word;
|
||||||
@ -383,7 +383,7 @@ static void
|
|||||||
gtk_label_free_words (GtkLabel *label)
|
gtk_label_free_words (GtkLabel *label)
|
||||||
{
|
{
|
||||||
GtkLabelWord * last;
|
GtkLabelWord * last;
|
||||||
|
|
||||||
if (label->words)
|
if (label->words)
|
||||||
{
|
{
|
||||||
for (last = label->words; last->next != 0; last = last->next)
|
for (last = label->words; last->next != 0; last = last->next)
|
||||||
@ -397,7 +397,7 @@ static GtkLabelULine*
|
|||||||
gtk_label_uline_alloc (void)
|
gtk_label_uline_alloc (void)
|
||||||
{
|
{
|
||||||
GtkLabelULine * uline;
|
GtkLabelULine * uline;
|
||||||
|
|
||||||
if (!uline_chunk)
|
if (!uline_chunk)
|
||||||
{
|
{
|
||||||
uline_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
|
uline_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
|
||||||
@ -415,9 +415,9 @@ gtk_label_uline_alloc (void)
|
|||||||
{
|
{
|
||||||
uline = g_mem_chunk_alloc (uline_chunk);
|
uline = g_mem_chunk_alloc (uline_chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
uline->next = NULL;
|
uline->next = NULL;
|
||||||
|
|
||||||
return uline;
|
return uline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ gtk_label_free_ulines (GtkLabelWord *word)
|
|||||||
if (word->uline)
|
if (word->uline)
|
||||||
{
|
{
|
||||||
for (last = word->uline; last->next != 0; last = last->next)
|
for (last = word->uline; last->next != 0; last = last->next)
|
||||||
;
|
;
|
||||||
last->next = free_ulines;
|
last->next = free_ulines;
|
||||||
free_ulines = word->uline;
|
free_ulines = word->uline;
|
||||||
word->uline = 0;
|
word->uline = 0;
|
||||||
@ -455,7 +455,7 @@ gtk_label_split_text (GtkLabel *label)
|
|||||||
max_line_width = 0;
|
max_line_width = 0;
|
||||||
tailp = &label->words;
|
tailp = &label->words;
|
||||||
str = label->label_wc;
|
str = label->label_wc;
|
||||||
|
|
||||||
while (*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
word = gtk_label_word_alloc ();
|
word = gtk_label_word_alloc ();
|
||||||
@ -503,13 +503,13 @@ gtk_label_split_text (GtkLabel *label)
|
|||||||
*tailp = word;
|
*tailp = word;
|
||||||
tailp = &word->next;
|
tailp = &word->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add an empty word to represent an empty line
|
/* Add an empty word to represent an empty line
|
||||||
*/
|
*/
|
||||||
if ((str == label->label_wc) || (str[-1] == '\n'))
|
if ((str == label->label_wc) || (str[-1] == '\n'))
|
||||||
{
|
{
|
||||||
word = gtk_label_word_alloc ();
|
word = gtk_label_word_alloc ();
|
||||||
|
|
||||||
word->space = 0;
|
word->space = 0;
|
||||||
word->beginning = str;
|
word->beginning = str;
|
||||||
word->length = 0;
|
word->length = 0;
|
||||||
@ -654,19 +654,19 @@ gtk_label_finalize_lines (GtkLabel *label,
|
|||||||
|
|
||||||
g_return_if_fail (!label->wrap);
|
g_return_if_fail (!label->wrap);
|
||||||
ptrn = label->pattern;
|
ptrn = label->pattern;
|
||||||
|
|
||||||
y = 0;
|
y = 0;
|
||||||
baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 2;
|
baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 2;
|
||||||
|
|
||||||
for (line = label->words; line; line = line->next)
|
for (line = label->words; line; line = line->next)
|
||||||
{
|
{
|
||||||
if (label->jtype == GTK_JUSTIFY_CENTER)
|
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)
|
else if (label->jtype == GTK_JUSTIFY_RIGHT)
|
||||||
line->x = line_width - line->width;
|
line->x = line_width - line->width;
|
||||||
else
|
else
|
||||||
line->x = 0;
|
line->x = 0;
|
||||||
|
|
||||||
line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
|
line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
|
||||||
y_max = 0;
|
y_max = 0;
|
||||||
|
|
||||||
@ -693,7 +693,7 @@ gtk_label_finalize_lines (GtkLabel *label,
|
|||||||
else if (ptrn[j] == ' ')
|
else if (ptrn[j] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* good. Now we have an underlined segment.
|
/* good. Now we have an underlined segment.
|
||||||
* let's measure it and record it.
|
* let's measure it and record it.
|
||||||
*/
|
*/
|
||||||
@ -740,7 +740,7 @@ gtk_label_finalize_lines_wrap (GtkLabel *label,
|
|||||||
gint x, y, space, extra_width, add_space, baseline_skip;
|
gint x, y, space, extra_width, add_space, baseline_skip;
|
||||||
|
|
||||||
g_return_if_fail (label->wrap);
|
g_return_if_fail (label->wrap);
|
||||||
|
|
||||||
ptrn = label->pattern;
|
ptrn = label->pattern;
|
||||||
y = 0;
|
y = 0;
|
||||||
baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 1;
|
baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 1;
|
||||||
@ -753,18 +753,18 @@ gtk_label_finalize_lines_wrap (GtkLabel *label,
|
|||||||
for (next_line = line->next; next_line; next_line = next_line->next)
|
for (next_line = line->next; next_line; next_line = next_line->next)
|
||||||
{
|
{
|
||||||
if (next_line->space == 0)
|
if (next_line->space == 0)
|
||||||
break; /* New paragraph */
|
break; /* New paragraph */
|
||||||
if (next_line->space + next_line->width > extra_width)
|
if (next_line->space + next_line->width > extra_width)
|
||||||
break;
|
break;
|
||||||
extra_width -= next_line->space + next_line->width;
|
extra_width -= next_line->space + next_line->width;
|
||||||
space += next_line->space;
|
space += next_line->space;
|
||||||
}
|
}
|
||||||
|
|
||||||
line->x = 0;
|
line->x = 0;
|
||||||
line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
|
line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
|
||||||
x = line->width;
|
x = line->width;
|
||||||
add_space = 0;
|
add_space = 0;
|
||||||
|
|
||||||
for (word = line->next; word != next_line; word = word->next)
|
for (word = line->next; word != next_line; word = word->next)
|
||||||
{
|
{
|
||||||
if (next_line && next_line->space)
|
if (next_line && next_line->space)
|
||||||
@ -781,16 +781,16 @@ gtk_label_finalize_lines_wrap (GtkLabel *label,
|
|||||||
word->y = line->y;
|
word->y = line->y;
|
||||||
x = word->x + word->width;
|
x = word->x + word->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
y += (baseline_skip);
|
y += (baseline_skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
label->max_width = line_width;
|
label->max_width = line_width;
|
||||||
widget = GTK_WIDGET (label);
|
widget = GTK_WIDGET (label);
|
||||||
widget->requisition.width = line_width + 2 * label->misc.xpad;
|
widget->requisition.width = line_width + 2 * label->misc.xpad;
|
||||||
widget->requisition.height = y + 2 * label->misc.ypad + 1;
|
widget->requisition.height = y + 2 * label->misc.ypad + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_label_size_request (GtkWidget *widget,
|
gtk_label_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition)
|
GtkRequisition *requisition)
|
||||||
@ -800,9 +800,9 @@ gtk_label_size_request (GtkWidget *widget,
|
|||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_LABEL (widget));
|
g_return_if_fail (GTK_IS_LABEL (widget));
|
||||||
g_return_if_fail (requisition != NULL);
|
g_return_if_fail (requisition != NULL);
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are a number of conditions which will necessitate re-filling
|
* There are a number of conditions which will necessitate re-filling
|
||||||
* our text:
|
* our text:
|
||||||
@ -823,7 +823,7 @@ gtk_label_size_request (GtkWidget *widget,
|
|||||||
* Too much of a pain to detect all these case, so always re-fill. I
|
* Too much of a pain to detect all these case, so always re-fill. I
|
||||||
* don't think it's really that slow.
|
* don't think it's really that slow.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (label->wrap)
|
if (label->wrap)
|
||||||
{
|
{
|
||||||
GtkWidgetAuxInfo *aux_info;
|
GtkWidgetAuxInfo *aux_info;
|
||||||
@ -840,7 +840,7 @@ gtk_label_size_request (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
label->max_width = gdk_string_width (GTK_WIDGET (label)->style->font,
|
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, (gdk_screen_width () + 1) / 2);
|
||||||
label->max_width = MIN (label->max_width, longest_paragraph);
|
label->max_width = MIN (label->max_width, longest_paragraph);
|
||||||
if (longest_paragraph > 0)
|
if (longest_paragraph > 0)
|
||||||
@ -850,8 +850,8 @@ gtk_label_size_request (GtkWidget *widget,
|
|||||||
nlines = (longest_paragraph + label->max_width - 1) / label->max_width;
|
nlines = (longest_paragraph + label->max_width - 1) / label->max_width;
|
||||||
perfect_width = (longest_paragraph + nlines - 1) / nlines;
|
perfect_width = (longest_paragraph + nlines - 1) / nlines;
|
||||||
label->max_width = gtk_label_pick_width (label,
|
label->max_width = gtk_label_pick_width (label,
|
||||||
perfect_width,
|
perfect_width,
|
||||||
label->max_width);
|
label->max_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gtk_label_finalize_lines_wrap (label, label->max_width);
|
gtk_label_finalize_lines_wrap (label, label->max_width);
|
||||||
@ -861,21 +861,22 @@ gtk_label_size_request (GtkWidget *widget,
|
|||||||
label->max_width = gtk_label_split_text (label);
|
label->max_width = gtk_label_split_text (label);
|
||||||
gtk_label_finalize_lines (label, label->max_width);
|
gtk_label_finalize_lines (label, label->max_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requisition != &widget->requisition)
|
if (requisition != &widget->requisition)
|
||||||
*requisition = widget->requisition;
|
*requisition = widget->requisition;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_label_paint_word (GtkLabel *label,
|
gtk_label_paint_word (GtkLabel *label,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
GtkLabelWord *word,
|
GtkLabelWord *word,
|
||||||
GdkRectangle *area)
|
GdkRectangle *area)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (label);
|
GtkWidget *widget = GTK_WIDGET (label);
|
||||||
GtkLabelULine *uline;
|
GtkLabelULine *uline;
|
||||||
gchar *tmp_str;
|
gchar *tmp_str;
|
||||||
|
|
||||||
tmp_str = gdk_wcstombs (word->beginning);
|
tmp_str = gdk_wcstombs (word->beginning);
|
||||||
gtk_paint_string (widget->style, widget->window, widget->state,
|
gtk_paint_string (widget->style, widget->window, widget->state,
|
||||||
area, widget, "label",
|
area, widget, "label",
|
||||||
@ -884,14 +885,15 @@ gtk_label_paint_word (GtkLabel *label,
|
|||||||
tmp_str);
|
tmp_str);
|
||||||
g_free (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,
|
gtk_paint_hline (widget->style, widget->window,
|
||||||
widget->state, area,
|
widget->state, area,
|
||||||
widget, "label",
|
widget, "label",
|
||||||
x + uline->x1, x +uline->x2, y + uline->y);
|
x + uline->x1, x + uline->x2, y + uline->y);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_label_expose (GtkWidget *widget,
|
gtk_label_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event)
|
GdkEventExpose *event)
|
||||||
@ -900,28 +902,28 @@ gtk_label_expose (GtkWidget *widget,
|
|||||||
GtkMisc *misc;
|
GtkMisc *misc;
|
||||||
GtkLabelWord *word;
|
GtkLabelWord *word;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
|
||||||
g_return_val_if_fail (widget != NULL, FALSE);
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
g_return_val_if_fail (GTK_IS_LABEL (widget), FALSE);
|
g_return_val_if_fail (GTK_IS_LABEL (widget), FALSE);
|
||||||
g_return_val_if_fail (event != NULL, FALSE);
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
|
||||||
label = GTK_LABEL (widget);
|
label = GTK_LABEL (widget);
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
|
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
|
||||||
label->label && (*label->label != '\0'))
|
label->label && (*label->label != '\0'))
|
||||||
{
|
{
|
||||||
misc = GTK_MISC (widget);
|
misc = GTK_MISC (widget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GC Clipping
|
* GC Clipping
|
||||||
*/
|
*/
|
||||||
gdk_gc_set_clip_rectangle (widget->style->white_gc, &event->area);
|
gdk_gc_set_clip_rectangle (widget->style->white_gc, &event->area);
|
||||||
gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state], &event->area);
|
gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state], &event->area);
|
||||||
|
|
||||||
x = widget->allocation.x + misc->xpad +
|
x = widget->allocation.x + misc->xpad +
|
||||||
(widget->allocation.width - label->max_width)
|
(widget->allocation.width - label->max_width)
|
||||||
* misc->xalign + 0.5;
|
* misc->xalign + 0.5;
|
||||||
|
|
||||||
y = (widget->allocation.y
|
y = (widget->allocation.y
|
||||||
+ (widget->allocation.height
|
+ (widget->allocation.height
|
||||||
- widget->requisition.height) * misc->yalign
|
- widget->requisition.height) * misc->yalign
|
||||||
@ -933,15 +935,17 @@ gtk_label_expose (GtkWidget *widget,
|
|||||||
gtk_label_paint_word (label, x, y, word, &event->area);
|
gtk_label_paint_word (label, x, y, word, &event->area);
|
||||||
word->beginning[word->length] = save;
|
word->beginning[word->length] = save;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
|
gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
|
||||||
gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL);
|
gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
gtk_label_parse_uline (GtkLabel *label,
|
gtk_label_parse_uline (GtkLabel *label,
|
||||||
const gchar *string)
|
const gchar *string)
|
||||||
{
|
{
|
||||||
guint accel_key = GDK_VoidSymbol;
|
guint accel_key = GDK_VoidSymbol;
|
||||||
GdkWChar *p, *q, *string_wc;
|
GdkWChar *p, *q, *string_wc;
|
||||||
@ -949,7 +953,7 @@ gtk_label_parse_uline (GtkLabel *label,
|
|||||||
gchar *pattern;
|
gchar *pattern;
|
||||||
gint length, wc_length;
|
gint length, wc_length;
|
||||||
gboolean underscore;
|
gboolean underscore;
|
||||||
|
|
||||||
/* Convert text to wide characters */
|
/* Convert text to wide characters */
|
||||||
length = strlen (string);
|
length = strlen (string);
|
||||||
string_wc = g_new (GdkWChar, length + 1);
|
string_wc = g_new (GdkWChar, length + 1);
|
||||||
@ -957,12 +961,12 @@ gtk_label_parse_uline (GtkLabel *label,
|
|||||||
string_wc[wc_length] = '\0';
|
string_wc[wc_length] = '\0';
|
||||||
|
|
||||||
pattern = g_new (gchar, length+1);
|
pattern = g_new (gchar, length+1);
|
||||||
|
|
||||||
underscore = FALSE;
|
underscore = FALSE;
|
||||||
|
|
||||||
p = q = string_wc;
|
p = q = string_wc;
|
||||||
r = pattern;
|
r = pattern;
|
||||||
|
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
if (underscore)
|
if (underscore)
|
||||||
@ -975,7 +979,7 @@ gtk_label_parse_uline (GtkLabel *label,
|
|||||||
if (accel_key == GDK_VoidSymbol)
|
if (accel_key == GDK_VoidSymbol)
|
||||||
accel_key = gdk_keyval_to_lower (*p);
|
accel_key = gdk_keyval_to_lower (*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
*q++ = *p;
|
*q++ = *p;
|
||||||
underscore = FALSE;
|
underscore = FALSE;
|
||||||
}
|
}
|
||||||
@ -993,11 +997,11 @@ gtk_label_parse_uline (GtkLabel *label,
|
|||||||
}
|
}
|
||||||
*q = 0;
|
*q = 0;
|
||||||
*r = 0;
|
*r = 0;
|
||||||
|
|
||||||
gtk_label_set_text_internal (label, gdk_wcstombs (string_wc), string_wc);
|
gtk_label_set_text_internal (label, gdk_wcstombs (string_wc), string_wc);
|
||||||
gtk_label_set_pattern (label, pattern);
|
gtk_label_set_pattern (label, pattern);
|
||||||
|
|
||||||
g_free (pattern);
|
g_free (pattern);
|
||||||
|
|
||||||
return accel_key;
|
return accel_key;
|
||||||
}
|
}
|
||||||
|
@ -328,6 +328,7 @@ gtk_notebook_init (GtkNotebook *notebook)
|
|||||||
notebook->button = 0;
|
notebook->button = 0;
|
||||||
notebook->need_timer = 0;
|
notebook->need_timer = 0;
|
||||||
notebook->child_has_focus = FALSE;
|
notebook->child_has_focus = FALSE;
|
||||||
|
notebook->have_visible_child = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
@ -882,17 +883,36 @@ gtk_notebook_draw (GtkWidget *widget,
|
|||||||
g_return_if_fail (GTK_IS_NOTEBOOK (widget));
|
g_return_if_fail (GTK_IS_NOTEBOOK (widget));
|
||||||
g_return_if_fail (area != NULL);
|
g_return_if_fail (area != NULL);
|
||||||
|
|
||||||
|
notebook = GTK_NOTEBOOK (widget);
|
||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (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);
|
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_intersect (notebook->cur_page->child, area, &child_area))
|
||||||
gtk_widget_draw (notebook->cur_page->child, &child_area);
|
gtk_widget_draw (notebook->cur_page->child, &child_area);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
notebook->have_visible_child = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -2110,11 +2130,10 @@ gtk_notebook_paint (GtkWidget *widget,
|
|||||||
|
|
||||||
if (notebook->show_border && (!notebook->show_tabs || !notebook->children))
|
if (notebook->show_border && (!notebook->show_tabs || !notebook->children))
|
||||||
{
|
{
|
||||||
|
gtk_paint_box (widget->style, widget->window,
|
||||||
gtk_paint_box(widget->style, widget->window,
|
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
||||||
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
area, widget, "notebook",
|
||||||
area, widget, "notebook",
|
x, y, width, height);
|
||||||
x, y, width, height);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,16 +59,17 @@ struct _GtkNotebook
|
|||||||
guint16 tab_hborder;
|
guint16 tab_hborder;
|
||||||
guint16 tab_vborder;
|
guint16 tab_vborder;
|
||||||
|
|
||||||
guint show_tabs : 1;
|
guint show_tabs : 1;
|
||||||
guint homogeneous : 1;
|
guint homogeneous : 1;
|
||||||
guint show_border : 1;
|
guint show_border : 1;
|
||||||
guint tab_pos : 2;
|
guint tab_pos : 2;
|
||||||
guint scrollable : 1;
|
guint scrollable : 1;
|
||||||
guint in_child : 2;
|
guint in_child : 2;
|
||||||
guint click_child : 2;
|
guint click_child : 2;
|
||||||
guint button : 2;
|
guint button : 2;
|
||||||
guint need_timer : 1;
|
guint need_timer : 1;
|
||||||
guint child_has_focus : 1;
|
guint child_has_focus : 1;
|
||||||
|
guint have_visible_child : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkNotebookClass
|
struct _GtkNotebookClass
|
||||||
|
@ -343,8 +343,10 @@ gtk_radio_button_clicked (GtkButton *button)
|
|||||||
|
|
||||||
if (GTK_WIDGET_STATE (button) != new_state)
|
if (GTK_WIDGET_STATE (button) != new_state)
|
||||||
gtk_widget_set_state (GTK_WIDGET (button), new_state);
|
gtk_widget_set_state (GTK_WIDGET (button), new_state);
|
||||||
|
|
||||||
if (toggled)
|
if (toggled)
|
||||||
gtk_toggle_button_toggled (toggle_button);
|
gtk_toggle_button_toggled (toggle_button);
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (button));
|
gtk_widget_queue_draw (GTK_WIDGET (button));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
187
gtk/gtkstyle.c
187
gtk/gtkstyle.c
@ -687,43 +687,6 @@ gtk_style_destroy (GtkStyle *style)
|
|||||||
g_free (style);
|
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
|
void
|
||||||
gtk_draw_hline (GtkStyle *style,
|
gtk_draw_hline (GtkStyle *style,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -1088,16 +1051,54 @@ gtk_draw_handle (GtkStyle *style,
|
|||||||
(*style->klass->draw_handle) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
|
(*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 */
|
/* Default functions */
|
||||||
void
|
void
|
||||||
gtk_style_apply_default_pixmap (GtkStyle *style,
|
gtk_style_apply_default_background (GtkStyle *style,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GtkStateType state_type,
|
gboolean copy_area,
|
||||||
GdkRectangle *area,
|
GtkStateType state_type,
|
||||||
gint x,
|
GdkRectangle *area,
|
||||||
gint y,
|
gint x,
|
||||||
gint width,
|
gint y,
|
||||||
gint height)
|
gint width,
|
||||||
|
gint height)
|
||||||
{
|
{
|
||||||
GdkRectangle new_rect, old_rect;
|
GdkRectangle new_rect, old_rect;
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
@ -1122,12 +1123,15 @@ gtk_style_apply_default_pixmap (GtkStyle *style,
|
|||||||
gdk_draw_rectangle (window, gc, TRUE,
|
gdk_draw_rectangle (window, gc, TRUE,
|
||||||
x, y, width, height);
|
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)
|
if (!copy_area)
|
||||||
gdk_window_set_back_pixmap (window, NULL, TRUE);
|
{
|
||||||
else
|
if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
|
||||||
gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
|
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.x = x;
|
||||||
old_rect.y = y;
|
old_rect.y = y;
|
||||||
@ -1139,6 +1143,23 @@ gtk_style_apply_default_pixmap (GtkStyle *style,
|
|||||||
else
|
else
|
||||||
gdk_window_clear_area (window, x, y, width, height);
|
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
|
static void
|
||||||
@ -2126,7 +2147,9 @@ gtk_default_draw_box (GtkStyle *style,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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,
|
gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
|
||||||
x, y, width, height);
|
x, y, width, height);
|
||||||
@ -2184,7 +2207,9 @@ gtk_default_draw_flat_box (GtkStyle *style,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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
|
static void
|
||||||
@ -2519,8 +2544,9 @@ gtk_default_draw_box_gap (GtkStyle *style,
|
|||||||
g_return_if_fail (style != NULL);
|
g_return_if_fail (style != NULL);
|
||||||
g_return_if_fail (window != NULL);
|
g_return_if_fail (window != NULL);
|
||||||
|
|
||||||
gtk_style_apply_default_pixmap(style, window, state_type, area,
|
gtk_style_apply_default_background (style, window,
|
||||||
x, y, width, height);
|
widget && GTK_WIDGET_NO_WINDOW (widget),
|
||||||
|
state_type, area, x, y, width, height);
|
||||||
|
|
||||||
if ((width == -1) && (height == -1))
|
if ((width == -1) && (height == -1))
|
||||||
gdk_window_get_size (window, &width, &height);
|
gdk_window_get_size (window, &width, &height);
|
||||||
@ -2740,8 +2766,9 @@ gtk_default_draw_extension (GtkStyle *style,
|
|||||||
g_return_if_fail (style != NULL);
|
g_return_if_fail (style != NULL);
|
||||||
g_return_if_fail (window != NULL);
|
g_return_if_fail (window != NULL);
|
||||||
|
|
||||||
gtk_style_apply_default_pixmap(style, window, GTK_STATE_NORMAL, area,
|
gtk_style_apply_default_background (style, window,
|
||||||
x, y, width, height);
|
widget && GTK_WIDGET_NO_WINDOW (widget),
|
||||||
|
GTK_STATE_NORMAL, area, x, y, width, height);
|
||||||
|
|
||||||
if ((width == -1) && (height == -1))
|
if ((width == -1) && (height == -1))
|
||||||
gdk_window_get_size (window, &width, &height);
|
gdk_window_get_size (window, &width, &height);
|
||||||
@ -2796,11 +2823,13 @@ gtk_default_draw_extension (GtkStyle *style,
|
|||||||
switch (gap_side)
|
switch (gap_side)
|
||||||
{
|
{
|
||||||
case GTK_POS_TOP:
|
case GTK_POS_TOP:
|
||||||
gtk_style_apply_default_pixmap(style, window, state_type, area,
|
gtk_style_apply_default_background (style, window,
|
||||||
x + style->klass->xthickness,
|
widget && GTK_WIDGET_NO_WINDOW (widget),
|
||||||
y,
|
state_type, area,
|
||||||
width - (2 * style->klass->xthickness),
|
x + style->klass->xthickness,
|
||||||
height - (style->klass->ythickness));
|
y,
|
||||||
|
width - (2 * style->klass->xthickness),
|
||||||
|
height - (style->klass->ythickness));
|
||||||
gdk_draw_line (window, gc1,
|
gdk_draw_line (window, gc1,
|
||||||
x, y, x, y + height - 2);
|
x, y, x, y + height - 2);
|
||||||
gdk_draw_line (window, gc2,
|
gdk_draw_line (window, gc2,
|
||||||
@ -2816,11 +2845,13 @@ gtk_default_draw_extension (GtkStyle *style,
|
|||||||
x + width - 1, y, x + width - 1, y + height - 2);
|
x + width - 1, y, x + width - 1, y + height - 2);
|
||||||
break;
|
break;
|
||||||
case GTK_POS_BOTTOM:
|
case GTK_POS_BOTTOM:
|
||||||
gtk_style_apply_default_pixmap(style, window, state_type, area,
|
gtk_style_apply_default_background (style, window,
|
||||||
x + style->klass->xthickness,
|
widget && GTK_WIDGET_NO_WINDOW (widget),
|
||||||
y + style->klass->ythickness,
|
state_type, area,
|
||||||
width - (2 * style->klass->xthickness),
|
x + style->klass->xthickness,
|
||||||
height - (style->klass->ythickness));
|
y + style->klass->ythickness,
|
||||||
|
width - (2 * style->klass->xthickness),
|
||||||
|
height - (style->klass->ythickness));
|
||||||
gdk_draw_line (window, gc1,
|
gdk_draw_line (window, gc1,
|
||||||
x + 1, y, x + width - 2, y);
|
x + 1, y, x + width - 2, y);
|
||||||
gdk_draw_line (window, gc1,
|
gdk_draw_line (window, gc1,
|
||||||
@ -2836,11 +2867,13 @@ gtk_default_draw_extension (GtkStyle *style,
|
|||||||
x + width - 1, y + 1, x + width - 1, y + height - 1);
|
x + width - 1, y + 1, x + width - 1, y + height - 1);
|
||||||
break;
|
break;
|
||||||
case GTK_POS_LEFT:
|
case GTK_POS_LEFT:
|
||||||
gtk_style_apply_default_pixmap(style, window, state_type, area,
|
gtk_style_apply_default_background (style, window,
|
||||||
x,
|
widget && GTK_WIDGET_NO_WINDOW (widget),
|
||||||
y + style->klass->ythickness,
|
state_type, area,
|
||||||
width - (style->klass->xthickness),
|
x,
|
||||||
height - (2 * style->klass->ythickness));
|
y + style->klass->ythickness,
|
||||||
|
width - (style->klass->xthickness),
|
||||||
|
height - (2 * style->klass->ythickness));
|
||||||
gdk_draw_line (window, gc1,
|
gdk_draw_line (window, gc1,
|
||||||
x, y, x + width - 2, y);
|
x, y, x + width - 2, y);
|
||||||
gdk_draw_line (window, gc2,
|
gdk_draw_line (window, gc2,
|
||||||
@ -2856,11 +2889,13 @@ gtk_default_draw_extension (GtkStyle *style,
|
|||||||
x + width - 1, y + 1, x + width - 1, y + height - 2);
|
x + width - 1, y + 1, x + width - 1, y + height - 2);
|
||||||
break;
|
break;
|
||||||
case GTK_POS_RIGHT:
|
case GTK_POS_RIGHT:
|
||||||
gtk_style_apply_default_pixmap(style, window, state_type, area,
|
gtk_style_apply_default_background (style, window,
|
||||||
x + style->klass->xthickness,
|
widget && GTK_WIDGET_NO_WINDOW (widget),
|
||||||
y + style->klass->ythickness,
|
state_type, area,
|
||||||
width - (style->klass->xthickness),
|
x + style->klass->xthickness,
|
||||||
height - (2 * style->klass->ythickness));
|
y + style->klass->ythickness,
|
||||||
|
width - (style->klass->xthickness),
|
||||||
|
height - (2 * style->klass->ythickness));
|
||||||
gdk_draw_line (window, gc1,
|
gdk_draw_line (window, gc1,
|
||||||
x + 1, y, x + width - 1, y);
|
x + 1, y, x + width - 1, y);
|
||||||
gdk_draw_line (window, gc1,
|
gdk_draw_line (window, gc1,
|
||||||
|
@ -332,24 +332,25 @@ struct _GtkStyleClass
|
|||||||
GtkOrientation orientation);
|
GtkOrientation orientation);
|
||||||
};
|
};
|
||||||
|
|
||||||
GtkStyle* gtk_style_new (void);
|
GtkStyle* gtk_style_new (void);
|
||||||
GtkStyle* gtk_style_copy (GtkStyle *style);
|
GtkStyle* gtk_style_copy (GtkStyle *style);
|
||||||
GtkStyle* gtk_style_attach (GtkStyle *style,
|
GtkStyle* gtk_style_attach (GtkStyle *style,
|
||||||
GdkWindow *window);
|
GdkWindow *window);
|
||||||
void gtk_style_detach (GtkStyle *style);
|
void gtk_style_detach (GtkStyle *style);
|
||||||
GtkStyle* gtk_style_ref (GtkStyle *style);
|
GtkStyle* gtk_style_ref (GtkStyle *style);
|
||||||
void gtk_style_unref (GtkStyle *style);
|
void gtk_style_unref (GtkStyle *style);
|
||||||
void gtk_style_set_background (GtkStyle *style,
|
void gtk_style_set_background (GtkStyle *style,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GtkStateType state_type);
|
GtkStateType state_type);
|
||||||
void gtk_style_apply_default_pixmap(GtkStyle *style,
|
void gtk_style_apply_default_background (GtkStyle *style,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GtkStateType state_type,
|
gboolean copy_area,
|
||||||
GdkRectangle *area,
|
GtkStateType state_type,
|
||||||
gint x,
|
GdkRectangle *area,
|
||||||
gint y,
|
gint x,
|
||||||
gint width,
|
gint y,
|
||||||
gint height);
|
gint width,
|
||||||
|
gint height);
|
||||||
|
|
||||||
void gtk_draw_hline (GtkStyle *style,
|
void gtk_draw_hline (GtkStyle *style,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
|
@ -42,8 +42,12 @@ static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass);
|
|||||||
static void gtk_toggle_button_init (GtkToggleButton *toggle_button);
|
static void gtk_toggle_button_init (GtkToggleButton *toggle_button);
|
||||||
static void gtk_toggle_button_paint (GtkWidget *widget,
|
static void gtk_toggle_button_paint (GtkWidget *widget,
|
||||||
GdkRectangle *area);
|
GdkRectangle *area);
|
||||||
|
static void gtk_toggle_button_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation);
|
||||||
static void gtk_toggle_button_draw (GtkWidget *widget,
|
static void gtk_toggle_button_draw (GtkWidget *widget,
|
||||||
GdkRectangle *area);
|
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_pressed (GtkButton *button);
|
||||||
static void gtk_toggle_button_released (GtkButton *button);
|
static void gtk_toggle_button_released (GtkButton *button);
|
||||||
static void gtk_toggle_button_clicked (GtkButton *button);
|
static void gtk_toggle_button_clicked (GtkButton *button);
|
||||||
@ -120,7 +124,9 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
|
|||||||
object_class->set_arg = gtk_toggle_button_set_arg;
|
object_class->set_arg = gtk_toggle_button_set_arg;
|
||||||
object_class->get_arg = gtk_toggle_button_get_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->draw = gtk_toggle_button_draw;
|
||||||
|
widget_class->expose_event = gtk_toggle_button_expose;
|
||||||
widget_class->realize = gtk_toggle_button_realize;
|
widget_class->realize = gtk_toggle_button_realize;
|
||||||
widget_class->unrealize = gtk_toggle_button_unrealize;
|
widget_class->unrealize = gtk_toggle_button_unrealize;
|
||||||
widget_class->map = gtk_toggle_button_map;
|
widget_class->map = gtk_toggle_button_map;
|
||||||
@ -140,6 +146,7 @@ gtk_toggle_button_init (GtkToggleButton *toggle_button)
|
|||||||
{
|
{
|
||||||
toggle_button->active = FALSE;
|
toggle_button->active = FALSE;
|
||||||
toggle_button->draw_indicator = FALSE;
|
toggle_button->draw_indicator = FALSE;
|
||||||
|
GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,13 +241,26 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
|
|||||||
|
|
||||||
gtk_widget_unrealize (widget);
|
gtk_widget_unrealize (widget);
|
||||||
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);
|
||||||
|
|
||||||
gtk_widget_realize (widget);
|
gtk_widget_realize (widget);
|
||||||
|
|
||||||
if (visible)
|
if (visible)
|
||||||
gtk_widget_show (widget);
|
gtk_widget_show (widget);
|
||||||
}
|
}
|
||||||
else
|
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))
|
if (GTK_WIDGET_VISIBLE (toggle_button))
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
|
gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
|
||||||
@ -280,11 +300,11 @@ gtk_toggle_button_paint (GtkWidget *widget,
|
|||||||
gint width, height;
|
gint width, height;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
|
||||||
|
button = GTK_BUTTON (widget);
|
||||||
|
toggle_button = GTK_TOGGLE_BUTTON (widget);
|
||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (widget))
|
if (GTK_WIDGET_DRAWABLE (widget))
|
||||||
{
|
{
|
||||||
button = GTK_BUTTON (widget);
|
|
||||||
toggle_button = GTK_TOGGLE_BUTTON (widget);
|
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
|
width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
|
||||||
@ -348,6 +368,26 @@ gtk_toggle_button_paint (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
gtk_toggle_button_draw (GtkWidget *widget,
|
gtk_toggle_button_draw (GtkWidget *widget,
|
||||||
GdkRectangle *area)
|
GdkRectangle *area)
|
||||||
@ -362,7 +402,7 @@ gtk_toggle_button_draw (GtkWidget *widget,
|
|||||||
|
|
||||||
bin = GTK_BIN (widget);
|
bin = GTK_BIN (widget);
|
||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (widget))
|
if (GTK_WIDGET_DRAWABLE (widget) && !GTK_WIDGET_NO_WINDOW (widget))
|
||||||
{
|
{
|
||||||
tmp_area = *area;
|
tmp_area = *area;
|
||||||
tmp_area.x -= GTK_CONTAINER (widget)->border_width;
|
tmp_area.x -= GTK_CONTAINER (widget)->border_width;
|
||||||
@ -519,9 +559,8 @@ gtk_toggle_button_realize (GtkWidget *widget)
|
|||||||
GDK_ENTER_NOTIFY_MASK |
|
GDK_ENTER_NOTIFY_MASK |
|
||||||
GDK_LEAVE_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.wclass = GDK_INPUT_ONLY;
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||||
|
|
||||||
@ -534,7 +573,6 @@ gtk_toggle_button_realize (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
|
|
||||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||||
attributes.visual = gtk_widget_get_visual (widget);
|
attributes.visual = gtk_widget_get_visual (widget);
|
||||||
@ -546,7 +584,7 @@ gtk_toggle_button_realize (GtkWidget *widget)
|
|||||||
|
|
||||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
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);
|
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +598,7 @@ gtk_toggle_button_unrealize (GtkWidget *widget)
|
|||||||
|
|
||||||
toggle_button = GTK_TOGGLE_BUTTON (widget);
|
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_set_user_data (toggle_button->event_window, NULL);
|
||||||
gdk_window_destroy (toggle_button->event_window);
|
gdk_window_destroy (toggle_button->event_window);
|
||||||
@ -577,7 +615,7 @@ gtk_toggle_button_map (GtkWidget *widget)
|
|||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
|
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);
|
gdk_window_show (GTK_TOGGLE_BUTTON (widget)->event_window);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
||||||
@ -589,7 +627,7 @@ gtk_toggle_button_unmap (GtkWidget *widget)
|
|||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
|
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);
|
gdk_window_hide (GTK_TOGGLE_BUTTON (widget)->event_window);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
|
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
|
||||||
|
240
gtk/gtkwidget.c
240
gtk/gtkwidget.c
@ -1206,15 +1206,19 @@ gtk_widget_setv (GtkWidget *widget,
|
|||||||
gtk_object_setv (GTK_OBJECT (widget), nargs, args);
|
gtk_object_setv (GTK_OBJECT (widget), nargs, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************
|
static inline void
|
||||||
* gtk_widget_unparent:
|
gtk_widget_queue_clear_child (GtkWidget *widget)
|
||||||
* do any cleanup necessary necessary
|
{
|
||||||
* for setting parent = NULL.
|
GtkWidget *parent;
|
||||||
*
|
|
||||||
* arguments:
|
parent = widget->parent;
|
||||||
*
|
if (parent && GTK_WIDGET_DRAWABLE (parent))
|
||||||
* results:
|
gtk_widget_queue_clear_area (parent,
|
||||||
*****************************************/
|
widget->allocation.x,
|
||||||
|
widget->allocation.y,
|
||||||
|
widget->allocation.width,
|
||||||
|
widget->allocation.height);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_widget_unparent (GtkWidget *widget)
|
gtk_widget_unparent (GtkWidget *widget)
|
||||||
@ -1336,10 +1340,8 @@ gtk_widget_unparent (GtkWidget *widget)
|
|||||||
|
|
||||||
toplevel = toplevel->parent;
|
toplevel = toplevel->parent;
|
||||||
}
|
}
|
||||||
if (widget->window &&
|
|
||||||
GTK_WIDGET_NO_WINDOW (widget) &&
|
gtk_widget_queue_clear_child (widget);
|
||||||
GTK_WIDGET_DRAWABLE (widget))
|
|
||||||
gtk_widget_queue_clear (widget);
|
|
||||||
|
|
||||||
/* Reset the width and height here, to force reallocation if we
|
/* 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
|
* get added back to a new parent. This won't work if our new
|
||||||
@ -1415,9 +1417,26 @@ gtk_widget_show (GtkWidget *widget)
|
|||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (!GTK_WIDGET_VISIBLE (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:
|
* gtk_widget_show_now:
|
||||||
@ -1478,7 +1497,25 @@ gtk_widget_hide (GtkWidget *widget)
|
|||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (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
|
gint
|
||||||
@ -1538,8 +1575,10 @@ gtk_widget_map (GtkWidget *widget)
|
|||||||
{
|
{
|
||||||
if (!GTK_WIDGET_REALIZED (widget))
|
if (!GTK_WIDGET_REALIZED (widget))
|
||||||
gtk_widget_realize (widget);
|
gtk_widget_realize (widget);
|
||||||
|
|
||||||
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[MAP]);
|
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[MAP]);
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1558,7 +1597,10 @@ gtk_widget_unmap (GtkWidget *widget)
|
|||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (GTK_WIDGET_MAPPED (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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
@ -1843,20 +1885,23 @@ gtk_widget_redraw_queue_remove (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_widget_queue_clear (GtkWidget *widget)
|
gtk_widget_queue_clear (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (GTK_WIDGET_NO_WINDOW (widget))
|
if (widget->allocation.width || widget->allocation.height)
|
||||||
gtk_widget_queue_clear_area (widget, widget->allocation.x,
|
{
|
||||||
widget->allocation.y,
|
if (GTK_WIDGET_NO_WINDOW (widget))
|
||||||
widget->allocation.width,
|
gtk_widget_queue_clear_area (widget, widget->allocation.x,
|
||||||
widget->allocation.height);
|
widget->allocation.y,
|
||||||
else
|
widget->allocation.width,
|
||||||
gtk_widget_queue_clear_area (widget, 0, 0,
|
widget->allocation.height);
|
||||||
widget->allocation.width,
|
else
|
||||||
widget->allocation.height);
|
gtk_widget_queue_clear_area (widget, 0, 0,
|
||||||
|
widget->allocation.width,
|
||||||
|
widget->allocation.height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -2175,6 +2220,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
|
|||||||
if (GTK_IS_RESIZE_CONTAINER (widget))
|
if (GTK_IS_RESIZE_CONTAINER (widget))
|
||||||
gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
|
gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
|
||||||
|
|
||||||
|
if (GTK_WIDGET_DRAWABLE (widget))
|
||||||
|
gtk_widget_queue_clear (widget);
|
||||||
|
|
||||||
if (widget->parent)
|
if (widget->parent)
|
||||||
gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
|
gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
|
||||||
else if (GTK_WIDGET_TOPLEVEL (widget))
|
else if (GTK_WIDGET_TOPLEVEL (widget))
|
||||||
@ -2302,6 +2350,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkWidgetAuxInfo *aux_info;
|
GtkWidgetAuxInfo *aux_info;
|
||||||
GtkAllocation real_allocation;
|
GtkAllocation real_allocation;
|
||||||
|
gboolean needs_draw = FALSE;
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
@ -2317,7 +2366,46 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
real_allocation.y = aux_info->y;
|
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);
|
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
|
static void
|
||||||
@ -4189,60 +4277,6 @@ gtk_widget_finalize (GtkObject *object)
|
|||||||
parent_class->finalize (object);
|
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:
|
* gtk_widget_real_map:
|
||||||
*
|
*
|
||||||
@ -4263,8 +4297,6 @@ gtk_widget_real_map (GtkWidget *widget)
|
|||||||
|
|
||||||
if (!GTK_WIDGET_NO_WINDOW (widget))
|
if (!GTK_WIDGET_NO_WINDOW (widget))
|
||||||
gdk_window_show (widget->window);
|
gdk_window_show (widget->window);
|
||||||
else
|
|
||||||
gtk_widget_queue_draw (widget);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4285,10 +4317,8 @@ gtk_widget_real_unmap (GtkWidget *widget)
|
|||||||
if (GTK_WIDGET_MAPPED (widget))
|
if (GTK_WIDGET_MAPPED (widget))
|
||||||
{
|
{
|
||||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
|
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
|
||||||
|
|
||||||
if (GTK_WIDGET_NO_WINDOW (widget))
|
if (!GTK_WIDGET_NO_WINDOW (widget))
|
||||||
gtk_widget_queue_clear (widget);
|
|
||||||
else
|
|
||||||
gdk_window_hide (widget->window);
|
gdk_window_hide (widget->window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4366,14 +4396,6 @@ gtk_widget_real_unrealize (GtkWidget *widget)
|
|||||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
|
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************
|
|
||||||
* gtk_widget_real_draw:
|
|
||||||
*
|
|
||||||
* arguments:
|
|
||||||
*
|
|
||||||
* results:
|
|
||||||
*****************************************/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_widget_real_draw (GtkWidget *widget,
|
gtk_widget_real_draw (GtkWidget *widget,
|
||||||
GdkRectangle *area)
|
GdkRectangle *area)
|
||||||
@ -4409,34 +4431,6 @@ gtk_widget_real_size_request (GtkWidget *widget,
|
|||||||
requisition->height = widget->requisition.height;
|
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:
|
* gtk_widget_peek_colormap:
|
||||||
*
|
*
|
||||||
|
@ -26,15 +26,9 @@ class "GtkWidget" style "defaultfont"
|
|||||||
|
|
||||||
style "window"
|
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"
|
style "scale"
|
||||||
{
|
{
|
||||||
fg[NORMAL] = { 1.0, 0, 0 }
|
fg[NORMAL] = { 1.0, 0, 0 }
|
||||||
@ -52,7 +46,8 @@ style "toggle_button" = "button"
|
|||||||
{
|
{
|
||||||
fg[NORMAL] = { 1.0, 0, 0 }
|
fg[NORMAL] = { 1.0, 0, 0 }
|
||||||
fg[ACTIVE] = { 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"
|
style "text"
|
||||||
|
21
tests/check-n.xpm
Normal file
21
tests/check-n.xpm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* 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.....",
|
||||||
|
"..........",
|
||||||
|
"..........",
|
||||||
|
};
|
21
tests/check-y.xpm
Normal file
21
tests/check-y.xpm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* 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.....",
|
||||||
|
"..........",
|
||||||
|
"..........",
|
||||||
|
};
|
@ -26,15 +26,9 @@ class "GtkWidget" style "defaultfont"
|
|||||||
|
|
||||||
style "window"
|
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"
|
style "scale"
|
||||||
{
|
{
|
||||||
fg[NORMAL] = { 1.0, 0, 0 }
|
fg[NORMAL] = { 1.0, 0, 0 }
|
||||||
@ -52,7 +46,8 @@ style "toggle_button" = "button"
|
|||||||
{
|
{
|
||||||
fg[NORMAL] = { 1.0, 0, 0 }
|
fg[NORMAL] = { 1.0, 0, 0 }
|
||||||
fg[ACTIVE] = { 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"
|
style "text"
|
||||||
|
Loading…
Reference in New Issue
Block a user