Rev 7285 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7285 | Rev 7291 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | dword CursorFile = FROM "pointer.cur"; |
|
- | 2 | ||
1 | struct _link |
3 | struct _link |
2 | { |
4 | { |
- | 5 | CustomCursor CursorPointer; |
|
3 | int count; |
6 | int count; |
4 | int x[4096], y[4096], w[4096], h[4096]; |
7 | int x[4096], y[4096], w[4096], h[4096]; |
5 | collection text; |
8 | collection text; |
6 | collection url; |
9 | collection url; |
7 | void clear(); |
10 | void clear(); |
8 | void add(); |
11 | void add(); |
9 | int hover(); |
12 | int hover(); |
10 | int active; |
13 | int active; |
- | 14 | void draw_underline(); |
|
11 | } link; |
15 | } link; |
Line 12... | Line 16... | ||
12 | 16 | ||
13 | void _link::clear() |
17 | void _link::clear() |
14 | { |
18 | { |
Line 27... | Line 31... | ||
27 | text.add(_textt); |
31 | text.add(_textt); |
28 | url.add(_urll); |
32 | url.add(_urll); |
29 | count++; |
33 | count++; |
30 | } |
34 | } |
Line -... | Line 35... | ||
- | 35 | ||
- | 36 | void _link::draw_underline(dword i, color) |
|
- | 37 | { |
|
- | 38 | DrawBar(x[i]+list.x, -list.first*list.item_h+y[i]+list.y+h[i]-1, w[i], 1, color); |
|
- | 39 | } |
|
31 | 40 | ||
32 | int _link::hover() |
41 | int _link::hover() |
33 | { |
- | |
34 | //char tempp[4096]; |
- | |
35 | dword color; |
42 | { |
36 | int i; |
43 | int i; |
- | 44 | int new_active = -1; |
|
37 | active = -1; |
45 | int link_start_y = list.first*list.item_h; |
38 | mouse.x = mouse.x - list.x; |
46 | mouse.x = mouse.x - list.x; |
39 | mouse.y = mouse.y - list.y; |
47 | mouse.y = mouse.y - list.y; |
40 | for (i=0; i |
48 | for (i=0; i |
41 | if(link.y[i]>list.first*list.item_h) && (link.y[i] |
49 | if(y[i] > link_start_y) && (y[i] < link_start_y+list.h) { |
42 | // sprintf(#tempp, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]); |
- | |
43 | // sprintf(#tempp); |
50 | // debugln( sprintf(#param, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]) ); |
44 | if (mouse.x>link.x[i]) |
51 | if (mouse.x > x[i]) |
45 | && (-list.first*list.item_h+link.y[i] |
52 | && (mouse.x < x[i]+w[i]) |
46 | && (mouse.x |
53 | && (mouse.y > y[i]-link_start_y) |
47 | && (-list.first*list.item_h+link.y[i]+link.h[i]>mouse.y) { |
- | |
48 | color = 0xFFFfff; |
- | |
49 | CursorPointer.Load(#CursorFile); |
54 | && (mouse.y < h[i]-link_start_y+link.y[i]) { |
50 | CursorPointer.Set(); |
55 | new_active = i; |
51 | active = i; |
56 | break; |
52 | } |
- | |
53 | else { |
- | |
54 | color = 0x0000FF; |
57 | } |
55 | } |
- | |
56 | 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); |
58 | } |
- | 59 | } |
|
- | 60 | ||
- | 61 | if (new_active != active) |
|
- | 62 | { |
|
- | 63 | if (-1 == new_active) { |
|
- | 64 | draw_underline(active, 0x0000FF); |
|
57 | } |
65 | CursorPointer.Restore(); |
- | 66 | } |
|
- | 67 | else { |
|
- | 68 | draw_underline(active, 0x0000FF); |
|
- | 69 | draw_underline(new_active, 0xFFFfff); |
|
58 | } |
70 | CursorPointer.Load(#CursorFile); |
- | 71 | CursorPointer.Set(); |
|
- | 72 | } |
|
- | 73 | active = new_active; |
|
- | 74 | return true; |
|
- | 75 | } |
|
59 | if (active==-1) CursorPointer.Restore(); |
76 | |
60 | return false; |
77 | return false; |
61 | } |
78 | }>>> |