]> git.ipfire.org Git - thirdparty/newt.git/blobdiff - entry.c
install python modules to purelib and platlib
[thirdparty/newt.git] / entry.c
diff --git a/entry.c b/entry.c
index 5585ce5d1a0bb1b92065ec125c9228ee390fdccc..8dad8c8d5bf10c98582c9c0fc1a9c59d2cb4d29d 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -23,6 +23,8 @@ struct entry {
     int firstChar;             /* first character position being shown */
     newtEntryFilter filter;
     void * filterData;
+    int cs;
+    int csDisabled;
 };
 
 static int previous_char(const char *buf, int pos);
@@ -117,6 +119,9 @@ newtComponent newtEntry(int left, int top, const char * initialValue, int width,
        en->cursorPosition = 0;
     }
 
+    en->cs = NEWT_COLORSET_ENTRY;
+    en->csDisabled = NEWT_COLORSET_DISENTRY;
+
     return co;
 }
 
@@ -184,9 +189,9 @@ static void entryDraw(newtComponent co) {
     if (!co->isMapped) return;
 
     if (en->flags & NEWT_FLAG_DISABLED)
-       SLsmg_set_color(NEWT_COLORSET_DISENTRY);
+       SLsmg_set_color(en->csDisabled);
     else
-       SLsmg_set_color(NEWT_COLORSET_ENTRY);
+       SLsmg_set_color(en->cs);
 
     if (en->flags & NEWT_FLAG_HIDDEN) {
        newtGotorc(co->top, co->left);
@@ -255,6 +260,14 @@ void newtEntrySetFlags(newtComponent co, int flags, enum newtFlagsSense sense) {
     newtGotorc(row, col);
 }
 
+void newtEntrySetColors(newtComponent co, int normal, int disabled) {
+    struct entry * en = co->data;
+
+    en->cs = normal;
+    en->csDisabled = disabled;
+    entryDraw(co);
+}
+
 static void entryDestroy(newtComponent co) {
     struct entry * en = co->data;
 
@@ -491,3 +504,15 @@ void newtEntrySetFilter(newtComponent co, newtEntryFilter filter, void * data) {
     en->filter = filter;
     en->filterData = data;
 }
+
+int newtEntryGetCursorPosition (newtComponent co) {
+    struct entry * en = co->data;
+
+    return en->cursorPosition;
+}
+
+void newtEntrySetCursorPosition (newtComponent co, int position) {
+    struct entry * en = co->data;
+
+    en->cursorPosition = position;
+}