Subversion Repositories Kolibri OS

Rev

Rev 6613 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. MODULE HW;
  2.  
  3. IMPORT sys := SYSTEM, KOSAPI;
  4.  
  5. PROCEDURE WindowRedrawStatus(p: INTEGER);
  6. BEGIN
  7.   KOSAPI.sysfunc2(12, p)
  8. END WindowRedrawStatus;
  9.  
  10. PROCEDURE DefineAndDrawWindow(x, y, w, h, color, style, hcolor, hstyle, htext: INTEGER);
  11. BEGIN
  12.   KOSAPI.sysfunc6(0, x * 65536 + w, y * 65536 + h, color + LSL(style, 24), hcolor + LSL(hstyle, 24), htext)
  13. END DefineAndDrawWindow;
  14.  
  15. PROCEDURE WriteTextToWindow(x, y, color: INTEGER; text: ARRAY OF CHAR);
  16. BEGIN
  17.   KOSAPI.sysfunc6(4, x * 65536 + y, color + LSL(48, 24), sys.ADR(text[0]), LENGTH(text), 0)
  18. END WriteTextToWindow;
  19.  
  20. PROCEDURE WaitForEvent(): INTEGER;
  21.   RETURN KOSAPI.sysfunc1(10)
  22. END WaitForEvent;
  23.  
  24. PROCEDURE ExitApp;
  25. BEGIN
  26.   KOSAPI.sysfunc1(-1)
  27. END ExitApp;
  28.  
  29. PROCEDURE draw_window(header, text: ARRAY OF CHAR);
  30. BEGIN
  31.   WindowRedrawStatus(1);
  32.   DefineAndDrawWindow(200, 200, 200, 100, 0FFFFFFH, 51, 0, 0, sys.ADR(header));
  33.   WriteTextToWindow(10, 10, 0FF0000H, text);
  34.   WindowRedrawStatus(2);
  35. END draw_window;
  36.  
  37. PROCEDURE Main(header, text: ARRAY OF CHAR);
  38. BEGIN
  39.   WHILE TRUE DO
  40.     CASE WaitForEvent() OF
  41.     |1: draw_window(header, text)
  42.     |3: ExitApp
  43.     ELSE
  44.     END
  45.   END
  46. END Main;
  47.  
  48. BEGIN
  49.   Main("HW", "Hello, world!")
  50. END HW.