Enlightenment CVS committal

Author  : werkt
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_entry.c ewl_entry.h 


Log Message:
Added preliminary multiline support.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -3 -r1.101 -r1.102
--- ewl_entry.c 29 Aug 2004 02:47:39 -0000      1.101
+++ ewl_entry.c 20 Sep 2004 21:26:13 -0000      1.102
@@ -5,6 +5,26 @@
 /**
  * @param text: the initial text to display in the widget
  * @return Returns a new entry widget on success, NULL on failure.
+ * @brief Allocate and initialize a new multiline input entry widget
+ */
+Ewl_Widget *ewl_entry_multiline_new(char *text)
+{
+       Ewl_Widget *w;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       w = ewl_entry_new(text);
+       if (!w)
+               return NULL;
+
+       ewl_entry_multiline_set( EWL_ENTRY(w), TRUE );
+
+       DRETURN_PTR(w, DLEVEL_STABLE);
+}
+
+/**
+ * @param text: the initial text to display in the widget
+ * @return Returns a new entry widget on success, NULL on failure.
  * @brief Allocate and initialize a new entry widget
  */
 Ewl_Widget     *ewl_entry_new(char *text)
@@ -40,6 +60,7 @@
        w = EWL_WIDGET(e);
 
        e->in_select_mode = FALSE;
+       e->multiline = FALSE;
 
        if (!ewl_container_init(EWL_CONTAINER(w), "entry"))
                DRETURN_INT(FALSE, DLEVEL_STABLE);
@@ -81,6 +102,24 @@
 }
 
 /**
+ * @param e: the entry widget to set multiline
+ * @param m: the value to set multiline to
+ * @return Returns no value.
+ * @brief Set multiline for an entry widget
+ *
+ * Set the multiline flag for $a e to @a m
+ */
+void ewl_entry_multiline_set(Ewl_Entry * e, int m)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("e", e);
+
+       e->multiline = m;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
  * @param e: the entry widget to change the text
  * @param t: the text to set for the entry widget
  * @return Returns no value.
@@ -291,6 +330,10 @@
                ewl_entry_cursor_left_move(e);
        else if (!strcmp(ev->keyname, "Right"))
                ewl_entry_cursor_right_move(e);
+       else if (!strcmp(ev->keyname, "Down"))
+               ewl_entry_cursor_down_move(e);
+       else if (!strcmp(ev->keyname, "Up"))
+               ewl_entry_cursor_up_move(e);
        else if (!strcmp(ev->keyname, "Home"))
                ewl_entry_cursor_home_move(e);
        else if (!strcmp(ev->keyname, "End"))
@@ -307,10 +350,14 @@
        else if (!strcmp(ev->keyname, "Return") || !strcmp(ev->keyname,
                                "KP_Return") || !strcmp(ev->keyname, "Enter")
                                || !strcmp(ev->keyname, "KP_Enter")) {
-               evd = ewl_text_text_get(EWL_TEXT(e->text));
-               ewl_callback_call_with_event_data(w, EWL_CALLBACK_VALUE_CHANGED,
-                               evd);
-               FREE(evd);
+               if (!e->multiline) {
+                       evd = ewl_text_text_get(EWL_TEXT(e->text));
+                       ewl_callback_call_with_event_data(w, 
EWL_CALLBACK_VALUE_CHANGED,
+                                       evd);
+                       FREE(evd);
+               } else {
+                       ewl_entry_text_insert(e, "\n");
+               }
        }
        else if (ev->keyname && strlen(ev->keyname) == 1) {
                ewl_entry_text_insert(e, ev->keyname);
@@ -660,6 +707,24 @@
 }
 
 /*
+ * Position the cursor at the current position in the next line.
+ */
+void ewl_entry_cursor_down_move(Ewl_Entry * e)
+{
+       if (e->multiline)
+               printf( "ewl_entry_cursor_down_move: %08x\n", (int) e );
+}
+
+/*
+ * Position the cursor at the current position in the previous line.
+ */
+void ewl_entry_cursor_up_move(Ewl_Entry * e)
+{
+       if (e->multiline)
+               printf( "ewl_entry_cursor_up_move: %08x\n", (int) e );
+}
+
+/*
  * Position the cursor at the beginning of the widget. This is internal, so the
  * parameter is not checked.
  */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_entry.h 29 Aug 2004 02:47:39 -0000      1.37
+++ ewl_entry.h 20 Sep 2004 21:26:13 -0000      1.38
@@ -41,18 +41,23 @@
        Ecore_Timer    *timer; /**< Time until scrolling text on select */
        double          start_time; /**< Time timer started */
        int             in_select_mode; /**< Do keyboard cursor movements select? */
+       int             multiline; /**< Do we deal with multiple lines of text? */
 };
 
 Ewl_Widget     *ewl_entry_new(char *text);
+Ewl_Widget     *ewl_entry_multiline_new(char *text);
 int             ewl_entry_init(Ewl_Entry * e, char *text);
 void            ewl_entry_text_set(Ewl_Entry * e, char *t);
 char           *ewl_entry_text_get(Ewl_Entry * e);
 void            ewl_entry_editable_set(Ewl_Entry *e, unsigned int edit);
+void            ewl_entry_multiline_set(Ewl_Entry * e, int m);
 
 void ewl_entry_cursor_left_move(Ewl_Entry * e);
 void ewl_entry_cursor_previous_word_move(Ewl_Entry * e);
 void ewl_entry_cursor_right_move(Ewl_Entry * e);
 void ewl_entry_cursor_next_word_move(Ewl_Entry * e);
+void ewl_entry_cursor_down_move(Ewl_Entry * e);
+void ewl_entry_cursor_up_move(Ewl_Entry * e);
 void ewl_entry_cursor_home_move(Ewl_Entry * e);
 void ewl_entry_cursor_end_move(Ewl_Entry * e);
 void ewl_entry_text_insert(Ewl_Entry * e, char *s);




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to