8 # define sleep(x) Sleep(x) 12 #undef BUILDING_FOX16_GUI 15 #include <gwen-gui-fox16/fox16_gui.hpp> 20 #include "../testdialogs/dlg_test.h" 21 #include "../testdialogs/dlg_test2.h" 23 #include <gwenhywfar/gwenhywfar.h> 24 #include <gwenhywfar/debug.h> 25 #include <gwenhywfar/passwdstore.h> 31 int test1(
int argc,
char **argv) {
32 FXApp a(
"libtest",
"Martin Preuss");
35 const char testString[]=
38 "This is <b>a</b> test. " 39 "And this, is the second line: followed by something else." 50 "And this is after the table.<br>" 51 "and this <font color=\"red\">one</font> is red.";
53 "This is before right" 54 "<right>RIGHT</right>" 55 "and this after right.";
68 ctx.setText(testString);
82 int test2(
int argc,
char **argv) {
83 FXApp application(
"libtest",
"Martin Preuss");
91 application.init(argc,argv);
103 "<p><b>This</b> is an example <i>text</i>..</p>" 104 "<p>As you can see <font color=red>colors</font> can " 109 for (i1=1; i1<=15; i1++) {
111 "Step %d: This is a another step in the test of progress widgets",
117 "Starting 2nd progress...",
120 for (i2=1; i2<=3; i2++) {
122 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
125 fprintf(stderr,
"Aborted by user\n");
133 fprintf(stderr,
"Aborted by user\n");
146 FXApp a(
"libtest",
"Martin Preuss");
150 const char testString[]=
154 "This is <b>a</b> test. " 155 "And this, is the second line: followed by something else." 156 "<right>This should be right aligned</right>" 164 " <td>this is longer data (data2)</td>" 167 "And this is after the table.<br>" 168 "and this <font color=\"red\">one</font> is red.";
170 "This is before right" 171 "<right>Right</right>" 172 "and this after right.";
180 dbox=
new FXDialogBox(&a,
"Test", DECOR_ALL);
181 vf=
new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
182 0, 0, 0, 0, 1, 1, 1, 1);
183 new FOX16_HtmlLabel(vf, FXString(testString), LAYOUT_FILL_X|LAYOUT_FILL_Y);
184 new FXSpring(vf, LAYOUT_FILL_X | LAYOUT_FILL_Y);
185 new FXLabel(vf,
"Normal Testlabel");
188 dbox->resize(300, 200);
198 FXApp application(
"libtest",
"Martin Preuss");
206 application.init(argc,argv);
208 application.create();
218 "<p><b>Test</b> f\xc3\xbcr Umlaute.</p>" 222 for (i1=1; i1<=10; i1++) {
225 snprintf(numbuf,
sizeof(numbuf)-1,
"Step %d", (
int)i1);
231 "Starting 2nd progress...",
234 for (i2=1; i2<=10; i2++) {
236 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
239 fprintf(stderr,
"Aborted by user\n");
247 fprintf(stderr,
"Aborted by user\n");
260 FXApp a(
"libtest",
"Martin Preuss");
264 const char testString[]=
268 "This is <b>a</b> test. " 269 "And this, is the second line: followed by something else." 270 "<right>This should be right aligned</right>" 278 " <td>this is longer data (data2)</td>" 281 "And this is after the table.<br>" 282 "and this <font color=\"red\">one</font> is red.";
284 "This is before right" 285 "<right>Right</right>" 286 "and this after right.";
294 dbox=
new FXDialogBox(&a,
"Test", DECOR_ALL);
295 vf=
new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
296 0, 0, 0, 0, 1, 1, 1, 1);
298 LAYOUT_FILL_X|LAYOUT_FILL_Y |
299 HSCROLLING_OFF | VSCROLLER_ALWAYS);
300 new FXSpring(vf, LAYOUT_FILL_X | LAYOUT_FILL_Y);
301 new FXLabel(vf,
"Normal Testlabel");
304 dbox->resize(300, 200);
314 FXApp application(
"libtest",
"Martin Preuss");
322 application.init(argc,argv);
324 application.create();
334 "<p><b>Test</b> f\xc3\xbcr Umlaute.</p>" 338 for (i1=1; i1<=20; i1++) {
341 snprintf(numbuf,
sizeof(numbuf)-1,
"Step %d", (
int)i1);
347 "Starting 2nd progress...",
350 for (i2=1; i2<=5; i2++) {
352 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
356 fprintf(stderr,
"Aborted by user\n");
364 fprintf(stderr,
"Aborted by user\n");
377 FXApp application(
"libtest",
"Martin Preuss");
381 application.init(argc,argv);
383 application.create();
390 "<html>This is the text.</html>This is ASCII",
403 FXApp application(
"libtest",
"Martin Preuss");
408 application.init(argc,argv);
410 application.create();
421 fprintf(stderr,
"Could not create dialog.\n");
426 fprintf(stderr,
"Result: %d\n", rv);
434 FXApp application(
"libtest",
"Martin Preuss");
439 application.init(argc,argv);
441 application.create();
452 fprintf(stderr,
"Could not create dialog.\n");
457 fprintf(stderr,
"Result: %d\n", rv);
465 FXApp application(
"libtest",
"Martin Preuss");
475 DBG_ERROR(0,
"Expected token and secret");
481 application.init(argc,argv);
483 application.create();
498 rv=
GWEN_Gui_GetPassword(0, token,
"Get Password",
"Please enter password 1", pw, 4,
sizeof(pw)-1,
501 DBG_ERROR(0,
"Error getting password: %d", rv);
504 if (strcmp(epw, pw)!=0) {
505 DBG_ERROR(0,
"Bad password for token [%s], expected [%s], got [%s].", token, epw, pw);
512 fprintf(stderr,
"Could not create dialog.\n");
517 fprintf(stderr,
"Result: %d\n", rv);
526 FXApp application(
"libtest",
"Martin Preuss");
530 application.init(argc,argv);
532 application.create();
539 "<html>This is quite a long HTML text. This is the second sentence, which is a bit longer " 540 "than the first one.<br>In any case this sentence should begin on its own line</html>" 542 "This is quite a long HTML text. This is the second sentence, which is a bit longer " 543 "than the first one.\nIn any case this sentence should begin on its own line.",
556 FXApp application(
"libtest",
"Martin Preuss");
560 application.init(argc,argv);
562 application.create();
569 "<html><b>This</b> is quite a long HTML text. This is the second sentence, which is a bit longer " 570 "than the first one.<br>In any case this sentence should begin on its own line.</html>",
583 int main(
int argc,
char **argv) {
589 if (strcasecmp(argv[1],
"1")==0)
590 return test1(argc, argv);
591 else if (strcasecmp(argv[1],
"2")==0)
592 return test2(argc, argv);
593 else if (strcasecmp(argv[1],
"3")==0)
594 return test3(argc, argv);
595 else if (strcasecmp(argv[1],
"4")==0)
596 return test4(argc, argv);
597 else if (strcasecmp(argv[1],
"5")==0)
598 return test5(argc, argv);
599 else if (strcasecmp(argv[1],
"6")==0)
600 return test6(argc, argv);
601 else if (strcasecmp(argv[1],
"7")==0)
602 return test7(argc, argv);
603 else if (strcasecmp(argv[1],
"8")==0)
604 return test8(argc, argv);
605 else if (strcasecmp(argv[1],
"9")==0)
606 return test9(argc, argv);
607 else if (strcasecmp(argv[1],
"10")==0)
608 return test10(argc, argv);
609 else if (strcasecmp(argv[1],
"11")==0)
610 return test11(argc, argv);
611 else if (strcasecmp(argv[1],
"12")==0)
612 return test12(argc, argv);
615 return test7(argc, argv);
int test10(int argc, char **argv)
GWENHYWFAR_API int GWEN_Gui_ProgressLog(uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
int test1(int argc, char **argv)
int test5(int argc, char **argv)
GWENHYWFAR_API int GWEN_Gui_ProgressAdvance(uint32_t id, uint32_t progress)
int test3(int argc, char **argv)
struct GWEN_DB_NODE GWEN_DB_NODE
void GWEN_Logger_SetLevel(const char *logDomain, GWEN_LOGGER_LEVEL l)
int test6(int argc, char **argv)
GWEN_PASSWD_STORE * GWEN_PasswordStore_new(const char *fname)
#define GWEN_GUI_PROGRESS_DELAY
void setPasswordStore(GWEN_PASSWD_STORE *sto)
int main(int argc, char **argv)
GWENHYWFAR_API int GWEN_Gui_ExecDialog(GWEN_DIALOG *dlg, uint32_t guiid)
int test9(int argc, char **argv)
struct GWEN_DIALOG GWEN_DIALOG
int test2(int argc, char **argv)
int test8(int argc, char **argv)
GWENHYWFAR_API int GWEN_Gui_InputBox(uint32_t flags, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
int test12(int argc, char **argv)
GWENHYWFAR_API int GWEN_Gui_ProgressLog2(uint32_t id, GWEN_LOGGER_LEVEL level, const char *text,...)
GWEN_DIALOG * Dlg_Test2_new()
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_PROGRESS_KEEP_OPEN
GWEN_GUI * getCInterface()
#define DBG_ERROR(dbg_logger, format, args...)
#define GWEN_GUI_INPUT_FLAGS_SHOW
struct GWEN_PASSWD_STORE GWEN_PASSWD_STORE
int test7(int argc, char **argv)
#define GWEN_GUI_PROGRESS_SHOW_LOG
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)
int test4(int argc, char **argv)
int test11(int argc, char **argv)
GWEN_DB_NODE * GWEN_DB_Group_new(const char *name)
GWEN_DIALOG * Dlg_Test1_new()
void setPasswordDb(GWEN_DB_NODE *dbPasswords, int persistent)
#define GWEN_ERROR_USER_ABORTED
void GWEN_Gui_SetGui(GWEN_GUI *gui)
#define GWEN_GUI_PROGRESS_SHOW_ABORT