[gtk+] Bug 607778 - Add accessors for GtkEntry's windows
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Bug 607778 - Add accessors for GtkEntry's windows
- Date: Fri, 22 Jan 2010 16:21:07 +0000 (UTC)
commit 2f9c4be0a8d16e26a6a611568298168450353837
Author: Michael Natterer <mitch gimp org>
Date: Fri Jan 22 17:20:01 2010 +0100
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.
gtk/gtk.symbols | 2 +
gtk/gtkentry.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
gtk/gtkentry.h | 13 ++++++++++++
3 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index b35944e..3e515d3 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -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
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index a04b83f..31637b7 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)
{
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
index d7f4bfb..0c82c63 100644
--- a/gtk/gtkentry.h
+++ b/gtk/gtkentry.h
@@ -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
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]