Subversion Repositories Kolibri OS

Rev

Rev 4077 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. //Leency - 2012-2013
  2.  
  3. char *ITEMS_LIST[]={
  4. "WIN                  F5",54,
  5. "DOS              Ctrl+D",04,
  6. "KOI              Ctrl+K",11,
  7. "UTF              Ctrl+U",21,
  8. #ifdef LANG_RUS
  9. "ˆá室­¨ª áâà ­¨æë    F3",52,
  10. "Žç¨áâ¨âì ªíè ª à⨭®ª"  ,02,
  11. #else
  12. "View source          F3",52,
  13. "Free image cache"       ,02,
  14. #endif
  15. 0};
  16.  
  17. llist menu;
  18. dword col_work    = 0xE4DFE1;
  19. dword col_border  = 0x9098B0;
  20.  
  21. void menu_rmb()
  22. {
  23.         mouse mm;
  24.         proc_info MenuForm;
  25.         int key;
  26.  
  27.         menu.first = menu.current = 0;
  28.         while (ITEMS_LIST[menu.count*2]) menu.count++;
  29.         menu.SetSizes(2,2,165,menu.count*19,0,19);
  30.         SetEventMask(100111b);
  31.  
  32.         loop() switch(WaitEvent())
  33.         {
  34.         case evMouse:
  35.                                 GetProcessInfo(#MenuForm, SelfInfo);
  36.                                 if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
  37.  
  38.                                 mm.get();
  39.                                 if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
  40.                                 if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
  41.                                 break;
  42.                                
  43.                 case evKey:
  44.                                 key = GetKey();
  45.                                 if (key==27) ExitProcess();
  46.                                 if (menu.ProcessKey(key)) DrawMenuList();
  47.                                 if (key==13)
  48.                                 {
  49.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  50.                                         ExitProcess();
  51.                                 }
  52.                                 break;
  53.                                
  54.                 case evReDraw:
  55.                                 DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
  56.                                 DrawPopup(0,0,menu.w,menu.h+3,0, col_work,col_border);
  57.                                 DrawMenuList();                        
  58.         }
  59. }
  60.  
  61. void DrawMenuList()
  62. {
  63.         int N;
  64.  
  65.         for (N=0; N<menu.count; N++;)
  66.         {
  67.                 if (N==menu.current)
  68.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
  69.                 else
  70.                 {
  71.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_work);
  72.                         WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
  73.                 }
  74.                 WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
  75.         }
  76.         DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
  77. }
  78.