forked from AuroraMiddleware/gtk
add _gtk_entry_completion_resize_popup.
Mon Nov 17 22:56:09 2003 Kristian Rietveld <kris@gtk.org> * gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup. * gtk/gtkentry.c (gtk_entry_completion_timeout): popup when not mapped, else resize_popup. * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup), (_gtk_entry_completion_popup): moved all popup resizing code to _gtk_entry_completion_resize_popup, and show the window when there are more than zero items in the completion list again (sigh).
This commit is contained in:
parent
2a9551f54e
commit
18154a2ea4
13
ChangeLog
13
ChangeLog
@ -1,7 +1,14 @@
|
|||||||
2003-11-17 Noah Levitt <nlevitt@columbia.edu>
|
Mon Nov 17 22:56:09 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* configure.in: Check for freetype headers the way freetype
|
* gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup.
|
||||||
wants us to.
|
|
||||||
|
* gtk/gtkentry.c (gtk_entry_completion_timeout): popup when not
|
||||||
|
mapped, else resize_popup.
|
||||||
|
|
||||||
|
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup),
|
||||||
|
(_gtk_entry_completion_popup): moved all popup resizing code to
|
||||||
|
_gtk_entry_completion_resize_popup, and show the window when there
|
||||||
|
are more than zero items in the completion list again (sigh).
|
||||||
|
|
||||||
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
2003-11-17 Noah Levitt <nlevitt@columbia.edu>
|
Mon Nov 17 22:56:09 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* configure.in: Check for freetype headers the way freetype
|
* gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup.
|
||||||
wants us to.
|
|
||||||
|
* gtk/gtkentry.c (gtk_entry_completion_timeout): popup when not
|
||||||
|
mapped, else resize_popup.
|
||||||
|
|
||||||
|
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup),
|
||||||
|
(_gtk_entry_completion_popup): moved all popup resizing code to
|
||||||
|
_gtk_entry_completion_resize_popup, and show the window when there
|
||||||
|
are more than zero items in the completion list again (sigh).
|
||||||
|
|
||||||
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
2003-11-17 Noah Levitt <nlevitt@columbia.edu>
|
Mon Nov 17 22:56:09 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* configure.in: Check for freetype headers the way freetype
|
* gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup.
|
||||||
wants us to.
|
|
||||||
|
* gtk/gtkentry.c (gtk_entry_completion_timeout): popup when not
|
||||||
|
mapped, else resize_popup.
|
||||||
|
|
||||||
|
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup),
|
||||||
|
(_gtk_entry_completion_popup): moved all popup resizing code to
|
||||||
|
_gtk_entry_completion_resize_popup, and show the window when there
|
||||||
|
are more than zero items in the completion list again (sigh).
|
||||||
|
|
||||||
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
2003-11-17 Noah Levitt <nlevitt@columbia.edu>
|
Mon Nov 17 22:56:09 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* configure.in: Check for freetype headers the way freetype
|
* gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup.
|
||||||
wants us to.
|
|
||||||
|
* gtk/gtkentry.c (gtk_entry_completion_timeout): popup when not
|
||||||
|
mapped, else resize_popup.
|
||||||
|
|
||||||
|
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup),
|
||||||
|
(_gtk_entry_completion_popup): moved all popup resizing code to
|
||||||
|
_gtk_entry_completion_resize_popup, and show the window when there
|
||||||
|
are more than zero items in the completion list again (sigh).
|
||||||
|
|
||||||
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
2003-11-17 Noah Levitt <nlevitt@columbia.edu>
|
Mon Nov 17 22:56:09 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* configure.in: Check for freetype headers the way freetype
|
* gtk/gtkentryprivate.h: add _gtk_entry_completion_resize_popup.
|
||||||
wants us to.
|
|
||||||
|
* gtk/gtkentry.c (gtk_entry_completion_timeout): popup when not
|
||||||
|
mapped, else resize_popup.
|
||||||
|
|
||||||
|
* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup),
|
||||||
|
(_gtk_entry_completion_popup): moved all popup resizing code to
|
||||||
|
_gtk_entry_completion_resize_popup, and show the window when there
|
||||||
|
are more than zero items in the completion list again (sigh).
|
||||||
|
|
||||||
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
2003-11-17 Mark McLoughlin <mark@skynet.ie>
|
||||||
|
|
||||||
|
@ -4515,7 +4515,12 @@ gtk_entry_completion_timeout (gpointer data)
|
|||||||
actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL);
|
actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL);
|
||||||
|
|
||||||
if (matches > 0 || actions > 0)
|
if (matches > 0 || actions > 0)
|
||||||
_gtk_entry_completion_popup (completion);
|
{
|
||||||
|
if (! GTK_WIDGET_MAPPED (completion->priv->popup_window))
|
||||||
|
_gtk_entry_completion_popup (completion);
|
||||||
|
else
|
||||||
|
_gtk_entry_completion_resize_popup (completion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GDK_THREADS_LEAVE ();
|
GDK_THREADS_LEAVE ();
|
||||||
|
@ -1029,20 +1029,12 @@ get_borders (GtkEntry *entry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function is a bit nasty */
|
/* some nasty size requisition */
|
||||||
void
|
gint
|
||||||
_gtk_entry_completion_popup (GtkEntryCompletion *completion)
|
_gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||||
{
|
{
|
||||||
gint x, y, x_border, y_border;
|
gint items, height, x_border, y_border;
|
||||||
gint items;
|
|
||||||
gint height;
|
|
||||||
|
|
||||||
if (GTK_WIDGET_MAPPED (completion->priv->popup_window))
|
|
||||||
return;
|
|
||||||
|
|
||||||
gtk_widget_show_all (completion->priv->vbox);
|
|
||||||
|
|
||||||
gdk_window_get_origin (completion->priv->entry->window, &x, &y);
|
|
||||||
get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border);
|
get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border);
|
||||||
|
|
||||||
items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
|
items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
|
||||||
@ -1052,13 +1044,15 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
|
|||||||
gtk_tree_view_column_cell_get_size (completion->priv->column, NULL,
|
gtk_tree_view_column_cell_get_size (completion->priv->column, NULL,
|
||||||
NULL, NULL, NULL, &height);
|
NULL, NULL, NULL, &height);
|
||||||
|
|
||||||
|
if (items <= 0)
|
||||||
|
gtk_widget_hide (completion->priv->scrolled_window);
|
||||||
|
else
|
||||||
|
gtk_widget_show (completion->priv->scrolled_window);
|
||||||
|
|
||||||
gtk_widget_set_size_request (completion->priv->tree_view,
|
gtk_widget_set_size_request (completion->priv->tree_view,
|
||||||
completion->priv->entry->allocation.width - 2 * x_border,
|
completion->priv->entry->allocation.width - 2 * x_border,
|
||||||
items * height);
|
items * height);
|
||||||
|
|
||||||
if (items <= 0)
|
|
||||||
gtk_widget_hide (completion->priv->scrolled_window);
|
|
||||||
|
|
||||||
/* default on no match */
|
/* default on no match */
|
||||||
completion->priv->current_selected = -1;
|
completion->priv->current_selected = -1;
|
||||||
|
|
||||||
@ -1075,9 +1069,28 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
|
|||||||
items * height);
|
items * height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gtk_entry_completion_popup (GtkEntryCompletion *completion)
|
||||||
|
{
|
||||||
|
gint x, y, x_border, y_border;
|
||||||
|
gint height;
|
||||||
|
|
||||||
|
if (GTK_WIDGET_MAPPED (completion->priv->popup_window))
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_widget_show_all (completion->priv->vbox);
|
||||||
|
|
||||||
|
gdk_window_get_origin (completion->priv->entry->window, &x, &y);
|
||||||
|
get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border);
|
||||||
|
|
||||||
x += x_border;
|
x += x_border;
|
||||||
y += 2 * y_border;
|
y += 2 * y_border;
|
||||||
|
|
||||||
|
height = _gtk_entry_completion_resize_popup (completion);
|
||||||
|
|
||||||
gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y + height);
|
gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y + height);
|
||||||
|
|
||||||
gtk_widget_show (completion->priv->popup_window);
|
gtk_widget_show (completion->priv->popup_window);
|
||||||
|
@ -58,6 +58,7 @@ struct _GtkEntryCompletionPrivate
|
|||||||
gulong key_press_id;
|
gulong key_press_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gint _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion);
|
||||||
void _gtk_entry_completion_popup (GtkEntryCompletion *completion);
|
void _gtk_entry_completion_popup (GtkEntryCompletion *completion);
|
||||||
void _gtk_entry_completion_popdown (GtkEntryCompletion *completion);
|
void _gtk_entry_completion_popdown (GtkEntryCompletion *completion);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user