diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-12-28 16:52:56 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-12-28 16:52:56 +0100 |
commit | 7b358424ebad9349421acd533c2fa1cbf6cf3e3e (patch) | |
tree | 686678532eefed525c242fd214d0cfb2914726c5 /app/wlib/test |
Initial import of xtrkcad version 1:4.0.2-2
Diffstat (limited to 'app/wlib/test')
-rw-r--r-- | app/wlib/test/alarmtst.c | 59 | ||||
-rw-r--r-- | app/wlib/test/alarmtst.mak | 2 | ||||
-rw-r--r-- | app/wlib/test/bits.bmp | 6 | ||||
-rw-r--r-- | app/wlib/test/boxtest.c | 31 | ||||
-rw-r--r-- | app/wlib/test/boxtest.mak | 2 | ||||
-rw-r--r-- | app/wlib/test/btest.c | 212 | ||||
-rw-r--r-- | app/wlib/test/btest.mak | 2 | ||||
-rw-r--r-- | app/wlib/test/colortst.c | 87 | ||||
-rw-r--r-- | app/wlib/test/colortst.mak | 2 | ||||
-rw-r--r-- | app/wlib/test/draw.c | 82 | ||||
-rw-r--r-- | app/wlib/test/draw.mak | 2 | ||||
-rw-r--r-- | app/wlib/test/dtest.bmp | 18 | ||||
-rw-r--r-- | app/wlib/test/fred.bmp | 9 | ||||
-rw-r--r-- | app/wlib/test/fred.c | 169 | ||||
-rw-r--r-- | app/wlib/test/fred.mak | 2 | ||||
-rw-r--r-- | app/wlib/test/listtest.c | 96 | ||||
-rw-r--r-- | app/wlib/test/listtest.mak | 2 | ||||
-rw-r--r-- | app/wlib/test/splash.rc | 17 | ||||
-rw-r--r-- | app/wlib/test/test.vcproj | 202 | ||||
-rw-r--r-- | app/wlib/test/testapp.c | 125 | ||||
-rw-r--r-- | app/wlib/test/wtest.def | 9 | ||||
-rw-r--r-- | app/wlib/test/wtest.ico | bin | 0 -> 1278 bytes | |||
-rw-r--r-- | app/wlib/test/wtest.mak | 23 | ||||
-rw-r--r-- | app/wlib/test/wtest.rc | 22 |
24 files changed, 1181 insertions, 0 deletions
diff --git a/app/wlib/test/alarmtst.c b/app/wlib/test/alarmtst.c new file mode 100644 index 0000000..da11c91 --- /dev/null +++ b/app/wlib/test/alarmtst.c @@ -0,0 +1,59 @@ +#include <stdio.h> +#include "wlib.h" + + +#define TRUE (1) +#define FALSE (0) + +wMessage_p msgP; +int ticks; +char tickM[40] = "INIT"; +int alarmCont = 0; + +void tick( void ) +{ + sprintf( tickM, "%d", ticks++ ); + wMessageSetValue( msgP, tickM ); + if (alarmCont) + wAlarm( 1000, tick ); +} + + +void doCmd( void * cmd ) +{ + int i; + switch ((int)cmd) { + case 1: + alarmCont = 1; + wAlarm( 1000, tick ); + break; + case 2: + for (i=0; i<10; i++ ) { + sprintf( tickM, "%d", ticks++ ); + wMessageSetValue( msgP, tickM ); + wPause( 1000 ); + } + break; + case 3: + alarmCont = 0; + break; + case 4: + wExit( 0 ); + } +} + +wWin_p wMain( int argc, char * argv[] ) +{ + + wWin_p mainW; + wMenu_p m; + + mainW = wWinMainCreate( "Fred", 60, 40, "Help", "Main", "", F_MENUBAR, NULL, NULL ); + m = wMenuBarAdd( mainW, NULL, "Cmd" ); + wMenuPushCreate( m, NULL, "Alarm", 0, doCmd, (void*)1 ); + wMenuPushCreate( m, NULL, "Pause", 0, doCmd, (void*)2 ); + wMenuPushCreate( m, NULL, "Stop", 0, doCmd, (void*)3 ); + wMenuPushCreate( m, NULL, "Exit", 0, doCmd, (void*)4 ); + msgP = wMessageCreate( mainW, 2, 2, NULL, 40, tickM ); + return mainW; +} diff --git a/app/wlib/test/alarmtst.mak b/app/wlib/test/alarmtst.mak new file mode 100644 index 0000000..771a988 --- /dev/null +++ b/app/wlib/test/alarmtst.mak @@ -0,0 +1,2 @@ +all:
+ nmake /f wtest.mak TEST=alarmtst
diff --git a/app/wlib/test/bits.bmp b/app/wlib/test/bits.bmp new file mode 100644 index 0000000..2d36fad --- /dev/null +++ b/app/wlib/test/bits.bmp @@ -0,0 +1,6 @@ +#define bits_width 16 +#define bits_height 16 +static char bits_bits[] = { + 0x00, 0xc0, 0xb2, 0xc0, 0xe6, 0x72, 0x60, 0x38, 0x16, 0x00, 0x10, 0x00, + 0xe4, 0x44, 0x28, 0x02, 0x12, 0x44, 0x12, 0x80, 0x22, 0x02, 0x22, 0x40, + 0x12, 0xc8, 0x0e, 0x82, 0x00, 0x12, 0xc0, 0x01}; diff --git a/app/wlib/test/boxtest.c b/app/wlib/test/boxtest.c new file mode 100644 index 0000000..6cb5631 --- /dev/null +++ b/app/wlib/test/boxtest.c @@ -0,0 +1,31 @@ +#include <stdlib.h> +#include <stdio.h> +#include "wlib.h" + +#define TRUE (1) + +wWin_p mainW; + +int tests = 255; + +wWin_p wMain( int argc, char * argv[] ) +{ + mainW = wWinMainCreate( "drawtest", 300, 300, NULL, "Main", "Main", F_RESIZE, NULL, NULL ); + if (tests & 0x01) + wBoxCreate( mainW, 10, 10, NULL, wBoxThinB, 280, 280 ); + if (tests & 0x02) + wBoxCreate( mainW, 20, 20, NULL, wBoxThinW, 260, 260 ); + if (tests & 0x04) + wBoxCreate( mainW, 30, 30, NULL, wBoxAbove, 240, 240 ); + if (tests & 0x08) + wBoxCreate( mainW, 40, 40, NULL, wBoxBelow, 220, 220 ); + if (tests & 0x10) + wBoxCreate( mainW, 50, 50, NULL, wBoxThickB, 200, 200 ); + if (tests & 0x20) + wBoxCreate( mainW, 60, 60, NULL, wBoxThickW, 180, 180 ); + if (tests & 0x40) + wBoxCreate( mainW, 70, 70, NULL, wBoxRidge, 160, 160 ); + if (tests & 0x80) + wBoxCreate( mainW, 80, 80, NULL, wBoxTrough, 140, 140 ); + return mainW; +} diff --git a/app/wlib/test/boxtest.mak b/app/wlib/test/boxtest.mak new file mode 100644 index 0000000..799f9f1 --- /dev/null +++ b/app/wlib/test/boxtest.mak @@ -0,0 +1,2 @@ +all:
+ nmake /f wtest.mak TEST=boxtest
diff --git a/app/wlib/test/btest.c b/app/wlib/test/btest.c new file mode 100644 index 0000000..6042229 --- /dev/null +++ b/app/wlib/test/btest.c @@ -0,0 +1,212 @@ +#include <stdio.h> +#include <stdlib.h> +/*#include "common.h"*/ +/*#include "utility.h"*/ +#include "wlib.h" +#include "dtest.bmp" +#include "bits.bmp" + +#define TRUE (1) +#define FALSE (0) + + wWin_p mainW; + wMenu_p m00, m01, m02; + wWin_p w1, w2, w3, w4, w5, w6, w7, w8; + wDraw_p d[9]; + wMenu_p m3, m4, m7, m8; + wText_p txt; +wBool_t doresize = FALSE; + +static void doExit( void * data ) +{ + wExit(0); +} + +/*static void doFont( void * data ) +{ + char * f; + wSelectFont(); + f = wCurFont(); + wMessage( w5, f, FALSE ); +}*/ + + +static void doRestore( void * data ) +{ + wDraw_p d = (wDraw_p) data; + wDrawSetSize( d, 200, 200 ); +} + + +static void mainEvent( wWin_p w, winProcEvent e, void * data ) +{ + wPos_t width, height; + switch( e ) { + case wResize_e: + wWinGetSize( w, &width, &height ); + wTextSetSize( txt, width, height ); + break; + default: + ; + } +} + +static void winEvent( wWin_p w, winProcEvent e, void * data ) +{ + wPos_t width, height; + wIndex_t inx; + char msg[80]; + switch( e ) { + case wResize_e: + inx = (wIndex_t)data; + wWinGetSize( w, &width, &height ); + sprintf( msg, "%s: %d x %d\n", wWinGetTitle(w), width, height ); + wTextAppend( txt, msg ); + if ( doresize) + wDrawSetSize( d[inx], width-4, height-4 ); + break; + default: + ; + } +} + +wDrawBitMap_p bm_w8; +wDrawBitMap_p bm_w4; + +void doMouse( wAction_t action, double x, double y ) +{ + char buff[80]; + wPos_t ix, iy; + ix = x * wDrawGetDPI( d[1] ); + iy = y * wDrawGetDPI( d[1] ); + sprintf( buff, "%d: [%0.3f %0.3f] ( %d %d )\n", (int)action, x, y, ix, iy ); + wTextAppend( txt, buff ); +#ifdef LATER + switch ( action ) { + case wActionDown: + + wDrawBitMap( d[4], bm_w4, x, y, wDrawColorRed, wDrawOptTemp ); + oldX = x; + oldY = y; + break; + case wActionMove: + wDrawBitMap( d[4], bm_w4, oldX, oldY, wDrawColorRed, wDrawOptTemp ); + wDrawBitMap( d[4], bm_w4, x, y, wDrawColorRed, wDrawOptTemp ); + oldX = x; + oldY = y; + break; + case wActionUp: + wDrawBitMap( d[4], bm_w4, oldX, oldY, wDrawColorRed, wDrawOptTemp ); + wDrawBitMap( d[4], bm_w4, x, y, wDrawColorRed, 0 ); + break; + } +#endif +} + +void doBitMap( wAction_t action, double x, double y ) +{ + static double oldX, oldY; + switch ( action ) { + case wActionDown: + + wDrawBitMap( d[4], bm_w4, x, y, wDrawColorRed, wDrawOptTemp ); + oldX = x; + oldY = y; + break; + case wActionMove: + wDrawBitMap( d[4], bm_w4, oldX, oldY, wDrawColorRed, wDrawOptTemp ); + wDrawBitMap( d[4], bm_w4, x, y, wDrawColorRed, wDrawOptTemp ); + oldX = x; + oldY = y; + break; + case wActionUp: + wDrawBitMap( d[4], bm_w4, oldX, oldY, wDrawColorRed, wDrawOptTemp ); + wDrawBitMap( d[4], bm_w4, x, y, wDrawColorRed, 0 ); + break; + } +} + +static wLines_t lines[] = { + { 0, 2, 2, 198, 2 }, + { 0, 198, 2, 198, 198 }, + { 0, 198, 198, 2, 198 }, + { 0, 2, 198, 2, 2 }, + { 0, 2, 2, 198, 198 }, + { 0, 2, 198, 198, 2 } }; + +wWin_p wMain( int argc, char * argv[] ) +{ + + mainW = wWinMainCreate( "dtest", 0, 0, "Help", "Main", F_MENUBAR|F_AUTOSIZE, mainEvent, NULL ); + wWinSetIcon( mainW, dtest_width, dtest_height, dtest_bits ); + m00 = wMenuBarAdd( mainW, "menu0-0", "&Restore" ); + m01 = wMenuBarAdd( mainW, "menu0-1", "&Message" ); + m02 = wMenuBarAdd( mainW, "menu0-2", "M&isc" ); + txt = wTextCreate( mainW, 0, 0, NULL, NULL, BT_CHARUNITS, 40, 15 ); + + w1 = wWinPopupCreate( mainW, 2, 2, "Help1", "1", F_AUTOSIZE, winEvent, (void*)1 ); + d[1] = wDrawCreate( w1, 2, 2, "Draw-1", 0, 200, 200, w1, NULL, doMouse ); + wLineCreate( w1, "", 6, lines ); + + w2 = wWinPopupCreate( mainW, 2, 2, "Help2", "2 Resize", F_AUTOSIZE|F_RESIZE, winEvent, (void*)2 ); + d[2] = wDrawCreate( w2, 2, 2, "Draw-1", 0, 200, 200, w2, NULL, doMouse ); + wLineCreate( w2, "", 6, lines ); + + w3 = wWinPopupCreate( mainW, 2, 2, "Help3", "3 MenuBar", F_AUTOSIZE|F_MENUBAR, winEvent, (void*)3 ); + d[3] = wDrawCreate( w3, 2, 2, "Draw-3", 0, 200, 200, w3, NULL, doMouse ); + m3 = wMenuBarAdd( w3, "HelpMB3", "Menu3" ); + wLineCreate( w3, "", 6, lines ); + + w4 = wWinPopupCreate( mainW, 2, 2, "Help4", "4 Resize|MenuBar", F_AUTOSIZE|F_MENUBAR|F_RESIZE, winEvent, (void*)4 ); + d[4] = wDrawCreate( w4, 2, 2, "Draw-4", 0, 200, 200, w4, NULL, doBitMap ); + bm_w4 = wDrawBitMapCreate( d[4], bits_width, bits_height, 0, 0, bits_bits ); + m4 = wMenuBarAdd( w4, "HelpMB4", "Menu4" ); + wLineCreate( w4, "", 6, lines ); + +#ifdef LATER + w5 = wWinPopupCreate( mainW, 3, 3, "Help5", "5 Footer", F_AUTOSIZE|F_FOOTER, winEvent, (void*)5 ); + d[5] = wDrawCreate( w5, 2, 2, "Draw-5", 0, 200, 200, w5, NULL, NULL ); + wLineCreate( w5, "", 6, lines ); + + w6 = wWinPopupCreate( mainW, 3, 3, "Help6", "6 Footer|Resize", F_AUTOSIZE|F_FOOTER|F_RESIZE, winEvent, (void*)6 ); + d[6] = wDrawCreate( w6, 2, 2, "Draw-6", 0, 200, 200, w6, NULL, NULL ); + wLineCreate( w6, "", 6, lines ); + + w7 = wWinPopupCreate( mainW, 3, 3, "Help7", "7 Footer|MenuBar", F_AUTOSIZE|F_FOOTER|F_MENUBAR, winEvent, (void*)7 ); + d[7] = wDrawCreate( w7, 2, 2, "Draw-7", 0, 200, 200, w7, NULL, NULL ); + m7 = wMenuBarAdd( w7, "HelpMB7", "Menu7" ); + wLineCreate( w7, "", 6, lines ); + + w8 = wWinPopupCreate( mainW, 3, 3, "Help8", "8 Footer|Resize|MenuBar", F_AUTOSIZE|F_FOOTER|F_MENUBAR|F_RESIZE, winEvent, (void*)8 ); + d[8] = wDrawCreate( w8, 2, 2, "Draw-8", 0, 200, 200, w8, NULL, doMouse ); + bm_w8 = wDrawBitMapCreate( d[8], bits_width, bits_height, 0, 0, bits_bits ); + m8 = wMenuBarAdd( w8, "HelpMB8", "Menu8" ); + wLineCreate( w8, "", 6, lines ); +#endif + + wMenuPushCreate( m00, "menu0-1", "&1", doRestore, (void*)d[1] ); + wMenuPushCreate( m00, "menu0-2", "&2", doRestore, (void*)d[2] ); + wMenuPushCreate( m00, "menu0-3", "&3", doRestore, (void*)d[3] ); + wMenuPushCreate( m00, "menu0-4", "&4", doRestore, (void*)d[4] ); + wMenuPushCreate( m00, "menu0-5", "&5", doRestore, (void*)d[5] ); + wMenuPushCreate( m00, "menu0-6", "&6", doRestore, (void*)d[6] ); + wMenuPushCreate( m00, "menu0-7", "&7", doRestore, (void*)d[7] ); + wMenuPushCreate( m00, "menu0-8", "&8", doRestore, (void*)d[8] ); + + + wMenuPushCreate( m02, "menu2-1", "&Exit", doExit, NULL ); +/* wMenuPushCreate( m02, "menu2-2", "&Font", doFont, NULL );*/ + + wWinShow( w1, TRUE ); + wWinShow( w2, TRUE ); + wWinShow( w3, TRUE ); + wWinShow( w4, TRUE ); +#ifdef LATER + wWinShow( w5, TRUE ); + wWinShow( w6, TRUE ); + wWinShow( w7, TRUE ); + wWinShow( w8, TRUE ); +#endif + + return mainW; +} diff --git a/app/wlib/test/btest.mak b/app/wlib/test/btest.mak new file mode 100644 index 0000000..49db72f --- /dev/null +++ b/app/wlib/test/btest.mak @@ -0,0 +1,2 @@ +all:
+ nmake /f wtest.mak TEST=btest
diff --git a/app/wlib/test/colortst.c b/app/wlib/test/colortst.c new file mode 100644 index 0000000..2680c23 --- /dev/null +++ b/app/wlib/test/colortst.c @@ -0,0 +1,87 @@ +#include <stdlib.h> +#include <stdio.h> +#include "wlib.h" + +#define TRUE (1) + +wWin_p mainW; +wDraw_p mainD; +wWin_p popupW; +wDraw_p popupD; +/*wFont_p font;*/ + +void redrawColor( wDraw_p d, void * context, wPos_t w, wPos_t h ) +{ + wDrawColor c; + wPos_t x0, y0, x1, y1, incr; + + wDrawGetSize( mainD, &w, &h ); + incr = w / 16; + x0 = y0 = 0; + x1 = w; y1 = h; + for ( c=0; c<=7; c++ ) { + /*printf(" color %d - %0.3f,%0.3f - %0.3f,%0.3f\n", + c, x0, y0, x1, y1 );*/ + wDrawLine( d, x0, y0, x1, y0, incr, wDrawLineSolid, c, wDrawOptTemp ); + wDrawLine( d, x1, y0, x1, y1, incr, wDrawLineSolid, c, wDrawOptTemp ); + wDrawLine( d, x1, y1, x0, y1, incr, wDrawLineSolid, c, 0 ); + wDrawLine( d, x0, y1, x0, y0, incr, wDrawLineSolid, c, 0 ); + x0 += incr; + y0 += incr; + x1 -= incr; + y1 -= incr; + } +} + +void redrawGray( wDraw_p d, void * context, wPos_t w, wPos_t h ) +{ + wDrawColor c; + int i; + wPos_t x0, y0, x1, y1, incr; + + wDrawGetSize( popupD, &w, &h ); + incr = w/32; + x0 = y0 = 0; + x1 = w; y1 = h; + for ( i=0; i<=100; i+=6 ) { + c = wDrawColorGray( i ); + /*printf(" color %d - %0.3f,%0.3f - %0.3f,%0.3f\n", + c, x0, y0, x1, y1 );*/ + wDrawLine( d, x0, y0, x1, y0, incr, wDrawLineSolid, c, 0 ); + wDrawLine( d, x1, y0, x1, y1, incr, wDrawLineSolid, c, 0 ); + wDrawLine( d, x1, y1, x0, y1, incr, wDrawLineSolid, c, 0 ); + wDrawLine( d, x0, y1, x0, y0, incr, wDrawLineSolid, c, 0 ); + x0 += incr; + y0 += incr; + x1 -= incr; + y1 -= incr; + } +} + +void winProc( + wWin_p win, + winProcEvent ev, + void * data ) +{ + wPos_t w, h; + switch( ev ) { + case wResize_e: + wWinGetSize( win, &w, &h ); + wDrawSetSize( *(wDraw_p*)data, w, h ); + break; + default: + break; + } +} + + +wWin_p wMain( int argc, char * argv[] ) +{ + mainW = wWinMainCreate( "colortst", 300, 300, NULL, "Main", "Main", 0, winProc, &mainD ); + mainD = wDrawCreate( mainW, 0, 0, NULL, 0, 300, 300, NULL, redrawColor, NULL ); + popupW = wWinPopupCreate( mainW, 300, 300, NULL, "Popup", "Popup", 0, winProc, &popupD ); + popupD = wDrawCreate( popupW, 0, 0, NULL, 0, 300, 300, NULL, redrawGray, NULL ); + wWinShow( popupW, TRUE ); + /*font = wStandardFont( F_TIMES, 0, 0 );*/ + return mainW; +} diff --git a/app/wlib/test/colortst.mak b/app/wlib/test/colortst.mak new file mode 100644 index 0000000..8bfe5ac --- /dev/null +++ b/app/wlib/test/colortst.mak @@ -0,0 +1,2 @@ +all:
+ nmake /f wtest.mak TEST=colortst
diff --git a/app/wlib/test/draw.c b/app/wlib/test/draw.c new file mode 100644 index 0000000..795044a --- /dev/null +++ b/app/wlib/test/draw.c @@ -0,0 +1,82 @@ + +#include <stdio.h> +#include "wlib.h" + + +#define TRUE (1) +#define FALSE (0) + +wFont_p font; +wDraw_p draw1; +wDrawColor black; +static wPos_t origX, origY, oldX, oldY; + +void box( double x0, double y0, double x1, double y1, wDrawOpts opts ) +{ + wDrawLine( draw1, x0, y0, x1, y0, 0, wDrawLineSolid, + black, opts ); + wDrawLine( draw1, x1, y0, x1, y1, 0, wDrawLineSolid, + black, opts ); + wDrawLine( draw1, x1, y1, x0, y1, 0, wDrawLineSolid, + black, opts ); + wDrawLine( draw1, x0, y1, x0, y0, 0, wDrawLineSolid, + black, opts ); +} + +void doDraw( wAction_t action, wPos_t x, wPos_t y ) +{ + char str[2]; + switch (action & 0xFF) { + case wActionLDown: + origX = oldX = x; + origY = oldY = y; + box( origX, origY, oldX, oldY, wDrawOptTemp ); + break; + case wActionLDrag: + box( origX, origY, oldX, oldY, wDrawOptTemp ); + oldX = x; oldY = y; + box( origX, origY, oldX, oldY, wDrawOptTemp ); + break; + case wActionLUp: + break; + case wActionText: + str[0] = (char)((action>>8)&0xFF); + str[1] = 0; + wDrawString( draw1, oldX, oldY, 0, str, font, 24, black, 0 ); + break; + } +} + +void doRedraw( wDraw_p bd, void * data, wPos_t x, wPos_t y ) +{ + box( origX, origY, oldX, oldY, 0 ); +} + +void winProc( + wWin_p win, + winProcEvent ev, + void * data ) +{ + wPos_t w, h; + switch( ev ) { + case wResize_e: + wWinGetSize( win, &w, &h ); + wDrawSetSize( draw1, w, h ); + break; + default: + break; + } +} + + +wWin_p wMain( int argc, char * argv[] ) +{ + + wWin_p mainW; + + mainW = wWinMainCreate( "Fred", 2, 2, "Help", "Main", "Main", F_AUTOSIZE|F_MENUBAR, winProc, NULL ); + font = wStandardFont( F_TIMES, FALSE, FALSE ); + black = wDrawFindColor(0); + draw1 = wDrawCreate( mainW, 2, 2, NULL, 0, 300, 200, NULL, doRedraw, doDraw ); + return mainW; +} diff --git a/app/wlib/test/draw.mak b/app/wlib/test/draw.mak new file mode 100644 index 0000000..1f530e6 --- /dev/null +++ b/app/wlib/test/draw.mak @@ -0,0 +1,2 @@ +all:
+ nmake /f wtest.mak TEST=draw
diff --git a/app/wlib/test/dtest.bmp b/app/wlib/test/dtest.bmp new file mode 100644 index 0000000..52bb88a --- /dev/null +++ b/app/wlib/test/dtest.bmp @@ -0,0 +1,18 @@ +#define dtest_width 36 +#define dtest_height 36 +static char dtest_bits[] = { + 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x20, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, + 0xff, 0xff, 0x0f, 0x08, 0x3c, 0x04, 0x80, 0x00, 0x04, 0x42, 0xf8, 0xff, + 0x0f, 0xc2, 0xff, 0x13, 0x00, 0x00, 0xc1, 0x00, 0x33, 0x00, 0x00, 0x41, + 0x81, 0x52, 0x00, 0x00, 0x41, 0x7e, 0x92, 0x00, 0x00, 0x41, 0x81, 0x22, + 0x01, 0x00, 0xc1, 0x00, 0x43, 0x02, 0x00, 0xc1, 0xff, 0x83, 0x04, 0x00, + 0x03, 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x06, 0x12, 0x00, 0x09, 0x80, + 0x01, 0x24, 0x00, 0x91, 0x63, 0x00, 0x48, 0x00, 0x61, 0x1c, 0x00, 0x90, + 0x00, 0x21, 0x08, 0x00, 0x20, 0x01, 0xe1, 0xff, 0x0f, 0x40, 0x02, 0x21, + 0x08, 0x00, 0x80, 0x07, 0x41, 0x04, 0x00, 0x00, 0x08, 0x81, 0x1b, 0x00, + 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xd1, 0x07, 0xe0, 0x00, 0x08, 0x51, 0x85, 0x10, 0x01, + 0x08, 0x0a, 0x81, 0x10, 0x00, 0x08, 0x0a, 0x81, 0x10, 0x00, 0x08, 0x04, + 0x95, 0x14, 0x38, 0x0e, 0x0a, 0xad, 0x12, 0x44, 0x09, 0x0a, 0x85, 0x11, + 0x44, 0x09, 0x11, 0x85, 0x12, 0x65, 0x09, 0x12, 0x85, 0xe4, 0x58, 0x0e}; diff --git a/app/wlib/test/fred.bmp b/app/wlib/test/fred.bmp new file mode 100644 index 0000000..11ac96d --- /dev/null +++ b/app/wlib/test/fred.bmp @@ -0,0 +1,9 @@ +#define fred_width 24 +#define fred_height 24 +static char fred_bits[] = { + 0x3f, 0x1f, 0x00, 0x01, 0x21, 0x00, 0x01, 0x21, 0x00, 0x01, 0x21, 0x00, + 0x01, 0x21, 0x00, 0x01, 0x21, 0x00, 0x1f, 0x1f, 0x00, 0x01, 0x05, 0x00, + 0x01, 0x09, 0x00, 0x01, 0x09, 0x00, 0x01, 0x11, 0x00, 0x01, 0x11, 0x00, + 0x01, 0x21, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x02, 0x82, 0x00, 0x02, 0x82, + 0x00, 0x02, 0x82, 0x00, 0x3e, 0x82, 0x00, 0x02, 0x82, 0x00, 0x02, 0x82, + 0x00, 0x02, 0x82, 0x00, 0x02, 0x82, 0x00, 0x02, 0x82, 0x00, 0x7e, 0x7e}; diff --git a/app/wlib/test/fred.c b/app/wlib/test/fred.c new file mode 100644 index 0000000..546d48c --- /dev/null +++ b/app/wlib/test/fred.c @@ -0,0 +1,169 @@ +#include <stdio.h> +#include "wlib.h" + +#include "fred.bmp" + +wMenu_p menu1a; +wMenu_p menu2; +wMenuList_p mlist1; +wButton_p butt2; +#define TRUE (1) +#define FALSE (0) + +static void doButt1( void * data ) +{ + static wBool_t busy2 = FALSE; + wControlActive( (wControl_p)butt2, busy2 ); + busy2 = ! busy2; + wNotice( "doButt1", "Ok", NULL ); + +} + +static void doButt2( void * data ) +{ + wNotice( "doButt2", "Ok", NULL ); +} + +static long valInt1 = 4; +static void doInt1( long val, void * data ) +{ + wNotice( "doInt1", "Ok", NULL ); +} + +static double valFlt1 = 4; +static void doFlt1( double val, void * data ) +{ + wNotice( "doFlt1", "Ok", NULL ); +} + +static char valTxt1[80] = "abcdefghijkl"; +static void doTxt1( char * val, void * data ) +{ + wNotice( "doText1", "Ok", NULL ); +} + +static long valList1 = 3; +static void doList1( wIndex_t inx, char * name, wIndex_t op, void * data, void * itemContext ) +{ + wNotice( name, "Ok", NULL ); + wMenuListAdd( mlist1, 0, name, NULL ); +} + +static long valList2 = 4; +static void doList2( wIndex_t inx, char * name, wIndex_t op, void * data, void * itemContext ) +{ + wNotice( name, "Ok", NULL ); + wMenuListDelete( mlist1, name ); +} + +static void doAnimal( void * data ) + +{ + wNotice( (char*)data, "Ok", NULL ); +} + +static long valList3 = 5; +static void doList3( wIndex_t inx, char * name, wIndex_t op, void * data, void * itemContext ) +{ + wNotice( name, "Ok", NULL ); + wMenuPushCreate( menu1a, NULL, name, doAnimal, name ); +} + +static void doMList1( int index, char * name, void * data ) +{ +} + +void printNewPageSize( void ) +{ +} + + +static wLines_t lines1[] = { + { 0, 100, 4, 200, 4 }, + { 0, 200, 4, 100, 200 }, + { 0, 100, 200, 200, 200 } }; + +void populateList( wList_p l ) { + wListAddValue( l, "Aardvark", NULL, NULL ); + wListAddValue( l, "Beaver", NULL, NULL ); + wListAddValue( l, "Elephant", NULL, NULL ); + wListAddValue( l, "Cow", NULL, NULL ); + wListAddValue( l, "Donkey", NULL, NULL ); + wListAddValue( l, "Jack Rabbit", NULL, NULL ); + wListAddValue( l, "Fawn", NULL, NULL ); + wListAddValue( l, "Nasty", NULL, NULL ); + wListAddValue( l, "Giraffe", NULL, NULL ); + wListAddValue( l, "Horse", NULL, NULL ); + wListAddValue( l, "Igloo", NULL, NULL ); + wListAddValue( l, "Lion", NULL, NULL ); + wListAddValue( l, "Kangaroo", NULL, NULL ); + wListAddValue( l, "Marmaset", NULL, NULL ); +} + +char * labels1[] = { "one", "two", "three", NULL }; + +wWin_p wMain( int argc, char * argv[] ) +{ + + wWin_p mainW, popupW; + wList_p list1B; + wList_p list2B; + wList_p list3B; + wButtonBitMap_p fred_bmp; + wMenu_p menu1; + wMenu_p menu2a; + wDraw_p draw1; + + mainW = wWinMainCreate( "Fred", 2, 2, "Help", "Main", F_AUTOSIZE|F_MENUBAR, NULL, NULL ); + popupW = wWinPopupCreate( mainW, 200, 400, "Help2", "Popup", 0, NULL, NULL ); + + menu1 = wMenuBarAdd( mainW, "menu1", "&Menu1" ); + wMenuPushCreate( menu1, "menu1-1", "&Dog", doAnimal, "Dog" ); + + wButtonCreate( mainW, 0, 0, "Button1", "Butt1", BB_DEFAULT, 0, doButt1, NULL ); + fred_bmp = wButtonBitMapCreate( fred_width, fred_height, fred_bits ); + butt2 = wButtonCreate( mainW, 100, 0, "Button2", (char*)fred_bmp, BO_ICON|BB_CANCEL, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + wButtonCreate( mainW, -1, 0, "Button2", (char*)fred_bmp, BO_ICON, 0, doButt2, NULL ); + menu2 = wMenuCreate( mainW, 50, -1, "Menu2", "2" ); + wMenuPushCreate( menu2, "menu2-1", "&Cat", doAnimal, "Cat" ); + wMenuPushCreate( menu2, "menu2-2", "&Mouse", doAnimal, "Mouse" ); + menu2a = wMenuMenuCreate( menu2, "menu2-3", "M&ore" ); + wMenuPushCreate( menu2a, "menu2a-1", "&Wolf", doAnimal, "Wolf" ); + wMenuPushCreate( menu2a, "menu2a-2", "&Pony", doAnimal, "Pony" ); + + menu1a = wMenuMenuCreate( menu1, "menu1-3", "M&ore" ); + wMenuPushCreate( menu1a, "menu1a-1", "&Wolf", doAnimal, "Wolf" ); + wMenuPushCreate( menu1a, "menu1a-2", "&Pony", doAnimal, "Pony" ); + wMenuSeparatorCreate( menu1a ); + mlist1 = wMenuListCreate( menu1a, "menu1-4", 10, doMList1 ); + wMenuPushCreate( menu1a, "menu1-5", "&Zebra", doAnimal, "Zebra" ); + + wIntegerCreate( mainW, 50, -1, "Integer1", "Int1", 0, 50, -100, 100, &valInt1, doInt1, NULL ); + wFloatCreate( mainW, 50, -1, "Float1", "Flt1", 0, 50, -100, 100, &valFlt1, doFlt1, NULL ); + wStringCreate( mainW, 50, -1, "Text1", "Txt1", 0, 100, valTxt1, sizeof valTxt1, doTxt1, NULL ); + wMessageCreate( mainW, 50, -1, "Message1", 150, "This is a message" ); + wRadioCreate( mainW, 50, -4, NULL, NULL, 0, labels1, NULL, NULL, NULL ); + wToggleCreate( mainW, 50, -4, NULL, NULL, 0, labels1, NULL, NULL, NULL ); + wRadioCreate( mainW, 50, -4, NULL, NULL, BC_HORZ, labels1, NULL, NULL, NULL ); + wToggleCreate( mainW, 50, -4, NULL, NULL, BC_HORZ, labels1, NULL, NULL, NULL ); + wLineCreate( mainW, "Line1", sizeof lines1 / sizeof lines1[0], lines1 ); + + draw1 = wDrawCreate( mainW, 250, 50, "Draw-1", 0, 150, 150, NULL, NULL, NULL ); + list1B = wListCreate( mainW, 250, -4, "List1", NULL, 0, 10, 200, &valList1, doList1, NULL ); + populateList( list1B ); + list2B = wDropListCreate( mainW, 250, -4, "List2", NULL, 0, 10, 200, &valList2, doList2, NULL ); + populateList( list2B ); + list3B = wComboListCreate( mainW, 250, -4, "List3", NULL, 0, 10, 200, &valList3, doList3, NULL ); + populateList( list3B ); + + + return mainW; +} diff --git a/app/wlib/test/fred.mak b/app/wlib/test/fred.mak new file mode 100644 index 0000000..7fd2ede --- /dev/null +++ b/app/wlib/test/fred.mak @@ -0,0 +1,2 @@ +all:
+ nmake /f wtest.mak TEST=fred
diff --git a/app/wlib/test/listtest.c b/app/wlib/test/listtest.c new file mode 100644 index 0000000..6140fd6 --- /dev/null +++ b/app/wlib/test/listtest.c @@ -0,0 +1,96 @@ +#include <stdio.h> +#include "wlib.h" + + +#define TRUE (1) +#define FALSE (0) + +wWin_p mainW, popup1W, popup2W; +wList_p list1lB; +wList_p list1dB; +wList_p list1cB; +wList_p list2lB; +wList_p list2dB; +wList_p list2cB; + +static long valList1 = 3; +static void doList1( wIndex_t inx, char * name, wIndex_t op, void * data, void * itemContext ) +{ + wNotice( name, "Ok", NULL ); +} + +static long valList2 = 4; +static void doList2( wIndex_t inx, char * name, wIndex_t op, void * data, void * itemContext ) +{ + wNotice( name, "Ok", NULL ); +} + + +static long valList3 = 5; +static void doList3( wIndex_t inx, char * name, wIndex_t op, void * data, void * itemContext ) +{ + wNotice( name, "Ok", NULL ); +} + + +void populateList( wList_p l ) { + wListAddValue( l, "Giraffe", NULL, NULL ); + wListAddValue( l, "Marmaset", NULL, NULL ); + wListAddValue( l, "Nasty", NULL, NULL ); + wListAddValue( l, "Beaver", NULL, NULL ); + wListAddValue( l, "Lion", NULL, NULL ); + wListAddValue( l, "Donkey", NULL, NULL ); + wListAddValue( l, "Elephant", NULL, NULL ); + wListAddValue( l, "Jack Rabbit", NULL, NULL ); + wListAddValue( l, "Horse", NULL, NULL ); + wListAddValue( l, "Aardvark", NULL, NULL ); + wListAddValue( l, "Igloo", NULL, NULL ); + wListAddValue( l, "Cow", NULL, NULL ); + wListAddValue( l, "Kangaroo", NULL, NULL ); + wListAddValue( l, "Fawn", NULL, NULL ); +} + +wWin_p wMain( int argc, char * argv[] ) +{ + + wMenu_p m1, m2; + + mainW = wWinMainCreate( "Fred", 40, 80, "Help", "Main", F_AUTOSIZE|F_MENUBAR, NULL, NULL ); + popup1W = wWinPopupCreate( mainW, 2, 2, "Help2", "double click", F_AUTOSIZE|F_MENUBAR, NULL, NULL ); + + list1lB = wListCreate( popup1W, 2, 2, "List1", NULL, BL_DBLCLICK, 10, 200, &valList1, doList1, NULL ); + populateList( list1lB ); + list1dB = wDropListCreate( popup1W, 2, -4, "List2", NULL, BL_DBLCLICK, 10, 200, &valList2, doList2, NULL ); + populateList( list1dB ); + list1cB = wComboListCreate( popup1W, 2, -4, "List3", NULL, BL_DBLCLICK, 10, 200, &valList3, doList3, NULL ); + populateList( list1cB ); + m1 = wMenuBarAdd( popup1W, NULL, "Menu" ); + wMenuPushCreate( m1, NULL, "Clear List 1", (wMenuCallBack_p)wListClear, list1lB ); + wMenuPushCreate( m1, NULL, "Clear List 2", (wMenuCallBack_p)wListClear, list1dB ); + wMenuPushCreate( m1, NULL, "Clear List 3", (wMenuCallBack_p)wListClear, list1cB ); + wMenuPushCreate( m1, NULL, "Pop List 1", (wMenuCallBack_p)populateList, list1lB ); + wMenuPushCreate( m1, NULL, "Pop List 2", (wMenuCallBack_p)populateList, list1dB ); + wMenuPushCreate( m1, NULL, "Pop List 3", (wMenuCallBack_p)populateList, list1cB ); + + + popup2W = wWinPopupCreate( mainW, 2, 2, "Help2", "single click", F_AUTOSIZE|F_MENUBAR, NULL, NULL ); + list2lB = wListCreate( popup2W, 2, -4, "List1", NULL, BL_SORT, 10, 200, &valList1, doList1, NULL ); + populateList( list2lB ); + list2dB = wDropListCreate( popup2W, 2, -4, "List2", NULL, BL_SORT, 10, 200, &valList2, doList2, NULL ); + populateList( list2dB ); + list2cB = wComboListCreate( popup2W, 2, -4, "List3", NULL, BL_SORT, 10, 200, &valList3, doList3, NULL ); + populateList( list2cB ); + m2 = wMenuBarAdd( popup2W, NULL, "Menu" ); + wMenuPushCreate( m2, NULL, "Clear List 1", (wMenuCallBack_p)wListClear, list2lB ); + wMenuPushCreate( m2, NULL, "Clear List 2", (wMenuCallBack_p)wListClear, list2dB ); + wMenuPushCreate( m2, NULL, "Clear List 3", (wMenuCallBack_p)wListClear, list2cB ); + wMenuPushCreate( m2, NULL, "Pop List 1", (wMenuCallBack_p)populateList, list2lB ); + wMenuPushCreate( m2, NULL, "Pop List 2", (wMenuCallBack_p)populateList, list2dB ); + wMenuPushCreate( m2, NULL, "Pop List 3", (wMenuCallBack_p)populateList, list2cB ); + + + + wWinShow( popup1W, TRUE ); + wWinShow( popup2W, TRUE ); + return mainW; +} diff --git a/app/wlib/test/listtest.mak b/app/wlib/test/listtest.mak new file mode 100644 index 0000000..3afe122 --- /dev/null +++ b/app/wlib/test/listtest.mak @@ -0,0 +1,2 @@ +all:
+ nmake /f wtest.mak TEST=listtest
diff --git a/app/wlib/test/splash.rc b/app/wlib/test/splash.rc new file mode 100644 index 0000000..5fb8a8c --- /dev/null +++ b/app/wlib/test/splash.rc @@ -0,0 +1,17 @@ +#define IDD_DLG1 1000 +#define IDC_IMG1 1001 +#define IDC_STC1 1002 +#define IDC_STC2 1003 +#define IDC_IMG2 1004 +#define IDI_LOGO 1000 +IDD_DLG1 DIALOGEX 6,6,194,102 +CAPTION "IDD_DLG" +FONT 8,"MS Sans Serif",0,0 +STYLE 0x10CF0000 +BEGIN + CONTROL "",IDC_IMG1,"Static",0x50000203,196,99,92,26 + CONTROL "Testapplication",IDC_STC1,"Static",0x50000201,0,57,194,9 + CONTROL "Application is starting",IDC_STC2,"Static",0x50000000,-2,68,199,9 + CONTROL "",IDC_IMG2,"Static",0x50000203,0,0,226,57 +END +IDI_LOGO IMAGE DISCARDABLE "logo.bmp" diff --git a/app/wlib/test/test.vcproj b/app/wlib/test/test.vcproj new file mode 100644 index 0000000..f857ec8 --- /dev/null +++ b/app/wlib/test/test.vcproj @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="test" + ProjectGUID="{B500EFE5-B60C-4CB5-B818-52ACF4B3C30A}" + RootNamespace="test" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(InputDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\include" + PreprocessorDefinitions="WIN32;WINVER=0x0500;_DEBUG;_WINDOWS;WINDOWS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="4" + CompileAs="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="htmlhelp.lib" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="htmlhelp.lib" + LinkIncremental="1" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\testapp.c" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/app/wlib/test/testapp.c b/app/wlib/test/testapp.c new file mode 100644 index 0000000..6342801 --- /dev/null +++ b/app/wlib/test/testapp.c @@ -0,0 +1,125 @@ +/** \file testapp.c + * Small test application to demonstrate functionality of the XTrkCad windowing library wlib + * + * $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/wlib/test/testapp.c,v 1.2 2007-09-14 16:17:24 m_fischer Exp $ + */ + +/* XTrkCad - Model Railroad CAD + * Copyright (C) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#include <stdio.h> +#include "wlib.h" + +#define APPNAME "TESTAPP" +#define WINDOWTITLE "Test Application" + +#define TRUE (1) +#define FALSE (0) + +/** + * doFile: callback funtion for file submenu + */ + +void doFile( void * cmd ) +{ + switch ((int)cmd) { + case 1: + break; + case 0: /* 'Quit ' */ + wExit( 0 ); /* terminate application */ + } +} + + +wWin_p wMain( int argc, char * argv[] ) +{ + + wWin_p mainW; + wMenu_p menu1; + wMenu_p menu2; + int i; + char buffer[ 80 ]; + + /* add a splash window */ + wCreateSplash( WINDOWTITLE, /* name of application to show */ + "1.0" /* application version information */ + ); + + wFlush(); /* make sure splash window is shown */ + + /* create main window */ + mainW = wWinMainCreate( APPNAME, /* application name */ + 200, /* position x */ + 100, /* position y */ + "Help", /* help topic */ + WINDOWTITLE, /* window title */ + APPNAME, /* window name */ + F_RESIZE|F_MENUBAR, /* options */ + NULL, /* window callback function */ + NULL /* pointer to user data */ + ); + + wWinShow( mainW, FALSE ); + + /* add a submenu */ + menu1 = wMenuBarAdd( mainW, /* parent window */ + NULL, /* help topic */ + "File" /* submenu title */ + ); + + /* create a menuitem in submenu */ + wMenuPushCreate( menu1, /* parent menu */ + NULL, /* help topic */ + "Test", /* submenu title */ + 0, /* accelerator key */ + doFile, /* callback funtion */ + (void*)1 /* pointer to user data */ + ); + + + /* create a separator before 'Quit' */ + wMenuSeparatorCreate( menu1 ); + + /* create a menuitem in submenu */ + wMenuPushCreate( menu1, /* parent menu */ + NULL, /* help topic */ + "Quit", /* submenu title */ + 0, /* accelerator key */ + doFile, /* callback funtion */ + (void*)0 /* pointer to user data */ + ); + + /* create a second submenu */ + menu2 = wMenuBarAdd( mainW, /* parent window */ + NULL, /* help topic */ + "Help" /* submenu title */ + ); + + for( i = 5; i > 0; i-- ) { + sprintf(buffer, "Countdown %d", i ); + wSetSplashInfo( buffer ); + wPause( 1000L ); + } + + wWinShow( mainW, TRUE ); + wPause ( 2000L ); + wDestroySplash(); /* remove the splash window again */ + + return mainW; +} diff --git a/app/wlib/test/wtest.def b/app/wlib/test/wtest.def new file mode 100644 index 0000000..e8a631f --- /dev/null +++ b/app/wlib/test/wtest.def @@ -0,0 +1,9 @@ +NAME Generic +DESCRIPTION 'wtest' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE MOVEABLE DISCARDABLE +DATA MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 5120 +EXPORTS MainWndProc @1 About @2
\ No newline at end of file diff --git a/app/wlib/test/wtest.ico b/app/wlib/test/wtest.ico Binary files differnew file mode 100644 index 0000000..998d604 --- /dev/null +++ b/app/wlib/test/wtest.ico diff --git a/app/wlib/test/wtest.mak b/app/wlib/test/wtest.mak new file mode 100644 index 0000000..6c1a62a --- /dev/null +++ b/app/wlib/test/wtest.mak @@ -0,0 +1,23 @@ +all: $(TEST).exe wtest.res + +some: wtest.exe wtest.res + +FREDOBJS = $(TEST).obj + +.c.obj: + @cl /nologo /DWINDOWS /c /I../include /Od /Zp /W3 $< + +mswlibl: + echo making mswlib.lib + cd ..\mswlib + makemsw + cd ..\wtest + +$(TEST).exe: $(FREDOBJS) wtest.def + @echo /nologo > $(TEST).lnk + @echo $(TEST).obj >> $(TEST).lnk + @echo $(TEST) >> $(TEST).lnk + @echo $(TEST) >> $(TEST).lnk + @echo ..\mswlib\Debug\wlib.lib >> $(TEST).lnk + link @$(TEST).lnk + rc /I.. /I..\mswlib wtest.rc $(TEST).exe
\ No newline at end of file diff --git a/app/wlib/test/wtest.rc b/app/wlib/test/wtest.rc new file mode 100644 index 0000000..13d6d46 --- /dev/null +++ b/app/wlib/test/wtest.rc @@ -0,0 +1,22 @@ +#include <windows.h>
+#include "w.h"
+#include "mswlib.h"
+MSWAPPICON ICON wtest.ico
+Generic MENU
+BEGIN
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "About Generic...", IDM_ABOUT
+ END
+END
+
+AboutBox DIALOG 22, 17, 144, 75
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About Generic"
+BEGIN
+ CTEXT "WLIB Windows", -1, 0, 5, 144, 8
+ CTEXT "Test Application", -1, 0, 14, 144, 8
+ CTEXT "Version 0.1", -1, 0, 34, 144, 8
+ DEFPUSHBUTTON "OK" IDOK, 53, 59, 32, 14, WS_GROUP
+END
+#include "mswlib.rc"
|