]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added newtSetFlags(), newtGetrc()
authorewt <ewt>
Wed, 4 Dec 1996 19:17:26 +0000 (19:17 +0000)
committerewt <ewt>
Wed, 4 Dec 1996 19:17:26 +0000 (19:17 +0000)
newt.c
newt_pr.h

diff --git a/newt.c b/newt.c
index 9686a85da450b60e85273ce11e56b3fbe7a48f9a..3b1107a52e07a45059aab351739f64a8e4c5da20 100644 (file)
--- a/newt.c
+++ b/newt.c
@@ -22,11 +22,13 @@ struct keymap {
     char * tc;
 };
 
-struct Window windowStack[20];
-struct Window * currentWindow = NULL;
+static struct Window windowStack[20];
+static struct Window * currentWindow = NULL;
 
-char * helplineStack[20];
-char ** currentHelpline = NULL;
+static char * helplineStack[20];
+static char ** currentHelpline = NULL;
+
+static int cursorRow, cursorCol;
 
 static char * defaultHelpLine = 
 "  <Tab>/<Alt-Tab> between elements   |  <Space> selects   |  <F12> next screen"
@@ -52,6 +54,7 @@ struct newtColors newtDefaultColorPalette = {
        "yellow", "blue",                       /* root text */
        "blue",                                 /* scale full */
        "red",                                  /* scale empty */
+       "blue", "lightgray",                    /* disabled entry fg, bg */
 };
 
 static struct keymap keymap[] = {
@@ -200,6 +203,8 @@ void newtSetColors(struct newtColors colors) {
                        colors.emptyScale);
     SLtt_set_color(NEWT_COLORSET_FULLSCALE, "", "black",
                        colors.fullScale);
+    SLtt_set_color(NEWT_COLORSET_DISENTRY, "", colors.disabledEntryFg,
+                       colors.disabledEntryBg);
 }
 
 int newtGetKey(void) {
@@ -365,11 +370,20 @@ void newtPopWindow(void) {
     newtRefresh();
 }
 
-void newtGotorc(int row, int col) {
-    if (!currentWindow) 
-       SLsmg_gotorc(row, col);
-    else
-       SLsmg_gotorc(row + currentWindow->top, col + currentWindow->left);
+void newtGetrc(int * row, int * col) {
+   *row = cursorRow;
+   *col = cursorCol;
+}
+
+void newtGotorc(int newRow, int newCol) {
+    if (currentWindow) {
+       newRow += currentWindow->top;
+       newCol += currentWindow->left;
+    }
+
+    cursorRow = newRow;
+    cursorCol = newCol;
+    SLsmg_gotorc(cursorRow, cursorCol);
 }
 
 void newtDrawBox(int left, int top, int width, int height, int shadow) {
@@ -493,3 +507,16 @@ void newtDrawRootText(int row, int col, char * text) {
     SLsmg_gotorc(row, col);
     SLsmg_write_string(text);
 }
+
+int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense) {
+    switch (sense) {
+      case NEWT_FLAGS_SET:
+       return oldFlags | newFlags;
+
+      case NEWT_FLAGS_RESET:
+       return oldFlags & (~newFlags); 
+
+      default:
+       return oldFlags;
+    }
+}
index 5a8cf841dbde35f71602adb718efd6ec5fd13dad..e6eb0a14744973b5e59e47683ffe95c30a4214a3 100644 (file)
--- a/newt_pr.h
+++ b/newt_pr.h
 #define COLORSET_TEXTBOX       NEWT_COLORSET_TEXTBOX
 #define COLORSET_ACTTEXTBOX    NEWT_COLORSET_ACTTEXTBOX
 
+int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense);
+
 void newtGotorc(int row, int col);
+void newtGetrc(int * row, int * col);
 void newtDrawBox(int left, int top, int width, int height, int shadow);
 void newtClearBox(int left, int top, int width, int height);