Subversion Repositories Kolibri OS

Rev

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

  1. #define MEMSIZE 4096*10
  2.  
  3. #include "../lib/io.h"
  4. #include "../lib/list_box.h"
  5. #include "../lib/gui.h"
  6. #include "../lib/menu.h"
  7.  
  8. struct _object
  9. {
  10.         int x,y,w,h,id;
  11. };
  12.  
  13. _object butv = { 20, 20, 100, 30, 10};
  14. _object buta = {150, 20, 100, 30, 20};
  15.  
  16. char vegetables[] =
  17. "Onion
  18. Melon
  19. Tomato
  20. Squash
  21. Salad";
  22.  
  23. char animals[] =
  24. "Cat
  25. Dog
  26. Pig
  27. Cow
  28. Goat
  29. Rabbit";
  30.  
  31. byte category;
  32.  
  33.  
  34. void main()
  35. {
  36.         proc_info Form;
  37.         int id;
  38.  
  39.         loop() switch(WaitEvent())
  40.         {
  41.          case evButton:
  42.                 id=GetButtonID();              
  43.                 if (id==1) ExitProcess();
  44.                 if (id==butv.id) {
  45.                         menu.selected = category+1;
  46.                         menu.show(Form.left+5 + butv.x, Form.top+skin_height + butv.y + butv.h, 140, #vegetables, butv.id);
  47.                 }
  48.                 if (id==buta.id) {
  49.                         menu.selected = 0;
  50.                         menu.show(Form.left+5 + buta.x, Form.top+skin_height + buta.y + buta.h, 140,    #animals, buta.id);
  51.                 }
  52.                 break;
  53.  
  54.         case evKey:
  55.                 GetKeys();
  56.                 break;
  57.          
  58.          case evReDraw:
  59.                 if (menu.list.cur_y) {
  60.                         if (menu.list.cur_y > butv.id) && (menu.list.cur_y < buta.id) category = menu.list.cur_y - butv.id;
  61.                 }
  62.                 DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0);
  63.                 GetProcessInfo(#Form, SelfInfo);
  64.                 WriteText(10,110,0x80,0,#param);
  65.                 DrawCaptButton(butv.x, butv.y, butv.w, butv.h, butv.id, 0xCCCccc, 0x000000, "Vegetables");
  66.                 DrawCaptButton(buta.x, buta.y, buta.w, buta.h, buta.id, 0xCCCccc, 0x000000, "Aminal");
  67.                 break;
  68.         }
  69. }
  70.