mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Allow completion popups to be wider than the entry. (#131916, Ross Burton)
2005-04-04 Matthias Clasen <mclasen@redhat.com> Allow completion popups to be wider than the entry. (#131916, Ross Burton) * gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property. * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): Don't force the popup to have the same width as the entry if popup-set-width is FALSE. * gtk/gtk.symbols: Add new functions.
This commit is contained in:
parent
36388a1fbf
commit
c4e31ace4d
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2005-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Allow completion popups to be wider than the entry. (#131916,
|
||||
Ross Burton)
|
||||
|
||||
* gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property.
|
||||
|
||||
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
|
||||
Don't force the popup to have the same width as the entry if
|
||||
popup-set-width is FALSE.
|
||||
|
||||
* gtk/gtk.symbols: Add new functions.
|
||||
|
||||
2005-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkactiongroup.c (gtk_action_group_add_action_with_accel):
|
||||
|
@ -1,3 +1,16 @@
|
||||
2005-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Allow completion popups to be wider than the entry. (#131916,
|
||||
Ross Burton)
|
||||
|
||||
* gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property.
|
||||
|
||||
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
|
||||
Don't force the popup to have the same width as the entry if
|
||||
popup-set-width is FALSE.
|
||||
|
||||
* gtk/gtk.symbols: Add new functions.
|
||||
|
||||
2005-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkactiongroup.c (gtk_action_group_add_action_with_accel):
|
||||
|
@ -1,3 +1,16 @@
|
||||
2005-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Allow completion popups to be wider than the entry. (#131916,
|
||||
Ross Burton)
|
||||
|
||||
* gtk/gtkentrycompletion.[hc]: Add a boolean popup-set-width property.
|
||||
|
||||
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
|
||||
Don't force the popup to have the same width as the entry if
|
||||
popup-set-width is FALSE.
|
||||
|
||||
* gtk/gtk.symbols: Add new functions.
|
||||
|
||||
2005-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkactiongroup.c (gtk_action_group_add_action_with_accel):
|
||||
|
@ -1,3 +1,7 @@
|
||||
2005-04-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtk-sections.txt: Add new functions.
|
||||
|
||||
2005-04-01 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/tmpl/gtkselection.sgml: Move docs inline.
|
||||
|
@ -1119,6 +1119,8 @@ gtk_entry_completion_set_inline_completion
|
||||
gtk_entry_completion_get_inline_completion
|
||||
gtk_entry_completion_set_popup_completion
|
||||
gtk_entry_completion_get_popup_completion
|
||||
gtk_entry_completion_set_popup_set_width
|
||||
gtk_entry_completion_get_popup_set_width
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_ENTRY_COMPLETION
|
||||
GTK_ENTRY_COMPLETION
|
||||
|
@ -1104,6 +1104,7 @@ gtk_entry_completion_get_inline_completion
|
||||
gtk_entry_completion_get_minimum_key_length
|
||||
gtk_entry_completion_get_model
|
||||
gtk_entry_completion_get_popup_completion
|
||||
gtk_entry_completion_get_popup_set_width
|
||||
gtk_entry_completion_get_text_column
|
||||
gtk_entry_completion_get_type G_GNUC_CONST
|
||||
gtk_entry_completion_insert_action_markup
|
||||
@ -1115,6 +1116,7 @@ gtk_entry_completion_set_match_func
|
||||
gtk_entry_completion_set_minimum_key_length
|
||||
gtk_entry_completion_set_model
|
||||
gtk_entry_completion_set_popup_completion
|
||||
gtk_entry_completion_set_popup_set_width
|
||||
gtk_entry_completion_set_text_column
|
||||
#endif
|
||||
#endif
|
||||
@ -1652,12 +1654,15 @@ gtk_icon_theme_set_search_path_utf8
|
||||
#if IN_FILE(__GTK_ICON_VIEW_C__)
|
||||
gtk_icon_view_get_column_spacing
|
||||
gtk_icon_view_get_columns
|
||||
gtk_icon_view_set_cursor
|
||||
gtk_icon_view_get_cursor
|
||||
gtk_icon_view_get_item_width
|
||||
gtk_icon_view_get_margin
|
||||
gtk_icon_view_get_markup_column
|
||||
gtk_icon_view_get_model
|
||||
gtk_icon_view_get_orientation
|
||||
gtk_icon_view_get_path_at_pos
|
||||
gtk_icon_view_get_item_at_pos
|
||||
gtk_icon_view_get_pixbuf_column
|
||||
gtk_icon_view_get_row_spacing
|
||||
gtk_icon_view_get_selected_items
|
||||
|
@ -58,7 +58,8 @@ enum
|
||||
PROP_MINIMUM_KEY_LENGTH,
|
||||
PROP_TEXT_COLUMN,
|
||||
PROP_INLINE_COMPLETION,
|
||||
PROP_POPUP_COMPLETION
|
||||
PROP_POPUP_COMPLETION,
|
||||
PROP_POPUP_SET_WIDTH
|
||||
};
|
||||
|
||||
#define GTK_ENTRY_COMPLETION_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionPrivate))
|
||||
@ -334,6 +335,22 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkEntryCompletion:popup-set-width:
|
||||
*
|
||||
* Determines whether the completions popup window will be
|
||||
* resized to the width of the entry.
|
||||
*
|
||||
* Since: 2.8
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_POPUP_SET_WIDTH,
|
||||
g_param_spec_boolean ("popup-set-width",
|
||||
P_("Popup set width"),
|
||||
P_("If TRUE, the popup window will have the same size as the entry"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkEntryCompletionPrivate));
|
||||
}
|
||||
|
||||
@ -365,6 +382,7 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
|
||||
priv->has_completion = FALSE;
|
||||
priv->inline_completion = FALSE;
|
||||
priv->popup_completion = TRUE;
|
||||
priv->popup_set_width = TRUE;
|
||||
|
||||
/* completions */
|
||||
priv->filter_model = NULL;
|
||||
@ -494,6 +512,10 @@ gtk_entry_completion_set_property (GObject *object,
|
||||
priv->popup_completion = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_POPUP_SET_WIDTH:
|
||||
priv->popup_set_width = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -531,6 +553,10 @@ gtk_entry_completion_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gtk_entry_completion_get_popup_completion (completion));
|
||||
break;
|
||||
|
||||
case PROP_POPUP_SET_WIDTH:
|
||||
g_value_set_boolean (value, gtk_entry_completion_get_popup_set_width (completion));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1293,7 +1319,12 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||
GTK_WIDGET (completion->priv->entry)->window);
|
||||
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
|
||||
|
||||
width = MIN (completion->priv->entry->allocation.width, monitor.width) - 2 * x_border;
|
||||
if (completion->priv->popup_set_width)
|
||||
width = MIN (completion->priv->entry->allocation.width, monitor.width) - 2 * x_border;
|
||||
else
|
||||
width = -1;
|
||||
|
||||
gtk_tree_view_columns_autosize (completion->priv->tree_view);
|
||||
gtk_widget_set_size_request (completion->priv->tree_view, width, items * height);
|
||||
|
||||
/* default on no match */
|
||||
@ -1610,5 +1641,52 @@ gtk_entry_completion_get_popup_completion (GtkEntryCompletion *completion)
|
||||
return completion->priv->popup_completion;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_completion_set_popup_set_width:
|
||||
* @completion: a #GtkEntryCompletion
|
||||
* @popup_set_width: %TRUE to make the width of the popup the same as the entry
|
||||
*
|
||||
* Sets whether the completion popup window will be resized to be the same
|
||||
* width as the entry.
|
||||
*
|
||||
* Since: 2.8
|
||||
*/
|
||||
void
|
||||
gtk_entry_completion_set_popup_set_width (GtkEntryCompletion *completion,
|
||||
gboolean popup_set_width)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion));
|
||||
|
||||
popup_set_width = popup_set_width != FALSE;
|
||||
|
||||
if (completion->priv->popup_set_width != popup_set_width)
|
||||
{
|
||||
completion->priv->popup_set_width = popup_set_width;
|
||||
|
||||
g_object_notify (G_OBJECT (completion), "popup-set-width");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_completion_get_popup_set_width:
|
||||
* @completion: a #GtkEntryCompletion
|
||||
*
|
||||
* Returns whether the completion popup window will be resized to the
|
||||
* width of the entry.
|
||||
*
|
||||
* Return value: %TRUE if the popup window will be resized to the width of
|
||||
* the entry
|
||||
*
|
||||
* Since: 2.8
|
||||
**/
|
||||
gboolean
|
||||
gtk_entry_completion_get_popup_set_width (GtkEntryCompletion *completion)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ENTRY_COMPLETION (completion), TRUE);
|
||||
|
||||
return completion->priv->popup_set_width;
|
||||
}
|
||||
|
||||
|
||||
#define __GTK_ENTRY_COMPLETION_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
@ -107,6 +107,10 @@ gboolean gtk_entry_completion_get_inline_completion (GtkEntryComplet
|
||||
void gtk_entry_completion_set_popup_completion (GtkEntryCompletion *completion,
|
||||
gboolean popup_completion);
|
||||
gboolean gtk_entry_completion_get_popup_completion (GtkEntryCompletion *completion);
|
||||
void gtk_entry_completion_set_popup_set_width (GtkEntryCompletion *completion,
|
||||
gboolean popup_set_width);
|
||||
gboolean gtk_entry_completion_get_popup_set_width (GtkEntryCompletion *completion);
|
||||
|
||||
|
||||
/* convenience */
|
||||
void gtk_entry_completion_set_text_column (GtkEntryCompletion *completion,
|
||||
|
Loading…
Reference in New Issue
Block a user