forked from KolibriOS/kolibrios
CMM: list_box library mouse events, change programs to use them
git-svn-id: svn://kolibrios.org@4077 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3333411699
commit
12249cc996
@ -24,10 +24,11 @@ void menu_rmb()
|
||||
dword col_work = 0xE4DFE1;
|
||||
dword col_border = 0x9098B0;
|
||||
|
||||
menu.w = 165;
|
||||
menu.line_h = 19;
|
||||
menu.first = 0;
|
||||
menu.first = menu.current = 0;
|
||||
while (ITEMS_LIST[menu.count*2]) {menu.count++; menu.visible++;}
|
||||
menu.line_h = 19;
|
||||
menu.w = 165;
|
||||
menu.h = menu.count * menu.line_h;
|
||||
SetEventMask(100111b);
|
||||
|
||||
loop() switch(WaitEvent())
|
||||
@ -38,18 +39,8 @@ void menu_rmb()
|
||||
if (N<>GetActiveProcess()) ExitProcess();
|
||||
|
||||
mm.get();
|
||||
overid=mm.y/menu.line_h;
|
||||
if (overid<0) || (overid+1>menu.count) || (mm.x<0) || (mm.x>menu.w) break;
|
||||
if (mm.lkm) || (mm.pkm)
|
||||
{
|
||||
action_buf = ITEMS_LIST[menu.current*2+1];
|
||||
ExitProcess();
|
||||
}
|
||||
if (menu.current<>overid)
|
||||
{
|
||||
menu.current=overid;
|
||||
goto _ITEMS_DRAW;
|
||||
}
|
||||
if (menu.ProcessMouse(mm.x, mm.y)) goto _ITEMS_DRAW;
|
||||
if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
|
@ -53,7 +53,7 @@ void FileMenu()
|
||||
int index;
|
||||
|
||||
menu.ClearList();
|
||||
menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18);
|
||||
menu.SetSizes(0,0,10,0,0,18);
|
||||
for (index=0; file_captions[index]!=0; index+=3)
|
||||
{
|
||||
if (itdir) && (file_captions[index+2]>=200) continue;
|
||||
@ -72,13 +72,7 @@ void FileMenu()
|
||||
slot = GetProcessSlot(MenuForm.ID);
|
||||
if (slot != GetActiveProcess()) ExitProcess();
|
||||
mm.get();
|
||||
menu.current_temp = mm.y - 1 / menu.line_h;
|
||||
if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) menu.current_temp = -1;
|
||||
if (menu.current<>menu.current_temp)
|
||||
{
|
||||
menu.current=menu.current_temp;
|
||||
MenuListRedraw();
|
||||
}
|
||||
if (menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw();
|
||||
if (mm.lkm) {action_buf = cur_action_buf; pause(5); ExitProcess(); }
|
||||
break;
|
||||
|
||||
@ -90,7 +84,7 @@ void FileMenu()
|
||||
break;
|
||||
|
||||
case evReDraw: _MENU_DRAW:
|
||||
DefineAndDrawWindow(menu.x, menu.y,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
|
||||
DefineAndDrawWindow(m.x+Form.left+5, m.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
DrawRectangle(0,0,menu.w+1,menu.h+2,sc.work_graph);
|
||||
DrawBar(1,1,menu.w,1,0xFFFfff);
|
||||
|
@ -79,26 +79,13 @@ void OpenWith()
|
||||
slot = GetProcessSlot(MenuForm.ID);
|
||||
if (slot != GetActiveProcess()) ExitProcess();
|
||||
mm.get();
|
||||
//if (mm.lkm) ExitProcess();
|
||||
if (mm.vert)
|
||||
{
|
||||
app_list.MouseScroll(mm.vert);
|
||||
DrawAppList();
|
||||
}
|
||||
if (mm.x>app_list.x) && (mm.x<app_list.x+app_list.w) && (mm.y>app_list.y) && (mm.y<app_list.y+app_list.h)
|
||||
{
|
||||
app_list.current_temp = mm.y - app_list.y / app_list.line_h + app_list.first;
|
||||
if (app_list.current_temp != app_list.current)
|
||||
{
|
||||
app_list.current = app_list.current_temp;
|
||||
DrawAppList();
|
||||
}
|
||||
if (mm.lkm)
|
||||
if (mm.vert) && (app_list.MouseScroll(mm.vert)) DrawAppList();
|
||||
if (app_list.ProcessMouse(mm.x, mm.y)) DrawAppList();
|
||||
if (app_list.MouseOver(mm.x, mm.y)) && (mm.lkm)
|
||||
{
|
||||
RunProgram(#app_paths[app_list.current].item, #file_path);
|
||||
ExitProcess();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -7,6 +7,8 @@ struct llist
|
||||
int current_temp;
|
||||
void ClearList();
|
||||
int ProcessKey(dword key);
|
||||
int MouseOver(int xx, yy);
|
||||
int ProcessMouse(int xx, yy);
|
||||
int KeyDown();
|
||||
int KeyUp();
|
||||
int KeyHome();
|
||||
@ -50,6 +52,26 @@ int llist::MouseScroll(dword scroll_state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int llist::MouseOver(int xx, yy)
|
||||
{
|
||||
if (xx>x) && (xx<x+w) && (yy>y) && (yy<y+h) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int llist::ProcessMouse(int xx, yy)
|
||||
{
|
||||
if (MouseOver(xx, yy))
|
||||
{
|
||||
current_temp = yy - y / line_h + first;
|
||||
if (current_temp != current)
|
||||
{
|
||||
current = current_temp;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int llist::ProcessKey(dword key)
|
||||
{
|
||||
switch(key)
|
||||
|
Loading…
Reference in New Issue
Block a user