2012-12-15 01:16:06 +01:00
|
|
|
//BOX_LIB - Asper
|
2015-07-22 20:32:54 +02:00
|
|
|
#ifndef INCLUDE_BOX_LIB_H
|
|
|
|
#define INCLUDE_BOX_LIB_H
|
|
|
|
|
|
|
|
#ifndef INCLUDE_KOLIBRI_H
|
|
|
|
#include "../lib/kolibri.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef INCLUDE_DLL_H
|
|
|
|
#include "../lib/dll.h"
|
|
|
|
#endif
|
|
|
|
|
2012-12-15 01:16:06 +01:00
|
|
|
dword boxlib = #aEdit_box_lib;
|
2015-03-07 12:18:27 +01:00
|
|
|
char aEdit_box_lib[]="/sys/lib/box_lib.obj";
|
2012-12-15 01:16:06 +01:00
|
|
|
|
|
|
|
dword box_lib_init = #aboxlib_init;
|
|
|
|
|
2017-10-11 00:26:56 +02:00
|
|
|
dword edit_box_draw = #aEdit_box_draw;
|
|
|
|
dword edit_box_key = #aEdit_box_key;
|
|
|
|
dword edit_box_mouse = #aEdit_box_mouse;
|
|
|
|
dword edit_box_set_text = #aEdit_box_set_text;
|
2012-12-15 01:16:06 +01:00
|
|
|
|
|
|
|
dword scrollbar_v_draw = #aScrollbar_v_draw;
|
|
|
|
dword scrollbar_v_mouse = #aScrollbar_v_mouse;
|
|
|
|
dword scrollbar_h_draw = #aScrollbar_h_draw;
|
|
|
|
dword scrollbar_h_mouse = #aScrollbar_h_mouse;
|
|
|
|
|
2017-10-11 00:26:56 +02:00
|
|
|
dword PathShow_prepare = #aPathShow_prepare;
|
|
|
|
dword PathShow_draw = #aPathShow_draw;
|
2014-03-21 22:21:11 +01:00
|
|
|
|
|
|
|
dword progressbar_draw = #aProgressbar_draw;
|
|
|
|
dword progressbar_progress = #aProgressbar_progress;
|
|
|
|
|
2015-02-21 22:32:15 +01:00
|
|
|
dword frame_draw = #aFrame_draw;
|
|
|
|
|
2013-07-26 16:41:31 +02:00
|
|
|
$DD 2 dup 0
|
2012-12-15 01:16:06 +01:00
|
|
|
|
2015-03-16 15:23:55 +01:00
|
|
|
char aEdit_box_draw [] = "edit_box";
|
2015-02-21 22:32:15 +01:00
|
|
|
char aEdit_box_key [] = "edit_box_key";
|
|
|
|
char aEdit_box_mouse[] = "edit_box_mouse";
|
2017-10-11 00:26:56 +02:00
|
|
|
char aEdit_box_set_text[] = "edit_box_set_text";
|
2015-02-21 22:32:15 +01:00
|
|
|
|
2020-11-30 01:55:04 +01:00
|
|
|
char aboxlib_init[] = "lib_init";
|
2015-02-21 22:32:15 +01:00
|
|
|
char aScrollbar_v_draw [] = "scrollbar_v_draw";
|
|
|
|
char aScrollbar_v_mouse[] = "scrollbar_v_mouse";
|
|
|
|
char aScrollbar_h_draw [] = "scrollbar_h_draw";
|
|
|
|
char aScrollbar_h_mouse[] = "scrollbar_h_mouse";
|
2012-12-15 01:16:06 +01:00
|
|
|
|
2015-02-21 22:32:15 +01:00
|
|
|
char aPathShow_prepare [] = "PathShow_prepare";
|
|
|
|
char aPathShow_draw [] = "PathShow_draw";
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2020-11-30 01:55:04 +01:00
|
|
|
char aProgressbar_draw [] = "progressbar_draw";
|
2015-02-21 22:32:15 +01:00
|
|
|
char aProgressbar_progress[] = "progressbar_progress";
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2015-02-21 22:32:15 +01:00
|
|
|
char aFrame_draw[] = "frame_draw";
|
2014-03-21 22:21:11 +01:00
|
|
|
|
2012-12-15 01:16:06 +01:00
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
struct PathShow_data
|
|
|
|
{
|
2015-02-21 22:32:15 +01:00
|
|
|
dword type;
|
2021-06-20 13:05:22 +02:00
|
|
|
word start_y;
|
|
|
|
word start_x;
|
|
|
|
word font_w; // 6 - for font 0, 8 - for font 1
|
|
|
|
word area_size_x;
|
|
|
|
dword font_number; // 0 - monospace, 1 - variable
|
|
|
|
dword background_flag;
|
|
|
|
dword font_color;
|
|
|
|
dword background_color;
|
|
|
|
dword text_pointer;
|
|
|
|
dword work_area_pointer;
|
|
|
|
dword temp_text_length;
|
2013-03-11 19:16:24 +01:00
|
|
|
};
|
|
|
|
/*
|
|
|
|
char temp[128];
|
|
|
|
PathShow_data PathShow = {0, 100,20, 6, 200, 0, 1, 0x0, 0xFFFfff, #email_text, #temp, 0};
|
|
|
|
PathShow_prepare stdcall(#PathShow);
|
|
|
|
PathShow_draw stdcall(#PathShow);
|
|
|
|
*/
|
2012-12-15 01:16:06 +01:00
|
|
|
|
2018-10-01 18:41:14 +02:00
|
|
|
//editbox flags
|
|
|
|
#define ed_pass 1b
|
|
|
|
#define ed_focus 10b //focused
|
|
|
|
#define ed_shift 100b //flag is set when Shift is pressed
|
|
|
|
#define ed_shift_on 1000b
|
2018-10-29 12:39:31 +01:00
|
|
|
#define ed_shift_bac 10000b //bit for Shift reset, if set the smth is selected
|
2018-10-01 18:41:14 +02:00
|
|
|
#define ed_left_fl 100000b
|
|
|
|
#define ed_offset_fl 1000000b
|
|
|
|
#define ed_insert 10000000b
|
|
|
|
#define ed_mouse_on 100000000b
|
2018-10-29 12:39:31 +01:00
|
|
|
#define ed_mouse_adn_b 100011000b
|
|
|
|
#define ed_disabled 100000000000b
|
2018-10-01 18:41:14 +02:00
|
|
|
#define ed_always_focus 100000000000000b
|
2018-10-10 16:44:01 +02:00
|
|
|
#define ed_figure_only 1000000000000000b //numbers only
|
2018-10-01 18:41:14 +02:00
|
|
|
#define ed_shift_cl 1111111111100011b
|
|
|
|
#define ed_shift_mcl 1111111111111011b
|
|
|
|
#define ed_shift_off 1111111111111011b
|
|
|
|
#define ed_shift_on_off 1111111111110111b
|
|
|
|
#define ed_shift_bac_cl 1111111111101111b
|
|
|
|
#define ed_right_fl 1111111111011111b
|
|
|
|
#define ed_offset_cl 1111111110111111b
|
|
|
|
#define ed_insert_cl 1111111101111111b
|
|
|
|
#define ed_mouse_on_off 1111111011111111b
|
|
|
|
|
2012-12-15 01:16:06 +01:00
|
|
|
struct edit_box{
|
2021-12-05 00:24:31 +01:00
|
|
|
dword width,
|
2015-08-05 17:30:25 +02:00
|
|
|
left,
|
2021-12-05 00:24:31 +01:00
|
|
|
top,
|
|
|
|
color,
|
|
|
|
shift_color,
|
|
|
|
focus_border_color,
|
2015-08-05 17:30:25 +02:00
|
|
|
blur_border_color,
|
|
|
|
text_color,
|
|
|
|
max,
|
|
|
|
text,
|
|
|
|
mouse_variable,
|
|
|
|
flags,
|
|
|
|
size,
|
|
|
|
pos,
|
|
|
|
offset,
|
|
|
|
cl_curs_x,
|
|
|
|
cl_curs_y,
|
|
|
|
shift,
|
2016-11-05 11:13:29 +01:00
|
|
|
shift_old,
|
2018-10-29 12:39:31 +01:00
|
|
|
height,
|
|
|
|
char_width;
|
2012-12-15 01:16:06 +01:00
|
|
|
};
|
|
|
|
|
2018-10-29 12:39:31 +01:00
|
|
|
:void EditBox_UpdateText(dword ed, _flags)
|
|
|
|
{
|
|
|
|
dword ed_text;
|
|
|
|
ESI = ed;
|
2020-05-09 22:59:51 +02:00
|
|
|
//ESI.edit_box.offset = ESI.edit_box.shift = ESI.edit_box.shift_old = 0; //no need because of 7904
|
2018-10-29 12:39:31 +01:00
|
|
|
ESI.edit_box.flags = _flags;
|
|
|
|
ed_text = ESI.edit_box.text;
|
2020-05-09 22:59:51 +02:00
|
|
|
//ESI.edit_box.pos = //no need because of 7904
|
|
|
|
ESI.edit_box.size = strlen(ed_text);
|
2018-10-29 12:39:31 +01:00
|
|
|
}
|
|
|
|
|
2021-12-03 01:15:04 +01:00
|
|
|
:dword EditBox_CreateStandart(dword width, left, top, maxlen, text, flags)
|
|
|
|
{
|
|
|
|
dword eb, i;
|
|
|
|
eb = malloc(sizeof(edit_box));
|
|
|
|
for (i = 0; i < sizeof(edit_box); i++) ESBYTE[eb + i] = 0;
|
|
|
|
ESDWORD[eb] = width;
|
|
|
|
ESDWORD[eb + 4] = left;
|
|
|
|
ESDWORD[eb + 8] = top;
|
|
|
|
ESDWORD[eb + 12] = 0xffffff;
|
|
|
|
ESDWORD[eb + 16] = 0x94AECE;
|
|
|
|
ESDWORD[eb + 20] = 0xffffff;
|
|
|
|
ESDWORD[eb + 24] = 0xffffff;
|
|
|
|
ESDWORD[eb + 28] = 0x10000000;
|
|
|
|
ESDWORD[eb + 32] = maxlen;
|
|
|
|
ESDWORD[eb + 36] = text;
|
|
|
|
ESDWORD[eb + 40] = 0;
|
|
|
|
ESDWORD[eb + 44] = flags;
|
|
|
|
ESDWORD[eb + 48] = 0;
|
|
|
|
ESDWORD[eb + 52] = 0;
|
|
|
|
return eb;
|
|
|
|
}
|
|
|
|
|
2012-12-15 01:16:06 +01:00
|
|
|
struct scroll_bar
|
|
|
|
{
|
2021-12-05 00:24:31 +01:00
|
|
|
word size_x, start_x, size_y, start_y;
|
|
|
|
dword btn_height, type, max_area, cur_area, position,
|
|
|
|
bckg_col, frnt_col, line_col, redraw;
|
|
|
|
word delta, delta2, r_size_x, r_start_x, r_size_y, r_start_y;
|
|
|
|
dword m_pos, m_pos_2, m_keys, run_size, position2, work_size, all_redraw, ar_offset;
|
2015-02-21 22:32:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct progress_bar
|
|
|
|
{
|
|
|
|
dword
|
|
|
|
value,
|
|
|
|
left,
|
|
|
|
top,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
style,
|
|
|
|
min,
|
|
|
|
max,
|
|
|
|
back_color,
|
|
|
|
progress_color,
|
|
|
|
frame_color;
|
2014-03-21 22:21:11 +01:00
|
|
|
};
|
|
|
|
|
2015-02-21 22:32:15 +01:00
|
|
|
struct frame
|
2014-03-21 22:21:11 +01:00
|
|
|
{
|
2015-02-21 22:32:15 +01:00
|
|
|
dword type;
|
2021-12-05 00:24:31 +01:00
|
|
|
word size_x; //start_x, size_x => Mario, WTF? Is this so complex to use x/y/w/h ?
|
|
|
|
word start_x;
|
|
|
|
word size_y;
|
|
|
|
word start_y;
|
|
|
|
dword ext_col;
|
|
|
|
dword int_col;
|
2018-04-22 15:33:01 +02:00
|
|
|
dword flags; // see FR_FLAGS
|
2021-12-05 00:24:31 +01:00
|
|
|
dword text_pointer;
|
2015-02-21 22:32:15 +01:00
|
|
|
dword text_position; // 0-up,1-bottom
|
|
|
|
dword font_number; // 0-monospace,1-variable
|
2021-12-05 00:24:31 +01:00
|
|
|
dword font_size_y;
|
|
|
|
dword font_color;
|
2015-02-21 22:32:15 +01:00
|
|
|
dword font_backgr_color;
|
2018-04-16 00:44:36 +02:00
|
|
|
};
|
|
|
|
|
2018-04-22 15:33:01 +02:00
|
|
|
// FR_FLAGS = [x][yyy][z]
|
|
|
|
// z - Caption
|
|
|
|
// yyy - BorderStyle
|
|
|
|
// x - BackStyle
|
|
|
|
#define FR_CAPTION 00001b // [z]
|
|
|
|
#define FR_DOUBLE 00000b // [yyy]
|
|
|
|
#define FR_RAISED 00010b // [yyy]
|
|
|
|
#define FR_SUNKEN 00100b // [yyy]
|
|
|
|
#define FR_ETCHED 00110b // [yyy]
|
|
|
|
#define FR_RIDGED 01000b // [yyy]
|
|
|
|
#define FR_FILLED 10000b // [x]
|
|
|
|
|
2018-04-16 00:44:36 +02:00
|
|
|
:frame frame123 = { 0, 260, 10, 60, 16, NULL, 0xFFFfff, 1, NULL, 0, 1, 12, 0x000111, 0xCCCccc };
|
|
|
|
:void DrawFrame(dword x,y,w,h,text)
|
|
|
|
{
|
2020-04-18 01:52:24 +02:00
|
|
|
frame123.font_color = sc.work_text;
|
|
|
|
frame123.ext_col = sc.work_graph;
|
|
|
|
frame123.int_col = sc.work_light;
|
|
|
|
frame123.font_backgr_color = sc.work;
|
2018-04-16 00:44:36 +02:00
|
|
|
|
|
|
|
frame123.start_x = x;
|
|
|
|
frame123.start_y = y;
|
|
|
|
frame123.size_x = w;
|
|
|
|
frame123.size_y = h;
|
|
|
|
frame123.text_pointer = text;
|
2018-04-22 15:33:01 +02:00
|
|
|
if (!text) frame123.flags=0; else frame123.flags=FR_CAPTION;
|
2018-04-16 00:44:36 +02:00
|
|
|
frame_draw stdcall (#frame123);
|
|
|
|
}
|
|
|
|
|
2015-07-22 20:32:54 +02:00
|
|
|
|
|
|
|
#endif
|