Re: GtkExpander/GtkDisclosure



Hi Owen,

On Thu, 2003-03-13 at 07:52, Owen Taylor wrote:

> > 
> > 	I'm not sure there is too much point in enumerating each API until a
> > decision is made on which approach to take.
> 
> My opinion is that if 2) allows for the right visual layout, then
> it is more like the rest of the GTK+ API and probably easier to 
> use as well for the programmer.

	As regards the visual layout, I'm not sure what is "right" but an
expander arrow with a label with the child directly underneath seems
appropriate to me (label/arrow reversed in RTL locales). More
specifically:

	http://bugzilla.gnome.org/showattachment.cgi?attach_id=14946

	It may be beneficial to allow the arrow/label to be below the child,
but I'm not so sure.

	See below for a proposed API (different from whats in the bug). Some
things worth considering:

	* The simplest constructor is without a label, I'm not sure if that is
of any use. Probably should have to at least specify a label.

	* Should we put "spacing" in the constructors like gtk*box?

	* Matthias suggests that it may be worthwhile to allow arbitrary
widgets to replace the label.

	* I considered adding gtk_expander_expand/collapse but I don't think it
adds much.

	* I haven't exposed anything in the instance struct. It may be
worthwhile to expose the label widget there.


	Overall though, I think the API should be a simple subset of
GtkToggleButton/GtkButton.

Good Luck,
Mark.

#define GTK_TYPE_EXPANDER            (gtk_expander_get_type ())
#define GTK_EXPANDER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_EXPANDER, GtkExpander))
#define GTK_EXPANDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_EXPANDER, GtkExpanderClass))
#define GTK_IS_EXPANDER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_EXPANDER))
#define GTK_IS_EXPANDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_EXPANDER))
#define GTK_EXPANDER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_EXPANDER, GtkExpanderClass))

typedef struct _GtkExpander      GtkExpander;
typedef struct _GtkExpanderClass GtkExpanderClass;

struct _GtkExpander
{
  GtkBin bin;
};

struct _GtkExpanderClass
{
  GtkBinClass  parent_class;

  void       (*toggled) (GtkExpander *expander);
};

GType                 gtk_expander_get_type             (void);

GtkWidget            *gtk_expander_new                  (void);
GtkWidget            *gtk_expander_new_with_label       (const gchar *label);
GtkWidget            *gtk_expander_new_with_mnemonic    (const gchar *label);

void                  gtk_expander_set_expanded         (GtkExpander *expander,
							 gboolean     expanded);
gboolean              gtk_expander_get_expanded         (GtkExpander *expander);

/* Spacing between the expander/label and the child */
void                  gtk_expander_set_spacing          (GtkExpander *expander,
							 gint         spacing);
gint                  gtk_expander_get_spacing          (GtkExpander *expander);

void                  gtk_expander_set_label            (GtkExpander *expander,
							 const gchar *label);
G_CONST_RETURN gchar *gtk_expander_get_label            (GtkExpander *expander);

void                  gtk_expander_set_use_underline    (GtkExpander *expander,
							 gboolean     use_underline);
gboolean              gtk_expander_get_use_underline    (GtkExpander *expander);





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