forked from AuroraMiddleware/gtk
Move GtkExpander docs inline
Based on a patch by Garrett Regier. https://bugzilla.gnome.org/show_bug.cgi?id=617327
This commit is contained in:
parent
c770fdd08a
commit
3e348181ed
1
docs/reference/gtk/tmpl/.gitignore
vendored
1
docs/reference/gtk/tmpl/.gitignore
vendored
@ -22,6 +22,7 @@ gtkeditable.sgml
|
||||
gtkentry.sgml
|
||||
gtkentrybuffer.sgml
|
||||
gtkeventbox.sgml
|
||||
gtkexpander.sgml
|
||||
gtkhbox.sgml
|
||||
gtkiconview.sgml
|
||||
gtkimcontextsimple.sgml
|
||||
|
@ -1,296 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkExpander
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A container which can hide its child
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A #GtkExpander allows the user to hide or show its child by clicking
|
||||
on an expander triangle similar to the triangles used in a #GtkTreeView.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Normally you use an expander as you would use any other descendant
|
||||
of #GtkBin; you create the child widget and use gtk_container_add()
|
||||
to add it to the expander. When the expander is toggled, it will take
|
||||
care of showing and hiding the child automatically.
|
||||
</para>
|
||||
|
||||
<section id="expander-special-usage">
|
||||
<title>Special Usage</title>
|
||||
|
||||
<para>
|
||||
There are situations in which you may prefer to show and hide the
|
||||
expanded widget yourself, such as when you want to actually create
|
||||
the widget at expansion time. In this case, create a #GtkExpander
|
||||
but do not add a child to it. The expander widget has an
|
||||
<literal>expanded</literal> property which can be used to monitor
|
||||
its expansion state. You should watch this property with a signal
|
||||
connection as follows:
|
||||
</para>
|
||||
|
||||
<programlisting id="expander-callback-example">
|
||||
expander = gtk_expander_new_with_mnemonic ("_More Options");
|
||||
g_signal_connect (expander, "notify::expanded",
|
||||
G_CALLBACK (expander_callback), NULL);
|
||||
|
||||
...
|
||||
|
||||
static void
|
||||
expander_callback (GObject *object,
|
||||
GParamSpec *param_spec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkExpander *expander;
|
||||
|
||||
expander = GTK_EXPANDER (object);
|
||||
|
||||
if (gtk_expander_get_expanded (expander))
|
||||
{
|
||||
/* Show or create widgets */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Hide or destroy widgets */
|
||||
}
|
||||
}
|
||||
</programlisting>
|
||||
</section>
|
||||
<refsect2 id="GtkExpander-BUILDER-UI">
|
||||
<title>GtkExpander as GtkBuildable</title>
|
||||
<para>
|
||||
The GtkExpander implementation of the GtkBuildable interface
|
||||
supports placing a child in the label position by specifying
|
||||
"label" as the "type" attribute of a <child> element.
|
||||
A normal content child can be specified without specifying
|
||||
a <child> type attribute.
|
||||
</para>
|
||||
<example>
|
||||
<title>A UI definition fragment with GtkExpander</title>
|
||||
<programlisting><![CDATA[
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="expander-label"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="expander-content"/>
|
||||
</child>
|
||||
</object>
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkExpander ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkExpander::activate ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander: the object which received the signal.
|
||||
|
||||
<!-- ##### ARG GtkExpander:expanded ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:label ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:label-fill ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:label-widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:use-markup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:use-underline ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:expander-size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkExpander:expander-spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@label:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_new_with_mnemonic ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@label:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_set_expanded ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@expanded:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_get_expanded ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_set_spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@spacing:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_get_spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_set_label ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@label:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_get_label ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_set_use_underline ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@use_underline:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_get_use_underline ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_set_use_markup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@use_markup:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_get_use_markup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_set_label_widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@label_widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_get_label_widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_set_label_fill ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@label_fill:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_expander_get_label_fill ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@expander:
|
||||
@Returns:
|
||||
|
||||
|
@ -21,6 +21,82 @@
|
||||
* Mark McLoughlin <mark@skynet.ie>
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkexpander
|
||||
* @Short_description: A container which can hide its child
|
||||
* @Title: GtkExpander
|
||||
*
|
||||
* A #GtkExpander allows the user to hide or show its child by clicking
|
||||
* on an expander triangle similar to the triangles used in a #GtkTreeView.
|
||||
*
|
||||
* Normally you use an expander as you would use any other descendant
|
||||
* of #GtkBin; you create the child widget and use gtk_container_add()
|
||||
* to add it to the expander. When the expander is toggled, it will take
|
||||
* care of showing and hiding the child automatically.
|
||||
*
|
||||
* <section id="expander-special-usage">
|
||||
* <title>Special Usage</title>
|
||||
* <para>
|
||||
* There are situations in which you may prefer to show and hide the
|
||||
* expanded widget yourself, such as when you want to actually create
|
||||
* the widget at expansion time. In this case, create a #GtkExpander
|
||||
* but do not add a child to it. The expander widget has an
|
||||
* #GtkExpander:expanded property which can be used to monitor
|
||||
* its expansion state. You should watch this property with a signal
|
||||
* connection as follows:
|
||||
* </para>
|
||||
* <programlisting id="expander-callback-example">
|
||||
* expander = gtk_expander_new_with_mnemonic ("_More Options");
|
||||
* g_signal_connect (expander, "notify::expanded",
|
||||
* G_CALLBACK (expander_callback), NULL);
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* static void
|
||||
* expander_callback (GObject *object,
|
||||
* GParamSpec *param_spec,
|
||||
* gpointer user_data)
|
||||
* {
|
||||
* GtkExpander *expander;
|
||||
*
|
||||
* expander = GTK_EXPANDER (object);
|
||||
*
|
||||
* if (gtk_expander_get_expanded (expander))
|
||||
* {
|
||||
* /* Show or create widgets */
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* /* Hide or destroy widgets */
|
||||
* }
|
||||
* }
|
||||
* </programlisting>
|
||||
* </section>
|
||||
* <refsect2 id="GtkExpander-BUILDER-UI">
|
||||
* <title>GtkExpander as GtkBuildable</title>
|
||||
* <para>
|
||||
* The GtkExpander implementation of the GtkBuildable interface
|
||||
* supports placing a child in the label position by specifying
|
||||
* "label" as the "type" attribute of a <child> element.
|
||||
* A normal content child can be specified without specifying
|
||||
* a <child> type attribute.
|
||||
* </para>
|
||||
* <example>
|
||||
* <title>A UI definition fragment with GtkExpander</title>
|
||||
* <programlisting><![CDATA[
|
||||
* <object class="GtkExpander">
|
||||
* <child type="label">
|
||||
* <object class="GtkLabel" id="expander-label"/>
|
||||
* </child>
|
||||
* <child>
|
||||
* <object class="GtkEntry" id="expander-content"/>
|
||||
* </child>
|
||||
* </object>
|
||||
* ]]></programlisting>
|
||||
* </example>
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
@ -458,11 +534,11 @@ gtk_expander_realize (GtkWidget *widget)
|
||||
attributes.width = MAX (allocation.width - 2 * border_width, 1);
|
||||
attributes.height = MAX (expander_rect.height, label_height - 2 * border_width);
|
||||
attributes.wclass = GDK_INPUT_ONLY;
|
||||
attributes.event_mask = gtk_widget_get_events (widget) |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK;
|
||||
attributes.event_mask = gtk_widget_get_events (widget)
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_ENTER_NOTIFY_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||
|
||||
@ -619,7 +695,8 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
||||
label_allocation.width = MAX (label_allocation.width, 1);
|
||||
|
||||
/* We distribute the minimum height to the label widget and prioritize
|
||||
* the child widget giving it the remaining height */
|
||||
* the child widget giving it the remaining height
|
||||
*/
|
||||
gtk_widget_get_preferred_height_for_width (priv->label_widget,
|
||||
label_allocation.width, &label_height, NULL);
|
||||
|
||||
@ -710,7 +787,8 @@ gtk_expander_unmap (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_expander_paint_prelight (GtkExpander *expander, cairo_t *cr)
|
||||
gtk_expander_paint_prelight (GtkExpander *expander,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkWidget *widget;
|
||||
@ -765,7 +843,8 @@ gtk_expander_paint_prelight (GtkExpander *expander, cairo_t *cr)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_expander_paint (GtkExpander *expander, cairo_t *cr)
|
||||
gtk_expander_paint (GtkExpander *expander,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkExpanderPrivate *priv = expander->priv;
|
||||
GtkWidget *widget;
|
||||
@ -1499,7 +1578,7 @@ gtk_expander_get_preferred_width_for_height (GtkWidget *widget,
|
||||
* Return value: a new #GtkExpander widget.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_expander_new (const gchar *label)
|
||||
{
|
||||
@ -1508,8 +1587,8 @@ gtk_expander_new (const gchar *label)
|
||||
|
||||
/**
|
||||
* gtk_expander_new_with_mnemonic:
|
||||
* @label: (allow-none): the text of the label with an underscore in front of the
|
||||
* mnemonic character
|
||||
* @label: (allow-none): the text of the label with an underscore
|
||||
* in front of the mnemonic character
|
||||
*
|
||||
* Creates a new expander using @label as the text of the label.
|
||||
* If characters in @label are preceded by an underscore, they are underlined.
|
||||
@ -1521,7 +1600,7 @@ gtk_expander_new (const gchar *label)
|
||||
* Return value: a new #GtkExpander widget.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_expander_new_with_mnemonic (const gchar *label)
|
||||
{
|
||||
@ -1541,7 +1620,7 @@ gtk_expander_new_with_mnemonic (const gchar *label)
|
||||
* child widget to be hidden.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
void
|
||||
gtk_expander_set_expanded (GtkExpander *expander,
|
||||
gboolean expanded)
|
||||
@ -1601,10 +1680,10 @@ gtk_expander_set_expanded (GtkExpander *expander,
|
||||
*
|
||||
* See gtk_expander_set_expanded().
|
||||
*
|
||||
* Return value: the current state of the expander.
|
||||
* Return value: the current state of the expander
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
gtk_expander_get_expanded (GtkExpander *expander)
|
||||
{
|
||||
@ -1616,13 +1695,13 @@ gtk_expander_get_expanded (GtkExpander *expander)
|
||||
/**
|
||||
* gtk_expander_set_spacing:
|
||||
* @expander: a #GtkExpander
|
||||
* @spacing: distance between the expander and child in pixels.
|
||||
* @spacing: distance between the expander and child in pixels
|
||||
*
|
||||
* Sets the spacing field of @expander, which is the number of pixels to
|
||||
* place between expander and the child.
|
||||
* Sets the spacing field of @expander, which is the number of
|
||||
* pixels to place between expander and the child.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
void
|
||||
gtk_expander_set_spacing (GtkExpander *expander,
|
||||
gint spacing)
|
||||
@ -1646,10 +1725,10 @@ gtk_expander_set_spacing (GtkExpander *expander,
|
||||
*
|
||||
* Gets the value set by gtk_expander_set_spacing().
|
||||
*
|
||||
* Return value: spacing between the expander and child.
|
||||
* Return value: spacing between the expander and child
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
gint
|
||||
gtk_expander_get_spacing (GtkExpander *expander)
|
||||
{
|
||||
@ -1668,7 +1747,7 @@ gtk_expander_get_spacing (GtkExpander *expander)
|
||||
* This will also clear any previously set labels.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
void
|
||||
gtk_expander_set_label (GtkExpander *expander,
|
||||
const gchar *label)
|
||||
@ -1714,7 +1793,7 @@ gtk_expander_set_label (GtkExpander *expander,
|
||||
* by the widget and must not be modified or freed.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
G_CONST_RETURN char *
|
||||
gtk_expander_get_label (GtkExpander *expander)
|
||||
{
|
||||
@ -1739,7 +1818,7 @@ gtk_expander_get_label (GtkExpander *expander)
|
||||
* the next character should be used for the mnemonic accelerator key.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
void
|
||||
gtk_expander_set_use_underline (GtkExpander *expander,
|
||||
gboolean use_underline)
|
||||
@ -1767,14 +1846,14 @@ gtk_expander_set_use_underline (GtkExpander *expander,
|
||||
* gtk_expander_get_use_underline:
|
||||
* @expander: a #GtkExpander
|
||||
*
|
||||
* Returns whether an embedded underline in the expander label indicates a
|
||||
* mnemonic. See gtk_expander_set_use_underline().
|
||||
* Returns whether an embedded underline in the expander label
|
||||
* indicates a mnemonic. See gtk_expander_set_use_underline().
|
||||
*
|
||||
* Return value: %TRUE if an embedded underline in the expander label
|
||||
* indicates the mnemonic accelerator keys.
|
||||
* Return value: %TRUE if an embedded underline in the expander
|
||||
* label indicates the mnemonic accelerator keys
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
gtk_expander_get_use_underline (GtkExpander *expander)
|
||||
{
|
||||
@ -1793,7 +1872,7 @@ gtk_expander_get_use_underline (GtkExpander *expander)
|
||||
* language</link>. See gtk_label_set_markup().
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
void
|
||||
gtk_expander_set_use_markup (GtkExpander *expander,
|
||||
gboolean use_markup)
|
||||
@ -1823,12 +1902,12 @@ gtk_expander_set_use_markup (GtkExpander *expander,
|
||||
*
|
||||
* Returns whether the label's text is interpreted as marked up with
|
||||
* the <link linkend="PangoMarkupFormat">Pango text markup
|
||||
* language</link>. See gtk_expander_set_use_markup ().
|
||||
* language</link>. See gtk_expander_set_use_markup().
|
||||
*
|
||||
* Return value: %TRUE if the label's text will be parsed for markup
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
gboolean
|
||||
gtk_expander_get_use_markup (GtkExpander *expander)
|
||||
{
|
||||
@ -1846,7 +1925,7 @@ gtk_expander_get_use_markup (GtkExpander *expander)
|
||||
* that will appear embedded alongside the expander arrow.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
void
|
||||
gtk_expander_set_label_widget (GtkExpander *expander,
|
||||
GtkWidget *label_widget)
|
||||
@ -1901,10 +1980,10 @@ gtk_expander_set_label_widget (GtkExpander *expander,
|
||||
* gtk_expander_set_label_widget().
|
||||
*
|
||||
* Return value: (transfer none): the label widget,
|
||||
* or %NULL if there is none.
|
||||
* or %NULL if there is none
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_expander_get_label_widget (GtkExpander *expander)
|
||||
{
|
||||
@ -1916,11 +1995,11 @@ gtk_expander_get_label_widget (GtkExpander *expander)
|
||||
/**
|
||||
* gtk_expander_set_label_fill:
|
||||
* @expander: a #GtkExpander
|
||||
* @label_fill: %TRUE if the label should should fill all available horizontal
|
||||
* space
|
||||
* @label_fill: %TRUE if the label should should fill
|
||||
* all available horizontal space
|
||||
*
|
||||
* Sets whether the label widget should fill all available horizontal space
|
||||
* allocated to @expander.
|
||||
* Sets whether the label widget should fill all available
|
||||
* horizontal space allocated to @expander.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -1951,11 +2030,11 @@ gtk_expander_set_label_fill (GtkExpander *expander,
|
||||
* gtk_expander_get_label_fill:
|
||||
* @expander: a #GtkExpander
|
||||
*
|
||||
* Returns whether the label widget will fill all available horizontal
|
||||
* space allocated to @expander.
|
||||
* Returns whether the label widget will fill all available
|
||||
* horizontal space allocated to @expander.
|
||||
*
|
||||
* Return value: %TRUE if the label widget will fill all available horizontal
|
||||
* space
|
||||
* Return value: %TRUE if the label widget will fill all
|
||||
* available horizontal space
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
@ -1966,4 +2045,3 @@ gtk_expander_get_label_fill (GtkExpander *expander)
|
||||
|
||||
return expander->priv->label_fill;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user