Subversion Repositories Kolibri OS

Rev

Rev 1003 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #code32 TRUE
  2.  
  3. char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
  4. dword  os_version   = 0x00000001;
  5. dword  start_addr   = #main;
  6. dword  final_addr   = #stop+32;
  7. dword  alloc_mem    = 0x00100000;
  8. dword  x86esp_reg   = 0x0007fff0;
  9. dword  I_Param      = 0x0;
  10. dword  I_Icon       = 0x0;
  11.  
  12. #define evButton  3
  13. #define evKey     2
  14. #define evReDraw  1
  15.  
  16. #define BT_DEL          0x80000000
  17. #define BT_HIDE         0x40000000
  18. #define BT_NOFRAME      0x20000000
  19.  
  20.  
  21.  
  22. inline fastcall dword WaitEvent(){
  23.  EAX = 10;              // wait here for event
  24.  $int 0x40
  25. }
  26.  
  27.  
  28. inline fastcall void ExitProcess(){
  29.  EAX = -1;              // close this program
  30.  $int 0x40
  31. }
  32.  
  33. inline fastcall word GetKey(){
  34.  EAX = 2;              // just read it key from buffer
  35.  $int  0x40
  36.  EAX = EAX >> 8;
  37. }
  38.  
  39. inline fastcall word GetButtonID(){
  40.  EAX = 17;            // Get ID
  41.  $int  0x40
  42.  EAX = EAX >> 8;
  43. }
  44.  
  45. inline fastcall dword GetSkinWidth()
  46. {
  47.         EAX = 48;
  48.         EBX = 4;
  49.         $int 0x40
  50. }
  51.  
  52. inline fastcall void DeleteButton(dword EDX)
  53. {
  54.         EAX = 8;
  55.         EDX += BT_DEL;
  56.         $int 0x40;
  57. }
  58.  
  59. inline fastcall dword strlen(dword EDI){
  60.         ECX=EAX=0;
  61.         ECX--;
  62.         $REPNE $SCASB
  63.         EAX-=2+ECX;
  64. }
  65.  
  66.  
  67. inline fastcall void WindowRedrawStatus(dword EBX){
  68.         EAX = 12;
  69.         $int 0x40
  70. }
  71.  
  72.  
  73. void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
  74. {
  75.         EBX = x << 16 + sizeX;
  76.         ECX = y << 16 + sizeY;
  77.         EDX = mainAreaType << 24 | mainAreaColour;
  78.         ESI = headerType << 24 | headerColour;
  79.         $xor eax,eax
  80.         $int 0x40
  81. }
  82.  
  83. void DefineButton(dword x,y,w,h,EDX,ESI)
  84. {
  85.         EAX = 8;
  86.         EBX = x<<16+w;
  87.         ECX = y<<16+h;
  88.         $int 0x40
  89. }
  90.  
  91. void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
  92. {
  93.         EAX = 4;
  94.         EBX = x<<16+y;
  95.         ECX = fontType<<24+color;
  96.         $int 0x40;
  97. }
  98.  
  99.  
  100. void DrawBar(dword x,y,w,h,EDX)
  101. {
  102.         EAX = 13;
  103.         EBX = x<<16+w;
  104.         ECX = y<<16+h;
  105.         $int 0x40
  106. }
  107.  
  108.  
  109. void DrawRegion(dword x,y,width,height,color1)
  110. {
  111.         DrawBar(x,y,width,1,color1); //ïîëîñà ãîð ñâåðõó
  112.         DrawBar(x,y+height,width,1,color1); //ïîëîñà ãîð ñíèçó
  113.         DrawBar(x,y,1,height,color1); //ïîëîñà âåðò ñëåâà
  114.         DrawBar(x+width,y,1,height+1,color1); //ïîëîñà âåðò ñïðàâà
  115. }
  116.  
  117. void DrawFlatButton(dword x,y,width,height,id,color,text)
  118. {
  119.         DrawRegion(x,y,width,height,0x94AECE);
  120.         DrawBar(x+1,y+1,width-1,1,0xFFFFFF); //ïîëîñà ãîð áåëàÿ
  121.         DrawBar(x+1,y+height-1,width-2,1,0xC7C7C7); //òåíü âåðò
  122.         DrawBar(x+1,y+1,1,height-1,0xFFFFFF); //ïîëîñà âåðò áåëàÿ
  123.         DrawBar(x+width-1,y+2,1,height-2,0xC7C7C7); //òåíü âåðò
  124.         DrawBar(x+2,y+2,width-3,height-3,color); //çàëèâêà
  125.         IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //îïðåäåëÿåì êíîïêó
  126.         WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
  127. }
  128.  
  129.  
  130. void PutImage(dword EBX,w,h,x,y)
  131. {
  132.         EAX = 7;
  133.         ECX = w<<16+h;
  134.         EDX = x<<16+y;
  135.         $int 0x40
  136. }
  137.  
  138.  
  139. void copystr(dword s,d)
  140. {
  141.         $mov esi,s
  142.         $mov edi,d
  143.         $cld
  144. l1:
  145.         $lodsb
  146.         $stosb
  147.         $test al,al
  148.         $jnz l1
  149. }
  150.  
  151. void WriteNumber(dword x,y,byte fontType, ESI, ECX)
  152. {
  153.         EAX = 47;
  154.         EBX = 2<<16;
  155.         /*ecx = 0
  156.         while(eax>10)
  157.         {
  158.                 ecx ++;
  159.                 eax /= 10;
  160.         }*/
  161.         EDX = x<<16+y;
  162.         ESI = fontType<<24+ESI;
  163.         $int 0x40;
  164. }  
  165.