/** * gtk_expander_get_label_fill: * @expander: a #GtkExpander * * 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 * * Since: 2.22 */ gboolean gtk_expander_get_label_fill (GtkExpander *expander) { g_return_val_if_fail (GTK_IS_EXPANDER (expander), FALSE); return expander->priv->label_fill; }
/** * gtk_expander_get_spacing: * @expander: a #GtkExpander * * Gets the value set by gtk_expander_set_spacing(). * * Return value: spacing between the expander and child. * * Since: 2.4 **/ gint gtk_expander_get_spacing (GtkExpander *expander) { g_return_val_if_fail (GTK_IS_EXPANDER (expander), 0); return expander->priv->spacing; }
/** * gtk_expander_get_use_markup: * @expander: a #GtkExpander * * 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 (). * * Return value: %TRUE if the label's text will be parsed for markup * * Since: 2.4 **/ gboolean gtk_expander_get_use_markup (GtkExpander *expander) { g_return_val_if_fail (GTK_IS_EXPANDER (expander), FALSE); return expander->priv->use_markup; }
static G_CONST_RETURN gchar* gail_expander_get_name (AtkObject *obj) { G_CONST_RETURN gchar *name; g_return_val_if_fail (GAIL_IS_EXPANDER (obj), NULL); name = ATK_OBJECT_CLASS (gail_expander_parent_class)->get_name (obj); if (name != NULL) return name; else { /* * Get the text on the label */ GtkWidget *widget; widget = GTK_ACCESSIBLE (obj)->widget; if (widget == NULL) /* * State is defunct */ return NULL; g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL); return gail_expander_get_full_text (GTK_EXPANDER (widget)); } }
/** * gtk_expander_get_label_widget: * @expander: a #GtkExpander * * Retrieves the label widget for the frame. See * gtk_expander_set_label_widget(). * * Return value: (transfer none): the label widget, * or %NULL if there is none. * * Since: 2.4 **/ GtkWidget * gtk_expander_get_label_widget (GtkExpander *expander) { g_return_val_if_fail (GTK_IS_EXPANDER (expander), NULL); return expander->priv->label_widget; }
static gboolean test_widgets_for_current_action (GtkFileChooserDialog *dialog, GtkFileChooserAction expected_action) { GtkFileChooserDefault *impl; gboolean passed; if (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) != expected_action) return FALSE; impl = get_impl_from_dialog (GTK_WIDGET (dialog)); g_assert (impl->action == expected_action); passed = TRUE; /* OPEN implies that the "new folder" button is hidden; otherwise it is shown */ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN) passed = passed && !gtk_widget_get_visible (impl->browse_new_folder_button); else passed = passed && gtk_widget_get_visible (impl->browse_new_folder_button); /* Check that the widgets are present/visible or not */ if (has_action (open_actions, G_N_ELEMENTS (open_actions), impl->action)) { passed = passed && (impl->save_widgets == NULL && (impl->location_mode == LOCATION_MODE_PATH_BAR ? impl->location_entry == NULL : impl->location_entry != NULL) && impl->save_folder_label == NULL && impl->save_folder_combo == NULL && impl->save_expander == NULL && GTK_IS_CONTAINER (impl->browse_widgets) && gtk_widget_is_drawable (impl->browse_widgets)); } else if (has_action (save_actions, G_N_ELEMENTS (save_actions), impl->action)) { /* FIXME: we can't use GTK_IS_FILE_CHOOSER_ENTRY() because it uses * _gtk_file_chooser_entry_get_type(), which is a non-exported symbol. * So, we just test impl->location_entry for being non-NULL */ passed = passed && (GTK_IS_CONTAINER (impl->save_widgets) && gtk_widget_is_drawable (impl->save_widgets) && impl->location_entry != NULL && gtk_widget_is_drawable (impl->location_entry) && GTK_IS_LABEL (impl->save_folder_label) && gtk_widget_is_drawable (impl->save_folder_label) && GTK_IS_COMBO_BOX (impl->save_folder_combo) && gtk_widget_is_drawable (impl->save_folder_combo) && GTK_IS_EXPANDER (impl->save_expander) && gtk_widget_is_drawable (impl->save_expander) && GTK_IS_CONTAINER (impl->browse_widgets)); /* FIXME: we are in a SAVE mode; test the visibility and sensitivity of * the children that change depending on the state of the expander. */ } else { g_error ("BAD TEST: test_widgets_for_current_action() doesn't know about %s", get_action_name (impl->action)); passed = FALSE; } return passed; }
static void __expand_cb(GtkWidget * widget, gpointer data) { if (GTK_IS_EXPANDER(widget)) { gtk_expander_set_expanded(GTK_EXPANDER(widget), TRUE); } else if (GTK_IS_CONTAINER(widget)) { gtk_container_foreach(GTK_CONTAINER(widget), (GtkCallback) __expand_cb, NULL); } }
static void SetExpanded(GtkWidget *widget, gpointer data) { if (GTK_IS_EXPANDER(widget)) { gtk_expander_set_expanded(GTK_EXPANDER(widget), true); } else if (GTK_IS_CONTAINER(widget)) { gtk_container_forall(GTK_CONTAINER(widget), SetExpanded, data); } return; }
/** * gtk_expander_get_label: * @expander: a #GtkExpander * * Fetches the text from a label widget including any embedded * underlines indicating mnemonics and Pango markup, as set by * gtk_expander_set_label(). If the label text has not been set the * return value will be %NULL. This will be the case if you create an * empty button with gtk_button_new() to use as a container. * * Note that this function behaved differently in versions prior to * 2.14 and used to return the label text stripped of embedded * underlines indicating mnemonics and Pango markup. This problem can * be avoided by fetching the label text directly from the label * widget. * * Return value: The text of the label widget. This string is owned * by the widget and must not be modified or freed. * * Since: 2.4 **/ const char * gtk_expander_get_label (GtkExpander *expander) { GtkExpanderPrivate *priv; g_return_val_if_fail (GTK_IS_EXPANDER (expander), NULL); priv = expander->priv; if (GTK_IS_LABEL (priv->label_widget)) return gtk_label_get_label (GTK_LABEL (priv->label_widget)); else return NULL; }
AtkObject* gail_expander_new (GtkWidget *widget) { GObject *object; AtkObject *accessible; g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL); object = g_object_new (GAIL_TYPE_EXPANDER, NULL); accessible = ATK_OBJECT (object); atk_object_initialize (accessible, widget); return accessible; }
/** * gtk_expander_set_spacing: * @expander: a #GtkExpander * @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. * * Since: 2.4 **/ void gtk_expander_set_spacing (GtkExpander *expander, gint spacing) { g_return_if_fail (GTK_IS_EXPANDER (expander)); g_return_if_fail (spacing >= 0); if (expander->priv->spacing != spacing) { expander->priv->spacing = spacing; gtk_widget_queue_resize (GTK_WIDGET (expander)); g_object_notify (G_OBJECT (expander), "spacing"); } }
static G_CONST_RETURN gchar* gail_expander_get_keybinding (AtkAction *action, gint i) { GailExpander *expander; gchar *return_value = NULL; switch (i) { case 0: { /* * We look for a mnemonic on the label */ GtkWidget *widget; GtkWidget *label; expander = GAIL_EXPANDER (action); widget = GTK_ACCESSIBLE (expander)->widget; if (widget == NULL) /* * State is defunct */ return NULL; g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL); label = gtk_expander_get_label_widget (GTK_EXPANDER (widget)); if (GTK_IS_LABEL (label)) { guint key_val; key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); if (key_val != GDK_VoidSymbol) return_value = gtk_accelerator_name (key_val, GDK_MOD1_MASK); g_free (expander->activate_keybinding); expander->activate_keybinding = return_value; } break; } default: break; } return return_value; }
/** * gtk_expander_set_label_widget: * @expander: a #GtkExpander * @label_widget: (allow-none): the new label widget * * Set the label widget for the expander. This is the widget * that will appear embedded alongside the expander arrow. * * Since: 2.4 **/ void gtk_expander_set_label_widget (GtkExpander *expander, GtkWidget *label_widget) { GtkExpanderPrivate *priv; GtkWidget *widget; g_return_if_fail (GTK_IS_EXPANDER (expander)); g_return_if_fail (label_widget == NULL || GTK_IS_WIDGET (label_widget)); g_return_if_fail (label_widget == NULL || label_widget->parent == NULL); priv = expander->priv; if (priv->label_widget == label_widget) return; if (priv->label_widget) { gtk_widget_set_state (priv->label_widget, GTK_STATE_NORMAL); gtk_widget_unparent (priv->label_widget); } priv->label_widget = label_widget; widget = GTK_WIDGET (expander); if (label_widget) { priv->label_widget = label_widget; gtk_widget_set_parent (label_widget, widget); if (priv->prelight) gtk_widget_set_state (label_widget, GTK_STATE_PRELIGHT); } if (gtk_widget_get_visible (widget)) gtk_widget_queue_resize (widget); g_object_freeze_notify (G_OBJECT (expander)); g_object_notify (G_OBJECT (expander), "label-widget"); g_object_notify (G_OBJECT (expander), "label"); g_object_thaw_notify (G_OBJECT (expander)); }
/** * gtk_expander_set_expanded: * @expander: a #GtkExpander * @expanded: whether the child widget is revealed * * Sets the state of the expander. Set to %TRUE, if you want * the child widget to be revealed, and %FALSE if you want the * child widget to be hidden. * * Since: 2.4 **/ void gtk_expander_set_expanded (GtkExpander *expander, gboolean expanded) { GtkExpanderPrivate *priv; g_return_if_fail (GTK_IS_EXPANDER (expander)); priv = expander->priv; expanded = expanded != FALSE; if (priv->expanded != expanded) { GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (expander)); gboolean enable_animations; priv->expanded = expanded; g_object_get (settings, "gtk-enable-animations", &enable_animations, NULL); if (enable_animations && gtk_widget_get_realized (GTK_WIDGET (expander))) { gtk_expander_start_animation (expander); } else { priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED; if (GTK_BIN (expander)->child) { gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded); gtk_widget_queue_resize (GTK_WIDGET (expander)); } } g_object_notify (G_OBJECT (expander), "expanded"); } }
/** * gtk_expander_set_label_fill: * @expander: a #GtkExpander * @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. * * Since: 2.22 */ void gtk_expander_set_label_fill (GtkExpander *expander, gboolean label_fill) { GtkExpanderPrivate *priv; g_return_if_fail (GTK_IS_EXPANDER (expander)); priv = expander->priv; label_fill = label_fill != FALSE; if (priv->label_fill != label_fill) { priv->label_fill = label_fill; if (priv->label_widget != NULL) gtk_widget_queue_resize (GTK_WIDGET (expander)); g_object_notify (G_OBJECT (expander), "label-fill"); } }
/** * gtk_expander_set_use_markup: * @expander: a #GtkExpander * @use_markup: %TRUE if the label's text should be parsed for markup * * Sets whether the text of the label contains markup in <link * linkend="PangoMarkupFormat">Pango's text markup * language</link>. See gtk_label_set_markup(). * * Since: 2.4 **/ void gtk_expander_set_use_markup (GtkExpander *expander, gboolean use_markup) { GtkExpanderPrivate *priv; g_return_if_fail (GTK_IS_EXPANDER (expander)); priv = expander->priv; use_markup = use_markup != FALSE; if (priv->use_markup != use_markup) { priv->use_markup = use_markup; if (GTK_IS_LABEL (priv->label_widget)) gtk_label_set_use_markup (GTK_LABEL (priv->label_widget), use_markup); g_object_notify (G_OBJECT (expander), "use-markup"); } }
/** * gtk_expander_set_label: * @expander: a #GtkExpander * @label: (allow-none): a string * * Sets the text of the label of the expander to @label. * * This will also clear any previously set labels. * * Since: 2.4 **/ void gtk_expander_set_label (GtkExpander *expander, const gchar *label) { g_return_if_fail (GTK_IS_EXPANDER (expander)); if (!label) { gtk_expander_set_label_widget (expander, NULL); } else { GtkWidget *child; child = gtk_label_new (label); gtk_label_set_use_underline (GTK_LABEL (child), expander->priv->use_underline); gtk_label_set_use_markup (GTK_LABEL (child), expander->priv->use_markup); gtk_widget_show (child); gtk_expander_set_label_widget (expander, child); } g_object_notify (G_OBJECT (expander), "label"); }
void cairo_dock_apply_filter_on_group_widget (gchar **pKeyWords, gboolean bAllWords, gboolean bSearchInToolTip, gboolean bHighLightText, gboolean bHideOther, GSList *pWidgetList) { //g_print ("%s ()\n", __func__); if (sBuffer == NULL) sBuffer = g_string_new (""); gpointer *pGroupKeyWidget; GList *pSubWidgetList; GtkWidget *pLabel, *pKeyBox, *pVBox, *pFrame, *pCurrentFrame = NULL, *pExpander; const gchar *cDescription; gchar *cToolTip = NULL; gchar *cModifiedText=NULL, *str=NULL; gboolean bFound, bFrameVisible = !bHideOther; int i; gchar *cKeyWord; GSList *w; for (w = pWidgetList; w != NULL; w = w->next) { bFound = FALSE; pGroupKeyWidget = w->data; //g_print ("widget : %s - %s\n", pGroupKeyWidget[0], pGroupKeyWidget[1]); pSubWidgetList = pGroupKeyWidget[2]; if (pSubWidgetList == NULL) continue; pLabel = pGroupKeyWidget[4]; if (pLabel == NULL) continue; pKeyBox = pGroupKeyWidget[5]; if (pKeyBox == NULL) continue; pVBox = gtk_widget_get_parent (pKeyBox); pFrame = gtk_widget_get_parent (pVBox); //\______________ On cache une frame vide, ou au contraire on montre son contenu si elle contient les mots-cles. if (pFrame != pCurrentFrame) // on a change de frame. { if (pCurrentFrame) { gboolean bFoundInFrameTitle = _cairo_dock_search_words_in_frame_title (pKeyWords, pCurrentFrame, bAllWords, bHighLightText, bHideOther); if (! bFrameVisible && bHideOther) { if (! bFoundInFrameTitle) gtk_widget_hide (pCurrentFrame); else gtk_widget_show_all (pCurrentFrame); // montre tous les widgets du groupe. } else gtk_widget_show (pCurrentFrame); } if (GTK_IS_FRAME (pFrame)) // devient la frame courante. { pExpander = gtk_widget_get_parent (pFrame); if (GTK_IS_EXPANDER (pExpander)) pFrame = pExpander; // c'est l'expander qui a le texte, c'est donc ca qu'on veut cacher. pCurrentFrame = pFrame; bFrameVisible = FALSE; } else { pCurrentFrame = NULL; } //g_print ("pCurrentFrame <- %x\n", pCurrentFrame); } cDescription = gtk_label_get_text (GTK_LABEL (pLabel)); // sans les markup Pango. if (bSearchInToolTip) cToolTip = gtk_widget_get_tooltip_text (pKeyBox); //g_print ("cDescription : %s (%s)\n", cDescription, cToolTip); bFound = FALSE; for (i = 0; pKeyWords[i] != NULL; i ++) { cKeyWord = pKeyWords[i]; _copy_string_to_buffer (cDescription); if (bHighLightText) cModifiedText = cairo_dock_highlight_key_word (cDescription, cKeyWord, FALSE); else str = _search_in_buffer (cKeyWord); if (cModifiedText == NULL && str == NULL) { if (cToolTip != NULL) { _copy_string_to_buffer (cToolTip); str = _search_in_buffer (cKeyWord); } } if (cModifiedText != NULL || str != NULL) { //g_print (" on a trouve %s\n", cKeyWord); bFound = TRUE; if (cModifiedText != NULL) { gtk_label_set_markup (GTK_LABEL (pLabel), cModifiedText); cDescription = gtk_label_get_label (GTK_LABEL (pLabel)); // Pango inclus. g_free (cModifiedText); cModifiedText = NULL; } else { gtk_label_set_text (GTK_LABEL (pLabel), cDescription); str = NULL; } if (! bAllWords) break ; } else if (bAllWords) { bFound = FALSE; break ; } } if (bFound) { //g_print ("on montre ce widget\n"); gtk_widget_show (pKeyBox); if (pCurrentFrame != NULL) bFrameVisible = TRUE; } else if (bHideOther) { //g_print ("on cache ce widget\n"); gtk_widget_hide (pKeyBox); } else gtk_widget_show (pKeyBox); g_free (cToolTip); } if (pCurrentFrame) // la derniere frame. { gboolean bFoundInFrameTitle = _cairo_dock_search_words_in_frame_title (pKeyWords, pCurrentFrame, bAllWords, bHighLightText, bHideOther); if (! bFrameVisible && bHideOther) { if (! bFoundInFrameTitle) gtk_widget_hide (pCurrentFrame); else gtk_widget_show_all (pCurrentFrame); // montre tous les widgets du groupe. } else gtk_widget_show (pCurrentFrame); } }