this patch adds the possibility to turn of "editability" (the hell, is
that even a word), for an entry. it also moves the caret to the end of
the text, instead of the start (usability).
it produces a warning for return values, but I don't know how to handle
bailing on errors, if the function is supposed to return a specific
cast. I'd appreciate a few pointers on that, for future reference.
also, would be nice to add doxygen for etk to this page:
http://enlightenment.org/Libraries/Documentation/
much better than looking through the etk code.
on a totally unrelated note, why doesn't the ecore_file part have docs?
Index: src/lib/etk_entry.c
===================================================================
RCS file: /root/e17/proto/etk/src/lib/etk_entry.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 etk_entry.c
--- src/lib/etk_entry.c 15 Jan 2006 11:36:25 -0000 1.1.1.7
+++ src/lib/etk_entry.c 23 Jan 2006 19:46:28 -0000
@@ -87,6 +87,30 @@
return etk_editable_text_object_text_get(entry->editable_object);
}
+/**
+ * @brief Sets whether the user can edit the text in the entry
+ * @param entry an entry
+ * @param is_editable ETK_TRUE if it's editable, ETK_FALSE if it's not.
+ */
+void etk_entry_set_editable(Etk_Entry *entry, Etk_Bool is_editable)
+{
+ if (!entry || !entry->editable_object)
+ return;
+ entry->editable = is_editable;
+}
+
+/**
+ * @brief Retrieves whether the entry is editable
+ * @param entry an entry
+ * @return ETK_TRUE if it's editable, ETK_FALSE if it's not.
+ */
+Etk_Bool etk_entry_get_editable(Etk_Entry *entry)
+{
+ if (!entry || !entry->editable_object)
+ return NULL;
+ return entry->editable;
+}
+
/**************************
*
* Etk specific functions
@@ -150,7 +174,7 @@
Etk_Entry *entry;
Etk_Bool text_changed = ETK_FALSE;
- if (!(entry = ETK_ENTRY(object)) || !entry->editable_object)
+ if (!(entry = ETK_ENTRY(object)) || !entry->editable_object || !entry->editable)
return;
if (strcmp(key_event->key, "BackSpace") == 0)
@@ -199,6 +223,7 @@
if (!(entry = ETK_ENTRY(object)) || !entry->editable_object)
return;
+ etk_editable_text_object_cursor_move_at_end(entry->editable_object);
etk_editable_text_object_cursor_show(entry->editable_object);
}
Index: src/lib/etk_entry.h
===================================================================
RCS file: /root/e17/proto/etk/src/lib/etk_entry.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 etk_entry.h
--- src/lib/etk_entry.h 1 Nov 2005 12:24:51 -0000 1.1.1.2
+++ src/lib/etk_entry.h 23 Jan 2006 19:46:28 -0000
@@ -29,6 +29,8 @@
Etk_Widget widget;
Evas_Object *editable_object;
+
+ Etk_Bool editable : ETK_TRUE;
};
Etk_Type *etk_entry_type_get();
@@ -37,6 +39,9 @@
void etk_entry_text_set(Etk_Entry *entry, const char *text);
const char *etk_entry_text_get(Etk_Entry *entry);
+void etk_entry_set_editable(Etk_Entry *entry, Etk_Bool is_editable);
+Etk_Bool etk_entry_get_editable(Etk_Entry *entry);
+
/** @} */
#endif