Subversion Repositories Kolibri OS

Rev

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