forked from KolibriOS/kolibrios
select_list.h: update API, add SelectList_ProcessMouse()
drvinst: use select_list git-svn-id: svn://kolibrios.org@6653 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
55fd6e5922
commit
7ce6f6bd28
@ -66,33 +66,15 @@ void main()
|
||||
{
|
||||
case evMouse:
|
||||
if (!CheckActiveProcess(Form.ID)) break;
|
||||
mouse.get();
|
||||
scrollbar_v_mouse (#scroll1);
|
||||
if (select_list.first != scroll1.position)
|
||||
{
|
||||
select_list.first = scroll1.position;
|
||||
DrawSelectList(select_list.count);
|
||||
break;
|
||||
}
|
||||
|
||||
if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(select_list.count);
|
||||
|
||||
if (mouse.up)&&(mouse_clicked)
|
||||
{
|
||||
if (mouse.lkm) && (select_list.ProcessMouse(mouse.x, mouse.y)) EventApply();
|
||||
mouse_clicked=false;
|
||||
}
|
||||
else if (mouse.down)&&(mouse.lkm) && (select_list.MouseOver(mouse.x, mouse.y)) mouse_clicked=true;
|
||||
SelectList_ProcessMouse();
|
||||
|
||||
if (mouse.down)&&(mouse.pkm) {
|
||||
select_list.ProcessMouse(mouse.x, mouse.y);
|
||||
DrawSelectList(select_list.count);
|
||||
SelectList_Draw();
|
||||
menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 136, "Open file Enter\nDelete Del", 10);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==1) ExitProcess();
|
||||
@ -137,7 +119,13 @@ void DrawWindowContent()
|
||||
{
|
||||
int id;
|
||||
id = select_list.cur_y;
|
||||
InitSelectList(LIST_PADDING, PANEL_H, Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING, Form.cheight-PANEL_H-LIST_PADDING, false);
|
||||
SelectList_Init(
|
||||
LIST_PADDING,
|
||||
PANEL_H,
|
||||
Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING,
|
||||
Form.cheight-PANEL_H-LIST_PADDING,
|
||||
false
|
||||
);
|
||||
select_list.cur_y = id;
|
||||
|
||||
DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work);
|
||||
@ -147,7 +135,7 @@ void DrawWindowContent()
|
||||
if (dir_exists(WALP_STANDART_PATH)) tabs.draw(strlen(T_SKINS)*8+TAB_PADDING+select_list.x+21, select_list.y, WALLPAPERS, T_WALLPAPERS);
|
||||
DrawRectangle(select_list.x-1, select_list.y-1, select_list.w+1+scroll1.size_x, select_list.h+1, system.color.work_graph);
|
||||
|
||||
DrawSelectList(select_list.count);
|
||||
SelectList_Draw();
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +159,7 @@ void Open_Dir()
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSelectList_Line(dword i)
|
||||
void SelectList_DrawLine(dword i)
|
||||
{
|
||||
int yyy, list_last;
|
||||
|
||||
@ -192,6 +180,11 @@ void DrawSelectList_Line(dword i)
|
||||
}
|
||||
}
|
||||
|
||||
void SelectList_LineChanged()
|
||||
{
|
||||
EventApply();
|
||||
}
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// EVENTS //
|
||||
@ -243,7 +236,7 @@ void EventApply()
|
||||
cur = select_list.cur_y;
|
||||
sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
||||
RunProgram("/sys/media/kiv", #cur_file_path);
|
||||
DrawSelectList(select_list.count);
|
||||
SelectList_Draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
?include "lang.h--"
|
||||
#endif
|
||||
|
||||
#define MEMSIZE 0xDFE800
|
||||
#define MEMSIZE 4096*20
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\strings.h"
|
||||
#include "..\lib\list_box.h"
|
||||
@ -62,17 +62,8 @@ void main()
|
||||
{
|
||||
case evMouse:
|
||||
if (!CheckActiveProcess(Form.ID)) break;
|
||||
mouse.get();
|
||||
scrollbar_v_mouse (#scroll1);
|
||||
if (select_list.first != scroll1.position)
|
||||
{
|
||||
select_list.first = scroll1.position;
|
||||
DrawSelectList(clipboard.GetSlotCount());
|
||||
SelectList_ProcessMouse();
|
||||
break;
|
||||
}
|
||||
if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(clipboard.GetSlotCount());
|
||||
break;
|
||||
|
||||
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
@ -86,7 +77,7 @@ void main()
|
||||
|
||||
case evKey:
|
||||
GetKeys();
|
||||
if (select_list.ProcessKey(key_scancode)) DrawSelectList(clipboard.GetSlotCount());
|
||||
if (select_list.ProcessKey(key_scancode)) ClipViewSelectListDraw();
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
@ -96,7 +87,7 @@ void main()
|
||||
IF (Form.status_window>=2) break;
|
||||
if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
|
||||
if (Form.width < 570) { MoveSize(OLD,OLD,570,OLD); break; }
|
||||
InitSelectList(
|
||||
SelectList_Init(
|
||||
LIST_PADDING,
|
||||
LIST_PADDING+PANEL_TOP_H,
|
||||
Form.cwidth-LIST_PADDING-LIST_PADDING-scroll1.size_x,
|
||||
@ -104,11 +95,11 @@ void main()
|
||||
true
|
||||
);
|
||||
DrawWindowContent();
|
||||
DrawSelectList(clipboard.GetSlotCount());
|
||||
ClipViewSelectListDraw();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (clipboard.GetSlotCount() > select_list.count) DrawSelectList(clipboard.GetSlotCount());
|
||||
if (clipboard.GetSlotCount() > select_list.count) ClipViewSelectListDraw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -129,7 +120,7 @@ void DrawWindowContent()
|
||||
WriteText(select_list.x+select_list.w-68, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW);
|
||||
}
|
||||
|
||||
void DrawSelectList_Line(dword i)
|
||||
void SelectList_DrawLine(dword i)
|
||||
{
|
||||
int yyy, length, slot_data_type_number;
|
||||
dword line_text[2048];
|
||||
@ -178,6 +169,15 @@ int SaveSlotContents(int slot_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void ClipViewSelectListDraw() {
|
||||
select_list.count = clipboard.GetSlotCount();
|
||||
SelectList_Draw();
|
||||
}
|
||||
|
||||
void SelectList_LineChanged() {
|
||||
return;
|
||||
}
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// EVENTS //
|
||||
@ -186,19 +186,22 @@ int SaveSlotContents(int slot_id) {
|
||||
|
||||
void EventDeleteLastSlot()
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 100);
|
||||
for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 300);
|
||||
clipboard.DelLastSlot();
|
||||
DrawSelectList(clipboard.GetSlotCount());
|
||||
ClipViewSelectListDraw();
|
||||
}
|
||||
|
||||
void EventDeleteAllSlots()
|
||||
{
|
||||
while (clipboard.GetSlotCount()) clipboard.DelLastSlot();
|
||||
DrawSelectList(clipboard.GetSlotCount());
|
||||
ClipViewSelectListDraw();
|
||||
}
|
||||
|
||||
void EventResetBufferLock() {
|
||||
clipboard.ResetBlockingBuffer();
|
||||
DrawSelectList(clipboard.GetSlotCount());
|
||||
ClipViewSelectListDraw();
|
||||
}
|
||||
|
||||
void EventOpenAsText(int slot_id) {
|
||||
|
@ -1,5 +1,24 @@
|
||||
#define MEMSIZE 4096*10
|
||||
#define MEMSIZE 4096*20
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// LIB //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
#include "../lib/gui.h"
|
||||
#include "../lib/list_box.h"
|
||||
#include "../lib/obj/box_lib.h"
|
||||
#include "../lib/obj/libio_lib.h"
|
||||
#include "../lib/obj/libini.h"
|
||||
#include "../lib/patterns/select_list.h"
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// DATA //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
proc_info Form;
|
||||
|
||||
#define WINDOW_TITLE "Driver Installer"
|
||||
@ -18,32 +37,59 @@ proc_info Form;
|
||||
#define WINDOW_STEP_DRIVER_LIST 2;
|
||||
char window_step = WINDOW_STEP_INTRO;
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// CODE //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
void GetIniData()
|
||||
{
|
||||
ini_enum_sections stdcall ("/sys/drvinf.ini", #process_sections);
|
||||
}
|
||||
|
||||
byte process_sections(dword sec_name, f_name)
|
||||
{
|
||||
ini_enum_keys stdcall (f_name, sec_name, #process_keys);
|
||||
return true;
|
||||
}
|
||||
|
||||
byte process_keys(dword key_value, key_name, sec_name, f_name)
|
||||
{
|
||||
debugln(key_value);
|
||||
return true;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
word id;
|
||||
int id;
|
||||
load_dll(libio, #libio_init,1);
|
||||
load_dll(libini, #lib_init,1);
|
||||
load_dll(boxlib, #box_lib_init,0);
|
||||
//GetIniData();
|
||||
SetEventMask(0x27);
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
if (!CheckActiveProcess(Form.ID)) return;
|
||||
SelectList_ProcessMouse();
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==1) ExitProcess();
|
||||
if (id==BUTTON_ID_ASSEPT_RISK) {
|
||||
window_step = WINDOW_STEP_DRIVER_LIST;
|
||||
goto _EV_WINDOW_REDRAW;
|
||||
}
|
||||
if (id==BUTTON_ID_ASSEPT_RISK) Event_AsseptRisk();
|
||||
if (id==BUTTON_ID_README) Event_ShowReadme();
|
||||
if (id==BUTTON_ID_INSTALL) Event_RunInstall();
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
GetKeys();
|
||||
if (select_list.ProcessKey(key_scancode)) SelectList_LineChanged();
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
_EV_WINDOW_REDRAW:
|
||||
system.color.get();
|
||||
DefineAndDrawWindow(215, 100, 550, 350, 0x33, system.color.work, WINDOW_TITLE);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (window_step == WINDOW_STEP_INTRO) draw_intro_window();
|
||||
if (window_step == WINDOW_STEP_DRIVER_LIST) draw_driver_list_window();
|
||||
break;
|
||||
Event_DrawWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,15 +110,74 @@ void draw_driver_list_window()
|
||||
{
|
||||
int PADDING = 12;
|
||||
int right_frame_x = Form.cwidth/2 + PADDING + calc(PADDING/2);
|
||||
incn y;
|
||||
y.n = PADDING + 3;
|
||||
//LEFT FRAME
|
||||
DrawBar(PADDING, PADDING, Form.cwidth/2 - PADDING, Form.cheight - PADDING - PADDING, 0xEEEeee);
|
||||
select_list.count = 4;
|
||||
SelectList_Init(PADDING,
|
||||
PADDING,
|
||||
Form.cwidth/2 - PADDING - scroll1.size_x,
|
||||
Form.cheight - PADDING - PADDING,
|
||||
false);
|
||||
SelectList_Draw();
|
||||
//RIGHT FRAME
|
||||
WriteTextB(right_frame_x, y.n, 0x81, system.color.work_text, "ATI KMS");
|
||||
WriteText(right_frame_x, y.inc(20), 0x80, MixColors(system.color.work, 0xCCCccc,80), "ver 4.4");
|
||||
DrawTextViewArea(right_frame_x-2, y.inc(30), Form.cwidth - right_frame_x - PADDING, Form.cheight-100,
|
||||
WriteTextB(right_frame_x, PADDING+3, 0x81, system.color.work_text, "ATI KMS");
|
||||
WriteText(right_frame_x, PADDING+23, 0x80, MixColors(system.color.work, system.color.work_text,120), "ver 4.4");
|
||||
DrawTextViewArea(right_frame_x-2, PADDING+53, Form.cwidth - right_frame_x - PADDING, Form.cheight-100,
|
||||
T_CAUTION_PARAGRAPH, -1, system.color.work_text);
|
||||
right_frame_x += DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_README, T_README);
|
||||
DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_INSTALL, T_INSTALL);
|
||||
}
|
||||
|
||||
void SelectList_DrawLine(dword i)
|
||||
{
|
||||
int yyy, list_last;
|
||||
|
||||
yyy = i*select_list.item_h+select_list.y;
|
||||
|
||||
if (select_list.cur_y-select_list.first==i)
|
||||
{
|
||||
DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button);
|
||||
WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, "Hello");
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff);
|
||||
WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, "Hello");
|
||||
}
|
||||
}
|
||||
|
||||
void SelectList_LineChanged()
|
||||
{
|
||||
SelectList_Draw();
|
||||
}
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// EVENTS //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
void Event_DrawWindow()
|
||||
{
|
||||
system.color.get();
|
||||
DefineAndDrawWindow(215, 100, 600, 400, 0x33, system.color.work, WINDOW_TITLE);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (window_step == WINDOW_STEP_INTRO) draw_intro_window();
|
||||
if (window_step == WINDOW_STEP_DRIVER_LIST) draw_driver_list_window();
|
||||
return;
|
||||
}
|
||||
|
||||
void Event_AsseptRisk()
|
||||
{
|
||||
window_step = WINDOW_STEP_DRIVER_LIST;
|
||||
Event_DrawWindow();
|
||||
}
|
||||
|
||||
void Event_ShowReadme()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void Event_RunInstall()
|
||||
{
|
||||
return;
|
||||
}
|
@ -4,38 +4,55 @@ dword select_list_count_offset;
|
||||
|
||||
?define T_SELECT_LIST_NO_DATA "No data to show"
|
||||
|
||||
void InitSelectList(dword _x, _y, _w, _h, _no_selection)
|
||||
void SelectList_Init(dword _x, _y, _w, _h, _no_selection)
|
||||
{
|
||||
select_list.no_selection = _no_selection;
|
||||
select_list.SetFont(8, 14, 0x90);
|
||||
select_list.SetSizes(_x, _y, _w, _h, 20);
|
||||
}
|
||||
|
||||
void DrawSelectList(dword _items_count)
|
||||
void SelectList_Draw()
|
||||
{
|
||||
int i, list_last;
|
||||
|
||||
select_list.count = _items_count;
|
||||
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<select_list.visible; i++;) DeleteButton(select_list.first + i + 100);
|
||||
for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 300);
|
||||
|
||||
for (i=0; i<list_last; i++;)
|
||||
{
|
||||
DrawBar(select_list.x,i*select_list.item_h+select_list.y,select_list.w, select_list.item_h, 0xFFFfff);
|
||||
DrawSelectList_Line(i); //NEED TO BE IMPLEMENTED IN APP
|
||||
SelectList_DrawLine(i); //NEED TO BE IMPLEMENTED IN APP
|
||||
}
|
||||
DrawBar(select_list.x,i*select_list.item_h+select_list.y, select_list.w, -i*select_list.item_h+ select_list.h, 0xFFFfff);
|
||||
if (!select_list.count) WriteText(-strlen(T_SELECT_LIST_NO_DATA)*select_list.font_w + select_list.w / 2 + select_list.x + 1,
|
||||
select_list.h / 2 - 8 + select_list.y, select_list.font_type, 0x999999, T_SELECT_LIST_NO_DATA);
|
||||
DrawSelectListScroller();
|
||||
SelectList_DrawScroller();
|
||||
}
|
||||
|
||||
void SelectList_ProcessMouse()
|
||||
{
|
||||
int mouse_clicked;
|
||||
mouse.get();
|
||||
scrollbar_v_mouse (#scroll1);
|
||||
if (select_list.first != scroll1.position)
|
||||
{
|
||||
select_list.first = scroll1.position;
|
||||
SelectList_Draw();
|
||||
}
|
||||
|
||||
if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) SelectList_Draw();
|
||||
|
||||
if (mouse.up)&&(mouse_clicked)
|
||||
{
|
||||
if (mouse.lkm) && (select_list.ProcessMouse(mouse.x, mouse.y)) SelectList_LineChanged();
|
||||
mouse_clicked=false;
|
||||
}
|
||||
else if (mouse.down)&&(mouse.lkm) && (select_list.MouseOver(mouse.x, mouse.y)) mouse_clicked=true;
|
||||
}
|
||||
|
||||
|
||||
void DrawSelectListScroller()
|
||||
void SelectList_DrawScroller()
|
||||
{
|
||||
scroll1.bckg_col = MixColors(system.color.work, 0xBBBbbb, 80);
|
||||
scroll1.frnt_col = MixColors(system.color.work,0xFFFfff,120);
|
||||
|
Loading…
Reference in New Issue
Block a user