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|
|
|
0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9,
|
|
|
|
0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04
|
|
|
|
};
|
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
struct checkbox
|
2018-04-19 16:16:32 +02:00
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
dword text;
|
|
|
|
bool checked;
|
|
|
|
bool disabled;
|
|
|
|
dword x,y, id;
|
|
|
|
bool click();
|
|
|
|
void draw();
|
|
|
|
void redraw();
|
|
|
|
};
|
|
|
|
|
|
|
|
:bool checkbox::click(dword _id)
|
|
|
|
{
|
|
|
|
if (disabled) return 0;
|
|
|
|
if (_id == id) {
|
|
|
|
checked^=1;
|
|
|
|
redraw();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
:void checkbox::draw(dword _x,_y)
|
|
|
|
{
|
|
|
|
#define SIZE 14
|
|
|
|
if (!id) id = GetFreeButtonId();
|
|
|
|
x=_x; y=_y;
|
|
|
|
|
|
|
|
DefineButton(x-1, y-1, strlen(text)*8 + SIZE + 17, SIZE+2, id+BT_HIDE+BT_NOFRAME, 0);
|
2018-09-16 11:42:32 +02:00
|
|
|
WriteTextWithBg(x+SIZE+8, SIZE / 2 + y -7, 0xD0, system.color.work_text, text, system.color.work);
|
2018-04-19 22:12:07 +02:00
|
|
|
DrawRectangle(x, y, SIZE, SIZE, system.color.work_graph);
|
|
|
|
if (checked == 0)
|
2018-04-19 16:16:32 +02:00
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
DrawRectangle3D(x+1, y+1, SIZE-2, SIZE-2, 0xDDDddd, 0xffffff);
|
|
|
|
DrawBar(x+2, y+2, SIZE-3, SIZE-3, 0xffffff);
|
2018-04-19 16:16:32 +02:00
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
else if (checked == 1)
|
2018-04-19 16:16:32 +02:00
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff);
|
2018-04-19 16:16:32 +02:00
|
|
|
_PutImage(x+1, y+1, 13, 13, #checkbox_flag);
|
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
else if (checked == 2) //not active
|
2018-04-19 16:16:32 +02:00
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff);
|
|
|
|
DrawBar(x+3, y+3, SIZE-5, SIZE-5, 0x888888);
|
2018-04-19 16:16:32 +02:00
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
DrawRectangle3D(x-1,y-1,SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
|
|
|
|
}
|
|
|
|
|
|
|
|
:void checkbox::redraw()
|
|
|
|
{
|
|
|
|
draw(x,y);
|
2018-04-19 16:16:32 +02:00
|
|
|
}
|
2018-10-11 16:32:24 +02:00
|
|
|
|
|
|
|
#endif
|