Subversion Repositories Kolibri OS

Rev

Rev 8020 | 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/fs.h"
  7.  
  8. struct _object
  9. {
  10.         int x,y,w,h,id;
  11. };
  12.  
  13. _object butv = { 20, 20, 100, 20, 10};
  14. _object buta = {150, 20, 100, 20, 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.  
  32. proc_info Form;
  33.  
  34. void main()
  35. {
  36.         dword menu_id=0, click_id;
  37.         byte current_animal=1, current_veg=3;
  38.         int id;
  39.  
  40.         loop() switch(WaitEvent())
  41.         {
  42.          case evButton:
  43.                 id=GetButtonID();              
  44.                 if (id==1) ExitProcess();
  45.                 if (id==butv.id) {
  46.                         menu_id = butv.id;
  47.                         open_lmenu(butv.x, butv.y + butv.h, MENU_TOP_LEFT,
  48.                                 current_veg, #vegetables);
  49.                 }
  50.                 if (id==buta.id) {
  51.                         menu_id = buta.id;
  52.                         open_lmenu(buta.x + buta.w, buta.y + buta.h,
  53.                                 MENU_TOP_RIGHT, current_animal, #animals);
  54.                 }
  55.                 break;
  56.  
  57.         case evKey:
  58.                 GetKeys();
  59.                 break;
  60.          
  61.          case evReDraw:
  62.                 if (click_id = get_menu_click()) {
  63.                         if (menu_id == butv.id) current_veg = click_id;
  64.                         if (menu_id == buta.id) current_animal = click_id;
  65.                         menu_id = 0;
  66.                 }
  67.                 DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0);
  68.                 GetProcessInfo(#Form, SelfInfo);
  69.                 WriteText(10,110,0x80,0,#param);
  70.                 DrawCaptButton(butv.x, butv.y, butv.w, butv.h, butv.id, 0xCCCccc, 0x000000, "Vegetables");
  71.                 DrawCaptButton(buta.x, buta.y, buta.w, buta.h, buta.id, 0xCCCccc, 0x000000, "Aminal");
  72.                 break;
  73.         }
  74. }
  75.