"GNU Public Library. "
"Written by Erik Troan\n";
+static newtSuspendCallback suspendCallback = NULL;
+
+void newtSetSuspendCallback(newtSuspendCallback cb) {
+ suspendCallback = cb;
+}
+
void newtRefresh(void) {
SLsmg_refresh();
}
char buf[10], * chptr = buf;
struct keymap * curr;
- key = SLang_getkey();
+ do {
+ key = SLang_getkey();
+ if (key == NEWT_KEY_SUSPEND && suspendCallback)
+ suspendCallback();
+ } while (key == NEWT_KEY_SUSPEND);
switch (key) {
case 0x7f:
typedef struct newtComponent * newtComponent;
-
extern struct newtColors newtDefaultColorPalette;
typedef void (*newtCallback)(newtComponent, void *);
+typedef void (*newtSuspendCallback)(void);
int newtInit(void);
int newtFinished(void);
void newtSetColors(struct newtColors colors);
void newtRefresh(void);
void newtSuspend(void);
+void newtSetSuspendCallback(newtSuspendCallback cb);
void newtResume(void);
void newtPushHelpLine(char * text);
void newtRedrawHelpLine(void);
#define NEWT_KEY_TAB '\t'
#define NEWT_KEY_ENTER '\r'
+#define NEWT_KEY_SUSPEND '\032' /* ctrl - z*/
#define NEWT_KEY_RETURN NEWT_KEY_ENTER
#define NEWT_KEY_EXTRA_BASE 0x8000
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <signal.h>
#include "newt.h"
newtRefresh();
}
+void suspend(void) {
+ newtSuspend();
+ raise(SIGTSTP);
+ newtResume();
+}
+
void main(void) {
newtComponent b1, b2, r1, r2, r3, e2, e3, l1, l2, l3, scale;
newtComponent lb, t, rsf, answer;
newtInit();
newtCls();
+ newtSetSuspendCallback(suspend);
+
newtDrawRootText(0, 0, "Newt test program");
newtPushHelpLine(NULL);