Subversion Repositories Kolibri OS

Rev

Rev 8022 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #define MEMSIZE 1024*40
  2.  
  3. #include "../lib/list_box.h"
  4. #include "../lib/gui.h"
  5. #include "../lib/fs.h"
  6.  
  7. struct _object
  8. {
  9.         int x,y,w,h,id;
  10. };
  11.  
  12. _object butv = { 20, 20, 100, 20, 10};
  13. _object buta = {150, 20, 100, 20, 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.  
  31. proc_info Form;
  32.  
  33. void main()
  34. {
  35.         dword menu_id=0, click_id;
  36.         byte current_animal=1, current_veg=3;
  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_id = butv.id;
  46.                         open_lmenu(butv.x, butv.y + butv.h, MENU_TOP_LEFT,
  47.                                 current_veg, #vegetables);
  48.                 }
  49.                 if (id==buta.id) {
  50.                         menu_id = buta.id;
  51.                         open_lmenu(buta.x + buta.w, buta.y + buta.h,
  52.                                 MENU_TOP_RIGHT, current_animal, #animals);
  53.                 }
  54.                 break;
  55.  
  56.         case evKey:
  57.                 GetKeys();
  58.                 break;
  59.          
  60.          case evReDraw:
  61.                 if (click_id = get_menu_click()) {
  62.                         if (menu_id == butv.id) current_veg = click_id;
  63.                         if (menu_id == buta.id) current_animal = click_id;
  64.                         menu_id = 0;
  65.                 }
  66.                 DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0);
  67.                 GetProcessInfo(#Form, SelfInfo);
  68.                 WriteText(10,110,0x80,0,#param);
  69.                 DrawCaptButton(butv.x, butv.y, butv.w, butv.h, butv.id, 0xCCCccc, 0x000000, "Vegetables");
  70.                 DrawCaptButton(buta.x, buta.y, buta.w, buta.h, buta.id, 0xCCCccc, 0x000000, "Aminal");
  71.                 break;
  72.         }
  73. }
  74.