kolibrios-fun/programs/cmm/lib/window.h
Kirill Lipatov (Leency) 1392a1c519 CMM: general refactoring
git-svn-id: svn://kolibrios.org@7227 a494cfbc-eb01-0410-851d-a64ba20cac60
2018-04-15 22:44:36 +00:00

49 lines
940 B
C

#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