8# define sleep(x) Sleep(x)
12#undef BUILDING_FOX16_GUI
15#include <gwen-gui-fox16/fox16_gui.hpp>
23#include <gwenhywfar/gwenhywfar.h>
24#include <gwenhywfar/debug.h>
25#include <gwenhywfar/passwdstore.h>
31int test1(
int argc,
char **argv) {
32 FXApp a(
"libtest",
"Martin Preuss");
53 fprintf(stderr,
"Could not create dialog.\n");
58 fprintf(stderr,
"Result: %d\n", rv);
70int test2(
int argc,
char **argv) {
71 FXApp application(
"libtest",
"Martin Preuss");
79 application.init(argc,argv);
91 "<p><b>This</b> is an example <i>text</i>..</p>"
92 "<p>As you can see <font color=red>colors</font> can "
97 for (i1=1; i1<=15; i1++) {
99 "Step %d: This is a another step in the test of progress widgets",
105 "Starting 2nd progress...",
108 for (i2=1; i2<=3; i2++) {
110 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
113 fprintf(stderr,
"Aborted by user\n");
121 fprintf(stderr,
"Aborted by user\n");
134 FXApp a(
"libtest",
"Martin Preuss");
138 const char testString[]=
142 "This is <b>a</b> test. "
143 "And this, is the second line: followed by something else."
144 "<right>This should be right aligned</right>"
152 " <td>this is longer data (data2)</td>"
155 "And this is after the table.<br>"
156 "and this <font color=\"red\">one</font> is red.";
158 "This is before right"
159 "<right>Right</right>"
160 "and this after right.";
168 dbox=
new FXDialogBox(&a,
"Test", DECOR_ALL);
169 vf=
new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
170 0, 0, 0, 0, 1, 1, 1, 1);
171 new FOX16_HtmlLabel(vf, FXString(testString), LAYOUT_FILL_X|LAYOUT_FILL_Y);
172 new FXSpring(vf, LAYOUT_FILL_X | LAYOUT_FILL_Y);
173 new FXLabel(vf,
"Normal Testlabel");
176 dbox->resize(300, 200);
186 FXApp application(
"libtest",
"Martin Preuss");
194 application.init(argc,argv);
196 application.create();
206 "<p><b>Test</b> f\xc3\xbcr Umlaute.</p>"
210 for (i1=1; i1<=10; i1++) {
213 snprintf(numbuf,
sizeof(numbuf)-1,
"Step %d", (
int)i1);
219 "Starting 2nd progress...",
222 for (i2=1; i2<=10; i2++) {
224 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
227 fprintf(stderr,
"Aborted by user\n");
235 fprintf(stderr,
"Aborted by user\n");
248 FXApp a(
"libtest",
"Martin Preuss");
252 const char testString[]=
256 "This is <b>a</b> test. "
257 "And this, is the second line: followed by something else."
258 "<right>This should be right aligned</right>"
266 " <td>this is longer data (data2)</td>"
269 "And this is after the table.<br>"
270 "and this <font color=\"red\">one</font> is red.";
272 "This is before right"
273 "<right>Right</right>"
274 "and this after right.";
282 dbox=
new FXDialogBox(&a,
"Test", DECOR_ALL);
283 vf=
new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
284 0, 0, 0, 0, 1, 1, 1, 1);
286 LAYOUT_FILL_X|LAYOUT_FILL_Y |
287 HSCROLLING_OFF | VSCROLLER_ALWAYS);
288 new FXSpring(vf, LAYOUT_FILL_X | LAYOUT_FILL_Y);
289 new FXLabel(vf,
"Normal Testlabel");
292 dbox->resize(300, 200);
302 FXApp application(
"libtest",
"Martin Preuss");
310 application.init(argc,argv);
312 application.create();
322 "<p><b>Test</b> f\xc3\xbcr Umlaute.</p>"
326 for (i1=1; i1<=20; i1++) {
329 snprintf(numbuf,
sizeof(numbuf)-1,
"Step %d", (
int)i1);
335 "Starting 2nd progress...",
338 for (i2=1; i2<=5; i2++) {
340 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
344 fprintf(stderr,
"Aborted by user\n");
352 fprintf(stderr,
"Aborted by user\n");
365 FXApp application(
"libtest",
"Martin Preuss");
369 application.init(argc,argv);
371 application.create();
378 "<html>This is the text.</html>This is ASCII",
391 FXApp application(
"libtest",
"Martin Preuss");
396 application.init(argc,argv);
398 application.create();
409 fprintf(stderr,
"Could not create dialog.\n");
414 fprintf(stderr,
"Result: %d\n", rv);
422 FXApp application(
"libtest",
"Martin Preuss");
427 application.init(argc,argv);
429 application.create();
440 fprintf(stderr,
"Could not create dialog.\n");
445 fprintf(stderr,
"Result: %d\n", rv);
453 FXApp application(
"libtest",
"Martin Preuss");
463 DBG_ERROR(0,
"Expected token and secret");
469 application.init(argc,argv);
471 application.create();
486 rv=
GWEN_Gui_GetPassword(0, token,
"Get Password",
"Please enter password 1", pw, 4,
sizeof(pw)-1,
489 DBG_ERROR(0,
"Error getting password: %d", rv);
492 if (strcmp(epw, pw)!=0) {
493 DBG_ERROR(0,
"Bad password for token [%s], expected [%s], got [%s].", token, epw, pw);
500 fprintf(stderr,
"Could not create dialog.\n");
505 fprintf(stderr,
"Result: %d\n", rv);
514 FXApp application(
"libtest",
"Martin Preuss");
518 application.init(argc,argv);
520 application.create();
527 "<html>This is quite a long HTML text. This is the second sentence, which is a bit longer "
528 "than the first one.<br>In any case this sentence should begin on its own line</html>"
530 "This is quite a long HTML text. This is the second sentence, which is a bit longer "
531 "than the first one.\nIn any case this sentence should begin on its own line.",
544 FXApp application(
"libtest",
"Martin Preuss");
548 application.init(argc,argv);
550 application.create();
557 "<html><b>This</b> is quite a long HTML text. This is the second sentence, which is a bit longer "
558 "than the first one.<br>In any case this sentence should begin on its own line.</html>",
571int main(
int argc,
char **argv) {
577 if (strcasecmp(argv[1],
"1")==0)
578 return test1(argc, argv);
579 else if (strcasecmp(argv[1],
"2")==0)
580 return test2(argc, argv);
581 else if (strcasecmp(argv[1],
"3")==0)
582 return test3(argc, argv);
583 else if (strcasecmp(argv[1],
"4")==0)
584 return test4(argc, argv);
585 else if (strcasecmp(argv[1],
"5")==0)
586 return test5(argc, argv);
587 else if (strcasecmp(argv[1],
"6")==0)
588 return test6(argc, argv);
589 else if (strcasecmp(argv[1],
"7")==0)
590 return test7(argc, argv);
591 else if (strcasecmp(argv[1],
"8")==0)
592 return test8(argc, argv);
593 else if (strcasecmp(argv[1],
"9")==0)
594 return test9(argc, argv);
595 else if (strcasecmp(argv[1],
"10")==0)
596 return test10(argc, argv);
597 else if (strcasecmp(argv[1],
"11")==0)
598 return test11(argc, argv);
599 else if (strcasecmp(argv[1],
"12")==0)
600 return test12(argc, argv);
603 return test1(argc, argv);
GWEN_GUI * getCInterface()
void setPasswordStore(GWEN_PASSWD_STORE *sto)
void setPasswordDb(GWEN_DB_NODE *dbPasswords, int persistent)
GWEN_DB_NODE * GWEN_DB_Group_new(const char *name)
struct GWEN_DB_NODE GWEN_DB_NODE
#define DBG_ERROR(dbg_logger, format,...)
#define DBG_ERROR_ERR(dbg_logger, dbg_err)
struct GWEN_DIALOG GWEN_DIALOG
GWEN_DIALOG * Dlg_Test2_new()
GWEN_DIALOG * Dlg_Test1_new()
#define GWEN_ERROR_USER_ABORTED
int test8(int argc, char **argv)
int test12(int argc, char **argv)
int test11(int argc, char **argv)
int main(int argc, char **argv)
int test3(int argc, char **argv)
int test5(int argc, char **argv)
int test2(int argc, char **argv)
int test4(int argc, char **argv)
int test10(int argc, char **argv)
int test6(int argc, char **argv)
int test9(int argc, char **argv)
int test7(int argc, char **argv)
void GWEN_Gui_SetGui(GWEN_GUI *gui)
GWENHYWFAR_API int GWEN_Gui_ExecDialog(GWEN_DIALOG *dlg, uint32_t guiid)
GWENHYWFAR_API int GWEN_Gui_InputBox(uint32_t flags, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
#define GWEN_GUI_PROGRESS_DELAY
#define GWEN_GUI_PROGRESS_KEEP_OPEN
@ GWEN_Gui_PasswordMethod_Text
GWENHYWFAR_API uint32_t GWEN_Gui_ProgressStart(uint32_t progressFlags, const char *title, const char *text, uint64_t total, uint32_t guiid)
GWENHYWFAR_API int GWEN_Gui_ProgressEnd(uint32_t id)
#define GWEN_GUI_INPUT_FLAGS_SHOW
GWENHYWFAR_API int GWEN_Gui_GetPassword(uint32_t flags, const char *token, const char *title, const char *text, char *buffer, int minLen, int maxLen, GWEN_GUI_PASSWORD_METHOD methodId, GWEN_DB_NODE *methodParams, uint32_t guiid)
GWENHYWFAR_API int GWEN_Gui_ProgressLog(uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
#define GWEN_GUI_PROGRESS_SHOW_ABORT
#define GWEN_GUI_PROGRESS_SHOW_LOG
GWENHYWFAR_API int GWEN_Gui_ProgressLog2(uint32_t id, GWEN_LOGGER_LEVEL level, const char *text,...)
GWENHYWFAR_API int GWEN_Gui_ProgressAdvance(uint32_t id, uint32_t progress)
void GWEN_Logger_SetLevel(const char *logDomain, GWEN_LOGGER_LEVEL l)
@ GWEN_LoggerLevel_Notice
@ GWEN_LoggerLevel_Verbous
GWEN_PASSWD_STORE * GWEN_PasswordStore_new(const char *fname)
struct GWEN_PASSWD_STORE GWEN_PASSWD_STORE