diff --git a/programs/cmm/examples/window.c b/programs/cmm/examples/window.c index 87d9a29d3b..f27cb035f4 100644 --- a/programs/cmm/examples/window.c +++ b/programs/cmm/examples/window.c @@ -1,40 +1,21 @@ #define MEMSIZE 4096*10 #include "../lib/io.h" -#include "../lib/gui.h" +#include "../lib/window.h" +window win1=0; void main() { - word id; - dword file; io.dir.load(0,DIR_ONLYREAL); - loop() switch(WaitEvent()) - { - case evButton: - id=GetButtonID(); - if (id==1) ExitProcess(); - break; - - case evKey: - GetKeys(); - if (key_scancode == SCAN_CODE_ESC ) ExitProcess(); - break; - - case evReDraw: - draw_window(); - break; - } + win1.background = 0xFFFFFF; + win1.left = 200; + win1.ondraw = #draw_window; + win1.create(); } void draw_window() { - proc_info Form; int i; - DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0); - GetProcessInfo(#Form, SelfInfo); - for (i=0; i]\n" #ifndef INCLUDE_STRING_H #include "../lib/strings.h" diff --git a/programs/cmm/lib/debug.h b/programs/cmm/lib/debug.h index b3677b13de..dfcf2522d5 100644 --- a/programs/cmm/lib/debug.h +++ b/programs/cmm/lib/debug.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_DEBUG_H #define INCLUDE_DEBUG_H -#print "[include ]\n" #ifndef INCLUDE_STRING_H #include "../lib/strings.h" diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index e0f9083157..bf253e855c 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_GUI_H #define INCLUDE_GUI_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/io.h b/programs/cmm/lib/io.h index d657fbce9e..742bc98117 100644 --- a/programs/cmm/lib/io.h +++ b/programs/cmm/lib/io.h @@ -22,7 +22,6 @@ #ifndef INCLUDE_IO_H #define INCLUDE_IO_H -#print "[include ]\n" #ifndef INCLUDE_DATE_H #include "../lib/date.h" diff --git a/programs/cmm/lib/keyboard.h b/programs/cmm/lib/keyboard.h index 9aed9a8a83..87e158ec0f 100644 --- a/programs/cmm/lib/keyboard.h +++ b/programs/cmm/lib/keyboard.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_KEYBOARD_H #define INCLUDE_KEYBOARD_H -#print "[include ]\n" //ASCII KEYS #define ASCII_KEY_BS 008 diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index 0ec09fd561..ae9e8530df 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -2,7 +2,6 @@ #ifndef INCLUDE_KOLIBRI_H #define INCLUDE_KOLIBRI_H -#print "[include ]\n" #pragma option OST #pragma option ON diff --git a/programs/cmm/lib/lexer.h b/programs/cmm/lib/lexer.h index 9ca7ecf12d..6edc224225 100644 --- a/programs/cmm/lib/lexer.h +++ b/programs/cmm/lib/lexer.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_LEXER_H #define INCLUDE_LEXER_H -#print "[include ]\n" #ifndef INCLUDE_STRING_H #include "../lib/strings.h" diff --git a/programs/cmm/lib/list_box.h b/programs/cmm/lib/list_box.h index 49679e92db..0a80640632 100644 --- a/programs/cmm/lib/list_box.h +++ b/programs/cmm/lib/list_box.h @@ -1,7 +1,6 @@ //list_box #ifndef INCLUDE_LIST_BOX_H #define INCLUDE_LIST_BOX_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/mem.h b/programs/cmm/lib/mem.h index b4b2862ebb..534becf747 100644 --- a/programs/cmm/lib/mem.h +++ b/programs/cmm/lib/mem.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_MEM_H #define INCLUDE_MEM_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/mouse.h b/programs/cmm/lib/mouse.h index b3e81eab6e..38b0fcc261 100644 --- a/programs/cmm/lib/mouse.h +++ b/programs/cmm/lib/mouse.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_MOUSE_H #define INCLUDE_MOUSE_H -#print "[include ]\n" //Button MOUSE #define MOUSE_LEFT 001b diff --git a/programs/cmm/lib/obj/box_lib.h b/programs/cmm/lib/obj/box_lib.h index b14fb364af..eaeb57cfef 100644 --- a/programs/cmm/lib/obj/box_lib.h +++ b/programs/cmm/lib/obj/box_lib.h @@ -1,7 +1,6 @@ //BOX_LIB - Asper #ifndef INCLUDE_BOX_LIB_H #define INCLUDE_BOX_LIB_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/obj/console.h b/programs/cmm/lib/obj/console.h index 12c768537c..e460bd1b26 100644 --- a/programs/cmm/lib/obj/console.h +++ b/programs/cmm/lib/obj/console.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_CONSOLE_H #define INCLUDE_CONSOLE_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/obj/libimg_lib.h b/programs/cmm/lib/obj/libimg_lib.h index b2b8ffae27..f9277ee96c 100644 --- a/programs/cmm/lib/obj/libimg_lib.h +++ b/programs/cmm/lib/obj/libimg_lib.h @@ -1,7 +1,6 @@ //Asper #ifndef INCLUDE_LIBIMG_H #define INCLUDE_LIBIMG_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/obj/libini.h b/programs/cmm/lib/obj/libini.h index ad380b7011..56d574f3d2 100644 --- a/programs/cmm/lib/obj/libini.h +++ b/programs/cmm/lib/obj/libini.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_LIBINI_H #define INCLUDE_LIBINI_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/obj/libio_lib.h b/programs/cmm/lib/obj/libio_lib.h index 4026f02838..4f6e1c99a6 100644 --- a/programs/cmm/lib/obj/libio_lib.h +++ b/programs/cmm/lib/obj/libio_lib.h @@ -1,7 +1,6 @@ //Asper #ifndef INCLUDE_LIBIO_H #define INCLUDE_LIBIO_H -#print "[include ]\n" #ifndef INCLUDE_KOLIBRI_H #include "../lib/kolibri.h" diff --git a/programs/cmm/lib/patterns/rgb.h b/programs/cmm/lib/patterns/rgb.h index 4db4521830..073db52b7e 100644 --- a/programs/cmm/lib/patterns/rgb.h +++ b/programs/cmm/lib/patterns/rgb.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_RGB_H #define INCLUDE_RGB_H -#print "[include ]\n" :struct _rgb { diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index 774152a780..47d01d9fa2 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_STRING_H #define INCLUDE_STRING_H -#print "[include ]\n" #ifndef INCLUDE_MEM_H #include "../lib/mem.h" diff --git a/programs/cmm/lib/system.h b/programs/cmm/lib/system.h index ae21719163..1d574a480e 100644 --- a/programs/cmm/lib/system.h +++ b/programs/cmm/lib/system.h @@ -1,6 +1,5 @@ #ifndef INCLUDE_SYSTEM_H #define INCLUDE_SYSTEM_H -#print "[include ]\n" :struct COLORS { dword diff --git a/programs/cmm/lib/window.h b/programs/cmm/lib/window.h new file mode 100644 index 0000000000..3c7808a7f8 --- /dev/null +++ b/programs/cmm/lib/window.h @@ -0,0 +1,49 @@ +#ifndef INCLUDE_WINDOW_H +#define INCLUDE_WINDOW_H +#include "../lib/gui.h" + + +#define WINDOW_NORMAL 0x34 +:struct window +{ + void create(); + dword left,top,width,height; + dword caption,type,background; + dword onbutton,onkey,ondraw; + proc_info Form; +}; + +void window::create() +{ + word id=0; + IF(!caption)caption = "Window"; + IF(!width)width=350; + IF(!height)height=300; + IF(!type)type = WINDOW_NORMAL; + IF(!background)background = 0xDED7CE; + + loop() switch(WaitEvent()) + { + case evButton: + id=GetButtonID(); + IF(onbutton)onbutton(id); + IF (id==1) ExitProcess(); + break; + + case evKey: + GetKeys(); + IF(onkey)onbutton(key_scancode); + //if (key_scancode == SCAN_CODE_ESC ) ExitProcess(); + break; + + case evReDraw: + GetProcessInfo(#Form, SelfInfo); + DefineAndDrawWindow(left,top,width,height,type,background,caption,0); + + IF(ondraw)ondraw(); + break; + } + +} + +#endif \ No newline at end of file