Rev 6731 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4497 | leency | 1 | CustomCursor CursorPointer; |
2 | dword CursorFile = FROM "../TWB/pointer.cur"; |
||
6738 | leency | 3 | #include "..\lib\collection.h" |
4497 | leency | 4 | |
4550 | leency | 5 | #define NOLINE 0 |
6 | #define UNDERLINE 1 |
||
7 | |||
6738 | leency | 8 | #define MAXLINKS 400 |
9 | |||
4491 | leency | 10 | struct array_link { |
11 | dword link, text; |
||
12 | int x,y,w,h; |
||
4550 | leency | 13 | int underline; |
4491 | leency | 14 | }; |
4488 | leency | 15 | |
5772 | leency | 16 | struct LinksArray { |
6738 | leency | 17 | array_link links[MAXLINKS]; |
18 | collection page_links; |
||
4491 | leency | 19 | dword buflen; |
20 | int count, active; |
||
21 | void Hover(); |
||
22 | void AddLink(); |
||
23 | void AddText(); |
||
4488 | leency | 24 | dword GetURL(); |
25 | void Clear(); |
||
5718 | leency | 26 | } PageLinks; |
4488 | leency | 27 | |
5772 | leency | 28 | void LinksArray::AddLink(dword lpath, int link_x, link_y) |
4488 | leency | 29 | { |
6738 | leency | 30 | if (count>= MAXLINKS) return; |
4491 | leency | 31 | links[count].x = link_x; |
32 | links[count].y = link_y; |
||
33 | |||
6738 | leency | 34 | page_links.add(lpath); |
35 | links[count].link = page_links.get(page_links.count-1); |
||
4491 | leency | 36 | count++; |
4488 | leency | 37 | } |
38 | |||
4550 | leency | 39 | void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline) |
4491 | leency | 40 | { |
6738 | leency | 41 | if (count>= MAXLINKS) || (!count) return; |
4491 | leency | 42 | links[count-1].w = link_w; |
43 | links[count-1].h = link_h; |
||
4550 | leency | 44 | links[count-1].underline = link_underline; |
4491 | leency | 45 | |
6738 | leency | 46 | page_links.add(new_text); |
47 | links[count-1].text = page_links.get(page_links.count-1); |
||
4491 | leency | 48 | } |
49 | |||
4488 | leency | 50 | dword LinksArray::GetURL(int id) |
51 | { |
||
4491 | leency | 52 | return links[id].link; |
53 | } |
||
54 | |||
55 | void LinksArray::Clear() |
||
56 | { |
||
6738 | leency | 57 | page_links.drop(); |
58 | page_links.realloc_size = 4096 * 32; |
||
4491 | leency | 59 | count = 0; |
60 | active = -1; |
||
4497 | leency | 61 | CursorPointer.Restore(); |
4491 | leency | 62 | } |
63 | |||
4686 | leency | 64 | char temp[sizeof(URL)]; |
4677 | leency | 65 | PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0}; |
4497 | leency | 66 | |
4492 | leency | 67 | void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col) |
4491 | leency | 68 | { |
69 | int i; |
||
5825 | leency | 70 | signed int WBY = -WB1.list.first*WB1.list.item_h - WB1.DrawBuf.zoom; |
4491 | leency | 71 | for (i=0; i |
72 | { |
||
73 | if (mx>links[i].x) && (my>links[i].y) && (mx |
||
4488 | leency | 74 | { |
6731 | leency | 75 | if (mouse.down) DrawRectangle(links[active].x, -WB1.list.first*WB1.list.item_h + links[active].y, links[active].w, links[active].h, 0); |
5773 | leency | 76 | if (mouse.up) ClickLink(); |
4497 | leency | 77 | if (active==i) return; |
78 | CursorPointer.Set(); |
||
5773 | leency | 79 | if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); |
80 | if (links[i].underline) DrawBar(links[i].x, WBY + links[i].y + links[i].h,links[i].w, WB1.DrawBuf.zoom, bg_col); |
||
4491 | leency | 81 | active = i; |
5519 | leency | 82 | status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10; |
83 | status_text.start_y = Form.cheight - STATUSBAR_H + 3; |
||
4718 | leency | 84 | status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
85 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
||
4677 | leency | 86 | status_text.text_pointer = links[active].link; |
87 | PathShow_prepare stdcall(#status_text); |
||
88 | PathShow_draw stdcall(#status_text); |
||
4491 | leency | 89 | return; |
4488 | leency | 90 | } |
91 | } |
||
4497 | leency | 92 | if (active!=-1) |
93 | { |
||
94 | CursorPointer.Restore(); |
||
5773 | leency | 95 | if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y + links[active].h,links[active].w, WB1.DrawBuf.zoom, link_col_in); |
4718 | leency | 96 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
4497 | leency | 97 | active = -1; |
98 | } |
||
4488 | leency | 99 | } |