diff options
author | Michael Natterer <mitch@gimp.org> | 2010-01-22 17:20:01 +0100 |
---|---|---|
committer | Michael Natterer <mitch@gimp.org> | 2010-01-22 17:20:01 +0100 |
commit | 2f9c4be0a8d16e26a6a611568298168450353837 (patch) | |
tree | 2a4be4e0885e424aa293699b7bae133445cb091a /gtk/gtkentry.c | |
parent | 35a2b6532854251f5aed2eba22549f12154a805e (diff) | |
download | gtk+-2f9c4be0a8d16e26a6a611568298168450353837.tar.gz |
Bug 607778 - Add accessors for GtkEntry's windows
Add gtk_entry_get_text_window() and get_icon_window() so we can
distinguigh them in expose-event callbacks.
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r-- | gtk/gtkentry.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index a04b83f547..31637b71b1 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -6703,6 +6703,29 @@ gtk_entry_set_buffer (GtkEntry *entry, g_object_thaw_notify (obj); } +/** + * gtk_entry_get_text_window: + * @entry: a #GtkEntry + * + * Returns the #GdkWindow which contains the text. This function is + * useful when drawing something to the entry in an expose-event + * callback because it enables the callback to distinguish between + * the text window and entry's icon windows. + * + * See also gtk_entry_get_icon_window(). + * + * Return value: the entry's text window. + * + * Since: 2.20 + **/ +GdkWindow * +gtk_entry_get_text_window (GtkEntry *entry) +{ + g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL); + + return entry->text_area; +} + /** * gtk_entry_set_text: @@ -8218,6 +8241,41 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry) return -1; } +/** + * gtk_entry_get_icon_window: + * @entry: A #GtkEntry + * @icon_pos: Icon position + * + * Returns the #GdkWindow which contains the entry's icon at + * @icon_pos. This function is useful when drawing something to the + * entry in an expose-event callback because it enables the callback + * to distinguish between the text window and entry's icon windows. + * + * See also gtk_entry_get_text_window(). + * + * Return value: the entry's icon window at @icon_pos. + * + * Since: 2.20 + */ +GdkWindow * +gtk_entry_get_icon_window (GtkEntry *entry, + GtkEntryIconPosition icon_pos) +{ + GtkEntryPrivate *priv; + EntryIconInfo *icon_info; + + g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL); + + priv = GTK_ENTRY_GET_PRIVATE (entry); + + icon_info = priv->icons[icon_pos]; + + if (icon_info) + return icon_info->window; + + return NULL; +} + static void ensure_has_tooltip (GtkEntry *entry) { |