Projekt

Allgemein

Profil

Herunterladen (4,03 KB) Statistiken
| Zweig: | Markierung: | Revision:

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#ifdef OS_WIN32
# include <windows.h>
# define sleep(x) Sleep(x)
#endif


#include <gwen-gui-fox16/fox16_gui.hpp>
#include <gwen-gui-fox16/fox16_htmllabel.hpp>

#include "fw_texttable.hpp"


#include <gwenhywfar/debug.h>


int test2(int argc, char **argv) {
FXApp a("libtest","Martin Preuss");
FOX16_HtmlLabel *label;
FXDialogBox *dbox;
FXVerticalFrame *vf;
const char testString[]=
"<h1>Title</h1>"
"<h2>Subtitle</h2>"
"thisIsALongWord <i>and</i> this is <b>bold</b><br>"
"This should begin on the <b>next</b> line."
"<p>This should be another paragraph</p>"
"<p>And this is <i>after</i> the <font color=red>paragraph</font>.</p>";

a.init(argc,argv);
a.create();

dbox=new FXDialogBox(&a, "Test", DECOR_ALL);
vf=new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
0, 0, 0, 0, 1, 1, 1, 1);
label=new FOX16_HtmlLabel(vf, FXString(testString), LAYOUT_FILL_X|LAYOUT_FILL_Y);

dbox->create();
dbox->resize(300, 200);
dbox->show();
a.runModalFor(dbox);

return 0;
}



int test5(int argc, char **argv) {
FXApp application("libtest","Martin Preuss");
FOX16_Gui *gui;
int rv;
uint32_t id1;
uint32_t id2;
uint64_t i1;
uint64_t i2;

application.init(argc,argv);

application.create();

gui=new FOX16_Gui(&application);
GWEN_Gui_SetGui(gui->getCInterface());

id1=GWEN_Gui_ProgressStart(GWEN_GUI_PROGRESS_SHOW_LOG |
GWEN_GUI_PROGRESS_SHOW_ABORT |
GWEN_GUI_PROGRESS_KEEP_OPEN,
"Progress-Title",
"<html>"
"<p><b>This</b> is an example <i>text</i>..</p>"
"<p>As you can see <font color=red>colors</font> can "
"be used.</p>"
"</html>",
10,
0);
for (i1=1; i1<=10; i1++) {
char numbuf[128];

snprintf(numbuf, sizeof(numbuf)-1, "Step %d", (int)i1);
GWEN_Gui_ProgressLog(id1, GWEN_LoggerLevel_Notice, numbuf);
id2=GWEN_Gui_ProgressStart(GWEN_GUI_PROGRESS_SHOW_LOG |
GWEN_GUI_PROGRESS_DELAY |
GWEN_GUI_PROGRESS_SHOW_ABORT,
"2nd progress",
"Starting 2nd progress...",
10,
id1);
for (i2=1; i2<=10; i2++) {
sleep(1);
fprintf(stderr, "Advancing %d/%d\n", (int)i1, (int)i2);
rv=GWEN_Gui_ProgressAdvance(id2, i2);
if (rv==GWEN_ERROR_USER_ABORTED) {
fprintf(stderr, "Aborted by user\n");
break;
}
}
GWEN_Gui_ProgressEnd(id2);

rv=GWEN_Gui_ProgressAdvance(id1, i1);
if (rv==GWEN_ERROR_USER_ABORTED) {
fprintf(stderr, "Aborted by user\n");
break;
}
}

GWEN_Gui_ProgressEnd(id1);

return 0;
}



int test6(int argc, char **argv) {
FXApp a("libtest","Martin Preuss");
FW_TextTable *table;
FXDialogBox *dbox;
FXVerticalFrame *vf;
int r;
int c;

a.init(argc,argv);
a.create();

dbox=new FXDialogBox(&a, "Test", DECOR_ALL);
vf=new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
0, 0, 0, 0, 1, 1, 1, 1);
table=new FW_TextTable(vf, NULL, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y);
table->setCellBackColor(0, 0, FXColor(FXRGB(255, 209, 31)));
table->setCellBackColor(0, 1, FXColor(FXRGB(255, 209, 31)));
table->setCellBackColor(1, 0, FXColor(FXRGB(255, 255, 255)));
table->setCellBackColor(1, 1, FXColor(FXRGB(255, 255, 255)));

dbox->create();

table->addColumn("First", 120);
table->addColumn("Second", 120);
table->addColumn("Third", 120);
table->addColumn("Fourth", 120);

table->setNumberOfRows(1000);

for (r=0; r<1000; r++) {
for (c=0; c<4; c++) {
char numbuf[64];

snprintf(numbuf, sizeof(numbuf)-1, "row <b>%d</b> col <i>%d</i>", r, c);
numbuf[sizeof(numbuf)-1]=0;
table->setText(r, c, numbuf);
}
}

dbox->resize(300, 200);
dbox->show();
dbox->update();
table->setFocus();
a.runModalFor(dbox);

return 0;
}



int main(int argc, char **argv) {
return test6(argc, argv);
}



(3-3/3)