GtkExpander/GtkDisclosure



Proposal: GtkExpander/GtkDisclosure
===================================

http://bugzilla.gnome.org/show_bug.cgi?id=60553

	This is a simple widget with an expander triangle which when clicked on
hides or shows contents of a container.

	There have been two approaches to the widget so far:

	1) Iain Holmes wrote a GtkCheckButton sub-class to which you can attach
a GtkContainer which is shown/hidden as the button is toggled. This
widget was intended for gnome-media but was later used by gsearchtool
and gnome-panel. 

	This approach has the advantage of a straightforward implementation and
flexibility of how the expander button is laid out relative to the
container.

	2) I recently implemented a GtkBin sub-class which displays an expander
arrow and label at the top of the widget and hides/shows the GtkBin
child depending on whether the widget is expanded or collapsed.

	This approach may make more sense conceptually - i.e. its a container
whose child is shown or hidden rather than a widget that controls the
state of another container. However, the implementation is a good deal
more complex because a lot of it is a re-implementation of parts of
GtkCheckButton and its base classes.


	I'm not sure there is too much point in enumerating each API until a
decision is made on which approach to take. The main difference between
the APIs is with approach (1) you either use

void       gtk_disclosure_set_container   (GtkDisclosure *disclosure,
                                           GtkWidget     *container);

	to associate a container with the widget which will be hidden/show as
the button is toggled or connect to the "toggled" signal and take what
ever action you please.

	On the other hand, with approach (2) the widget will be a GtkBin
sub-class to which you just add the widgets you want hidden or shown.
The widget should probably have a "toggled" signal and APIs for
controlling whether or not the widget is expanded or collapsed - much
like the GtkToggleButton APIs.


Good Luck,
Mark.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]