GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 2f9c4be0 authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent 35a2b653
......@@ -1368,6 +1368,7 @@ gtk_entry_get_icon_stock
gtk_entry_get_icon_storage_type
gtk_entry_get_icon_tooltip_markup
gtk_entry_get_icon_tooltip_text
gtk_entry_get_icon_window
gtk_entry_get_inner_border
gtk_entry_get_invisible_char
gtk_entry_get_layout
......@@ -1381,6 +1382,7 @@ gtk_entry_get_text_length
gtk_entry_get_type G_GNUC_CONST
gtk_entry_get_visibility
gtk_entry_get_width_chars
gtk_entry_get_text_window
gtk_entry_layout_index_to_text_index
gtk_entry_new
gtk_entry_new_with_buffer
......
......@@ -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)
{
......
......@@ -166,30 +166,40 @@ struct _GtkEntryClass
GType gtk_entry_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_entry_new (void);
GtkWidget* gtk_entry_new_with_buffer (GtkEntryBuffer *buffer);
GtkEntryBuffer* gtk_entry_get_buffer (GtkEntry *entry);
void gtk_entry_set_buffer (GtkEntry *entry,
GtkEntryBuffer *buffer);
GdkWindow *gtk_entry_get_text_window (GtkEntry *entry);
void gtk_entry_set_visibility (GtkEntry *entry,
gboolean visible);
gboolean gtk_entry_get_visibility (GtkEntry *entry);
void gtk_entry_set_invisible_char (GtkEntry *entry,
gunichar ch);
gunichar gtk_entry_get_invisible_char (GtkEntry *entry);
void gtk_entry_unset_invisible_char (GtkEntry *entry);
void gtk_entry_set_has_frame (GtkEntry *entry,
gboolean setting);
gboolean gtk_entry_get_has_frame (GtkEntry *entry);
void gtk_entry_set_inner_border (GtkEntry *entry,
const GtkBorder *border);
G_CONST_RETURN GtkBorder* gtk_entry_get_inner_border (GtkEntry *entry);
void gtk_entry_set_overwrite_mode (GtkEntry *entry,
gboolean overwrite);
gboolean gtk_entry_get_overwrite_mode (GtkEntry *entry);
/* text is truncated if needed */
void gtk_entry_set_max_length (GtkEntry *entry,
gint max);
gint gtk_entry_get_max_length (GtkEntry *entry);
guint16 gtk_entry_get_text_length (GtkEntry *entry);
void gtk_entry_set_activates_default (GtkEntry *entry,
gboolean setting);
gboolean gtk_entry_get_activates_default (GtkEntry *entry);
......@@ -293,6 +303,9 @@ void gtk_entry_set_icon_drag_source (GtkEntry *
GdkDragAction actions);
gint gtk_entry_get_current_icon_drag_source (GtkEntry *entry);
GdkWindow * gtk_entry_get_icon_window (GtkEntry *entry,
GtkEntryIconPosition icon_pos);
/* Deprecated compatibility functions
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment