2016-11-02 13:19:15 +01:00
|
|
|
llist select_list;
|
|
|
|
scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
|
|
|
|
|
|
|
?define T_SELECT_LIST_NO_DATA "No data to show"
|
2021-12-23 13:27:15 +01:00
|
|
|
?define SELECT_LIST_ITEMH 20
|
2016-11-02 13:19:15 +01:00
|
|
|
|
2021-06-24 22:42:19 +02:00
|
|
|
void SelectList_Init(dword _x, _y, _w, _h)
|
2016-11-02 13:19:15 +01:00
|
|
|
{
|
|
|
|
select_list.SetFont(8, 14, 0x90);
|
2021-12-23 13:27:15 +01:00
|
|
|
select_list.SetSizes(_x, _y, _w, _h, SELECT_LIST_ITEMH);
|
2016-11-02 13:19:15 +01:00
|
|
|
}
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
void SelectList_Draw()
|
2016-11-02 13:19:15 +01:00
|
|
|
{
|
|
|
|
int i, list_last;
|
|
|
|
|
|
|
|
select_list.CheckDoesValuesOkey();
|
|
|
|
|
|
|
|
if (select_list.count > select_list.visible) list_last = select_list.visible; else list_last = select_list.count;
|
|
|
|
|
|
|
|
for (i=0; i<list_last; i++;)
|
|
|
|
{
|
2016-11-02 15:30:45 +01:00
|
|
|
SelectList_DrawLine(i); //NEED TO BE IMPLEMENTED IN APP
|
2016-11-02 13:19:15 +01:00
|
|
|
}
|
|
|
|
DrawBar(select_list.x,i*select_list.item_h+select_list.y, select_list.w, -i*select_list.item_h+ select_list.h, 0xFFFfff);
|
2021-06-24 22:42:19 +02:00
|
|
|
if (!select_list.count) WriteText(-15*8 + select_list.w / 2 + select_list.x + 1,
|
|
|
|
select_list.h / 2 - 8 + select_list.y, 0x90, 0x999999, T_SELECT_LIST_NO_DATA);
|
2016-11-02 15:30:45 +01:00
|
|
|
SelectList_DrawScroller();
|
|
|
|
}
|
|
|
|
|
2020-05-26 02:17:12 +02:00
|
|
|
signed SelectList_ProcessMouse()
|
2016-11-02 15:30:45 +01:00
|
|
|
{
|
|
|
|
mouse.get();
|
|
|
|
scrollbar_v_mouse (#scroll1);
|
|
|
|
if (select_list.first != scroll1.position)
|
|
|
|
{
|
|
|
|
select_list.first = scroll1.position;
|
|
|
|
SelectList_Draw();
|
2021-06-07 22:03:19 +02:00
|
|
|
return true;
|
2016-11-02 15:30:45 +01:00
|
|
|
}
|
|
|
|
|
2021-06-07 22:03:19 +02:00
|
|
|
if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) {
|
|
|
|
SelectList_Draw();
|
|
|
|
return true;
|
|
|
|
}
|
2016-11-02 15:30:45 +01:00
|
|
|
|
2022-01-06 23:02:02 +01:00
|
|
|
if (mouse.up) && (mouse.click)
|
2020-05-26 02:17:12 +02:00
|
|
|
if (select_list.ProcessMouse(mouse.x, mouse.y)) {
|
|
|
|
SelectList_LineChanged();
|
2021-06-07 22:03:19 +02:00
|
|
|
return true;
|
2020-05-26 02:17:12 +02:00
|
|
|
}
|
2021-06-07 22:03:19 +02:00
|
|
|
return false;
|
2016-11-02 13:19:15 +01:00
|
|
|
}
|
|
|
|
|
2016-11-03 13:41:15 +01:00
|
|
|
void SelectList_DrawBorder() {
|
2016-11-07 21:57:40 +01:00
|
|
|
DrawRectangle3D(select_list.x-2, select_list.y-2,
|
|
|
|
select_list.w+3+scroll1.size_x, select_list.h+3,
|
2022-01-09 07:36:16 +01:00
|
|
|
sc.dark, sc.light);
|
|
|
|
DrawRectangle(select_list.x-1, select_list.y-1, select_list.w+1+scroll1.size_x, select_list.h+1, sc.line);
|
2016-11-03 13:41:15 +01:00
|
|
|
}
|
2016-11-02 13:19:15 +01:00
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
void SelectList_DrawScroller()
|
2016-11-02 13:19:15 +01:00
|
|
|
{
|
2020-04-18 01:52:24 +02:00
|
|
|
scroll1.bckg_col = MixColors(sc.work, 0xBBBbbb, 80);
|
|
|
|
scroll1.frnt_col = MixColors(sc.work,0xFFFfff,120);
|
2022-01-09 07:36:16 +01:00
|
|
|
scroll1.line_col = sc.line;
|
2016-11-02 13:19:15 +01:00
|
|
|
|
|
|
|
scroll1.max_area = select_list.count;
|
|
|
|
scroll1.cur_area = select_list.visible;
|
|
|
|
scroll1.position = select_list.first;
|
|
|
|
|
|
|
|
scroll1.all_redraw=1;
|
|
|
|
scroll1.start_x = select_list.x + select_list.w;
|
|
|
|
scroll1.start_y = select_list.y-1;
|
|
|
|
scroll1.size_y = select_list.h+2;
|
|
|
|
|
|
|
|
scrollbar_v_draw(#scroll1);
|
2016-11-02 15:30:45 +01:00
|
|
|
}
|