Aelia 0.33: add cursor pointer

git-svn-id: svn://kolibrios.org@6059 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-01-14 23:51:52 +00:00
parent ae17b4e165
commit 228094c871
6 changed files with 35 additions and 13 deletions

View File

@ -10,6 +10,7 @@
#include "../lib/obj/iconv.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/obj/http.h"
#include "../lib/cursor.h"
#include "../lib/patterns/libimg_load_skin.h"
#include "../lib/patterns/simple_open_dialog.h"
#include "../lib/patterns/history.h"
@ -55,6 +56,9 @@ char address[UML]="http://";
int mouse_address_box;
edit_box address_box = {250,56,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,UML,#address,#mouse_address_box,2,19,19};
CustomCursor CursorPointer;
dword CursorFile = FROM "pointer.cur";
#include "ini.h"
#include "gui.h"
#include "label.h"
@ -80,6 +84,7 @@ void main()
{
InitDlls();
OpenDialog_init stdcall (#o_dialog);
CursorPointer.Load(#CursorFile);
label.init(DEFAULT_FONT);
Libimg_LoadImage(#skin, abspath("toolbar.png"));
LoadIniSettings();

View File

@ -23,11 +23,11 @@ void WriteTextIntoBuf(int _x, _y; dword _text_col, _text_off)
{
char error_message[128];
if (_x > list.w) {
sprintf(#error_message, "\nWriteTextIntoBuf _x overflow: H %d X %d \n", label.size.height, _x);
sprintf(#error_message, "'WriteTextIntoBuf _x overflow: H %d X %d' -A", label.size.height, _x);
notify(#error_message);
}
if (_y+label.size.pt > label.size.height) {
sprintf(#error_message, "\nWriteTextIntoBuf _y overflow: H %d Y %d \n", label.size.height, _y);
sprintf(#error_message, "'WriteTextIntoBuf _y overflow: H %d Y %d' -A", label.size.height, _y);
notify(#error_message);
return;
}

View File

@ -34,7 +34,7 @@ int _link::hover()
//char tempp[4096];
dword color;
int i;
active = 0;
active = -1;
mouse.x = mouse.x - list.x;
mouse.y = mouse.y - list.y;
for (i=0; i<link.count; i++) {
@ -44,12 +44,17 @@ int _link::hover()
if (mouse.x>link.x[i])
&& (-list.first*list.item_h+link.y[i]<mouse.y)
&& (mouse.x<link.x[i]+link.w[i])
&& (-list.first*list.item_h+link.y[i]+link.h[i]>mouse.y)
color = 0xFF0000;
else
color = 0xCCCccc;
DrawRectangle(link.x[i]+list.x+1, -list.first*list.item_h+link.y[i]+list.y, link.w[i], link.h[i], color);
&& (-list.first*list.item_h+link.y[i]+link.h[i]>mouse.y) {
color = 0xFFFfff;
CursorPointer.Set();
active = i;
}
else {
color = 0x0000FF;
}
DrawBar(link.x[i]+list.x, -list.first*list.item_h+link.y[i]+list.y+link.h[i]-1, link.w[i], 1, color);
}
}
if (active==-1) CursorPointer.Restore();
return false;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -53,9 +53,9 @@ int stroka_y=5, line_length=0;
}
}
if (draw==false) {
list.count = stroka_y/list.item_h+2;
list.count = stroka_y/list.item_h+3;
if (list.count < list.visible) list.count = list.visible;
label.size.height = list.count+1*list.item_h;
label.size.height = list.count+5*list.item_h;
label.raw_size = 0;
}
if (draw==true) WriteTextIntoBuf(8, stroka_y, 0x000000, line_start);
@ -171,6 +171,7 @@ dword DOM_pos;
strcpy(#title, text.start);
continue;
}
strtrim(text.start);
while (get_label_len(text.start) + stroka_x + 30 > list.w)
{
zeroch = 0;
@ -186,6 +187,7 @@ dword DOM_pos;
label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color);
}
WriteTextIntoBuf(stroka_x, stroka_y, style.color, text.start);
stroka_x+=char_width[' '];
}
ESBYTE[line_break] >< zeroch; //restore line
text.start = line_break;
@ -198,6 +200,7 @@ dword DOM_pos;
label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color);
}
WriteTextIntoBuf(stroka_x, stroka_y, style.color, text.start);
stroka_x+=char_width[' '];
}
stroka_x += get_label_len(text.start);
}
@ -205,11 +208,20 @@ dword DOM_pos;
ESBYTE[DOM_pos] = '\0';
text.start = DOM_pos + 1;
tag.parce();
if (tag.nameis("br")) || (tag.nameis("p")) || (tag.nameis("div")) || (tag.nameis("h1")) || (tag.nameis("h2")) {
if (tag.nameis("br"))
|| (tag.nameis("p"))
|| (tag.nameis("div"))
|| (tag.nameis("tr")) {
stroka_y+= list.item_h;
stroka_x = HTML_PADDING_X;
continue;
}
if (tag.nameis("h1")) || (tag.nameis("/h1"))
|| (tag.nameis("h2")) || (tag.nameis("/h2")) {
stroka_y+= list.item_h;
stroka_x = HTML_PADDING_X;
continue;
}
if (tag.nameis("script")) || (tag.nameis("style")) style.ignore = true;
if (tag.nameis("/script")) || (tag.nameis("/style")) style.ignore = false;
if (tag.nameis("a")) { style.a = true; style.color=0x0000FF; }
@ -217,9 +229,9 @@ dword DOM_pos;
}
}
if (draw==false) {
list.count = stroka_y/list.item_h+2;
list.count = stroka_y/list.item_h+3;
if (list.count < list.visible) list.count = list.visible;
label.size.height = list.count+1*list.item_h;
label.size.height = list.count+5*list.item_h;
label.raw_size = 0;
}
free(DOM.start);