Rev 4364 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4364 | Rev 5043 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #include "utils/log.h" |
38 | #include "utils/log.h" |
39 | #include |
39 | #include |
Line 40... | Line 40... | ||
40 | 40 | ||
Line -... | Line 41... | ||
- | 41 | #include "widget.h" |
|
- | 42 | ||
- | 43 | #ifdef DBG |
|
- | 44 | #undef DBG |
|
- | 45 | #endif |
|
- | 46 | //#define DBG(s) __menuet__debug_out(s) /* For the debug messages in BOARD */ |
|
41 | #include "widget.h" |
47 | #define DBG(s) LOG((s)) /* So that we see debug in Netsurf's LOG files */ |
Line 42... | Line 48... | ||
42 | 48 | ||
43 | /* Vertical scroll widget */ |
49 | /* Vertical scroll widget */ |
44 | 50 | ||
45 | static int |
51 | static int |
46 | vscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
52 | vscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
47 | { |
53 | { |
48 | LOG(("REDRAW SCROLL")); |
54 | LOG(("REDRAW SCROLL")); |
Line 49... | Line 55... | ||
49 | //__menuet__debug_out("REDRAW SCROLL"); |
55 | //DBG("REDRAW SCROLL"); |
50 | int vscroll; |
56 | int vscroll; |
Line 51... | Line 57... | ||
51 | int vpos; |
57 | int vpos; |
52 | 58 | ||
53 | nsfb_bbox_t bbox; |
59 | nsfb_bbox_t bbox; |
Line 54... | Line 60... | ||
54 | nsfb_bbox_t rect; |
60 | nsfb_bbox_t rect; |
55 | 61 | ||
56 | LOG(("REDRAW SCROLL get rooot")); |
62 | LOG(("REDRAW SCROLL get rooot")); |
Line 57... | Line 63... | ||
57 | //__menuet__debug_out("REDRAW SCROLL get root"); |
63 | //DBG("REDRAW SCROLL get root"); |
58 | fbtk_widget_t *root = fbtk_get_root_widget(widget); |
64 | fbtk_widget_t *root = fbtk_get_root_widget(widget); |
59 | 65 | ||
Line 60... | Line 66... | ||
60 | 66 | ||
Line 61... | Line 67... | ||
61 | LOG(("REDRAW SCROLL get bbox")); |
67 | LOG(("REDRAW SCROLL get bbox")); |
Line 83... | Line 89... | ||
83 | //STUB!!! |
89 | //STUB!!! |
84 | nsfb_plot_rectangle_fill(root->u.root.fb, &rect, widget->fg); |
90 | nsfb_plot_rectangle_fill(root->u.root.fb, &rect, widget->fg); |
85 | nsfb_plot_rectangle(root->u.root.fb, &rect, 1, 0xFF999999, false, false); |
91 | nsfb_plot_rectangle(root->u.root.fb, &rect, 1, 0xFF999999, false, false); |
Line 86... | Line 92... | ||
86 | 92 | ||
87 | LOG(("REDRAW SCROLL widg")); |
93 | LOG(("REDRAW SCROLL widg")); |
Line 88... | Line 94... | ||
88 | //__menuet__debug_out("REDRAW SCROLL widg"); |
94 | //DBG("REDRAW SCROLL widg"); |
89 | 95 | ||
90 | /* scroll bar */ |
96 | /* scroll bar */ |
91 | if ((widget->u.scroll.maximum - widget->u.scroll.minimum) > 0) { |
97 | if ((widget->u.scroll.maximum - widget->u.scroll.minimum) > 0) { |
Line 105... | Line 111... | ||
105 | 111 | ||
106 | //STUB!!! |
112 | //STUB!!! |
Line 107... | Line 113... | ||
107 | nsfb_plot_rectangle_fill(root->u.root.fb, &rect, widget->bg); |
113 | nsfb_plot_rectangle_fill(root->u.root.fb, &rect, widget->bg); |
108 | 114 | ||
Line 109... | Line 115... | ||
109 | LOG(("REDRAW SCROLL upd")); |
115 | LOG(("REDRAW SCROLL upd")); |
110 | //__menuet__debug_out("RED upd"); |
116 | //DBG("RED upd"); |
Line 111... | Line 117... | ||
111 | 117 | ||
Line 118... | Line 124... | ||
118 | static int |
124 | static int |
119 | vscroll_drag(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
125 | vscroll_drag(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
120 | { |
126 | { |
Line 121... | Line 127... | ||
121 | 127 | ||
122 | LOG(("REDRAG SCROLL")); |
128 | LOG(("REDRAG SCROLL")); |
123 | //__menuet__debug_out("REDRAG SCROLL"); |
129 | //DBG("REDRAG SCROLL"); |
124 | int newpos; |
130 | int newpos; |
Line 125... | Line 131... | ||
125 | fbtk_widget_t *scrollw = cbi->context; |
131 | fbtk_widget_t *scrollw = cbi->context; |
126 | 132 | ||
Line 144... | Line 150... | ||
144 | static int |
150 | static int |
145 | vscrollu_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
151 | vscrollu_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
146 | { |
152 | { |
Line 147... | Line 153... | ||
147 | 153 | ||
148 | LOG(("REDRAW Ck SCROLL")); |
154 | LOG(("REDRAW Ck SCROLL")); |
149 | //__menuet__debug_out("REDRAW Ck SCROLL"); |
155 | //DBG("REDRAW Ck SCROLL"); |
150 | int newpos; |
156 | int newpos; |
Line 151... | Line 157... | ||
151 | fbtk_widget_t *scrollw = cbi->context; |
157 | fbtk_widget_t *scrollw = cbi->context; |
152 | 158 | ||
Line 166... | Line 172... | ||
166 | static int |
172 | static int |
167 | vscrolld_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
173 | vscrolld_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
168 | { |
174 | { |
Line 169... | Line 175... | ||
169 | 175 | ||
170 | LOG(("REDRAW SCROLL 2")); |
176 | LOG(("REDRAW SCROLL 2")); |
171 | //__menuet__debug_out("REDRAW SCROLL 2"); |
177 | //DBG("REDRAW SCROLL 2"); |
172 | int newpos; |
178 | int newpos; |
Line 173... | Line 179... | ||
173 | fbtk_widget_t *scrollw = cbi->context; |
179 | fbtk_widget_t *scrollw = cbi->context; |
174 | 180 | ||
Line 187... | Line 193... | ||
187 | 193 | ||
188 | static int |
194 | static int |
189 | vscrollarea_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
195 | vscrollarea_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
190 | { |
196 | { |
191 | LOG(("REDRAW SCROLL 3")); |
197 | LOG(("REDRAW SCROLL 3")); |
192 | //__menuet__debug_out("REDRAW SCROLL 3"); |
198 | //DBG("REDRAW SCROLL 3"); |
193 | int vscroll; |
199 | int vscroll; |
194 | int vpos; |
200 | int vpos; |
195 | int newpos; |
201 | int newpos; |
Line 268... | Line 274... | ||
268 | fbtk_callback callback, |
274 | fbtk_callback callback, |
269 | void *context) |
275 | void *context) |
270 | { |
276 | { |
Line 271... | Line 277... | ||
271 | 277 | ||
272 | LOG(("REDRAW SCROLL 4")); |
278 | LOG(("REDRAW SCROLL 4")); |
273 | //__menuet__debug_out("REDRAW SCROLL 4"); |
279 | //DBG("REDRAW SCROLL 4"); |
Line 274... | Line 280... | ||
274 | fbtk_widget_t *neww; |
280 | fbtk_widget_t *neww; |
275 | 281 | ||
276 | neww = fbtk_widget_new(parent, |
282 | neww = fbtk_widget_new(parent, |
Line 319... | Line 325... | ||
319 | static int |
325 | static int |
320 | hscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
326 | hscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
321 | { |
327 | { |
Line 322... | Line 328... | ||
322 | 328 | ||
323 | LOG(("REDRAW SCROLL 5")); |
329 | LOG(("REDRAW SCROLL 5")); |
324 | //__menuet__debug_out("REDRAW SCROLL 5"); |
330 | //DBG("REDRAW SCROLL 5"); |
325 | int hscroll; |
331 | int hscroll; |
326 | int hpos; |
332 | int hpos; |
327 | nsfb_bbox_t bbox; |
333 | nsfb_bbox_t bbox; |
328 | nsfb_bbox_t rect; |
334 | nsfb_bbox_t rect; |
Line 381... | Line 387... | ||
381 | static int |
387 | static int |
382 | hscrolll_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
388 | hscrolll_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
383 | { |
389 | { |
Line 384... | Line 390... | ||
384 | 390 | ||
385 | LOG(("REDRAW SCROLL 6")); |
391 | LOG(("REDRAW SCROLL 6")); |
386 | //__menuet__debug_out("REDRAW SCROLL 6"); |
392 | //DBG("REDRAW SCROLL 6"); |
387 | int newpos; |
393 | int newpos; |
Line 388... | Line 394... | ||
388 | fbtk_widget_t *scrollw = cbi->context; |
394 | fbtk_widget_t *scrollw = cbi->context; |
389 | 395 | ||
Line 405... | Line 411... | ||
405 | static int |
411 | static int |
406 | hscrollr_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
412 | hscrollr_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
407 | { |
413 | { |
Line 408... | Line 414... | ||
408 | 414 | ||
409 | LOG(("REDRAW SCROLL 7")); |
415 | LOG(("REDRAW SCROLL 7")); |
410 | //__menuet__debug_out("REDRAW SCROLL 7"); |
416 | //DBG("REDRAW SCROLL 7"); |
411 | int newpos; |
417 | int newpos; |
Line 412... | Line 418... | ||
412 | fbtk_widget_t *scrollw = cbi->context; |
418 | fbtk_widget_t *scrollw = cbi->context; |
413 | 419 | ||
Line 427... | Line 433... | ||
427 | static int |
433 | static int |
428 | hscroll_drag(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
434 | hscroll_drag(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
429 | { |
435 | { |
Line 430... | Line 436... | ||
430 | 436 | ||
431 | LOG(("REDRAW SCROLL 8")); |
437 | LOG(("REDRAW SCROLL 8")); |
432 | //__menuet__debug_out("REDRAW SCROLL 8"); |
438 | //DBG("REDRAW SCROLL 8"); |
433 | int newpos; |
439 | int newpos; |
Line 434... | Line 440... | ||
434 | fbtk_widget_t *scrollw = cbi->context; |
440 | fbtk_widget_t *scrollw = cbi->context; |
435 | 441 | ||
Line 453... | Line 459... | ||
453 | static int |
459 | static int |
454 | hscrollarea_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
460 | hscrollarea_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) |
455 | { |
461 | { |
Line 456... | Line 462... | ||
456 | 462 | ||
457 | LOG(("REDRAW SCROLL 9")); |
463 | LOG(("REDRAW SCROLL 9")); |
458 | //__menuet__debug_out("REDRAW SCROLL 9"); |
464 | //DBG("REDRAW SCROLL 9"); |
459 | int hscroll; |
465 | int hscroll; |
460 | int hpos; |
466 | int hpos; |
461 | int newpos; |
467 | int newpos; |
Line 512... | Line 518... | ||
512 | fbtk_callback callback, |
518 | fbtk_callback callback, |
513 | void *context) |
519 | void *context) |
514 | { |
520 | { |
Line 515... | Line 521... | ||
515 | 521 | ||
516 | LOG(("REDRAW SCROLL 10")); |
522 | LOG(("REDRAW SCROLL 10")); |
517 | //__menuet__debug_out("REDRAW SCROLL 10"); |
523 | //DBG("REDRAW SCROLL 10"); |
Line 518... | Line 524... | ||
518 | fbtk_widget_t *neww; |
524 | fbtk_widget_t *neww; |
519 | 525 | ||
520 | neww = fbtk_widget_new(parent, |
526 | neww = fbtk_widget_new(parent, |
Line 563... | Line 569... | ||
563 | int max, |
569 | int max, |
564 | int thumb, |
570 | int thumb, |
565 | int page) |
571 | int page) |
566 | { |
572 | { |
567 | LOG(("REDRAW SCROLL 11")); |
573 | LOG(("REDRAW SCROLL 11")); |
568 | //__menuet__debug_out("REDRAW SCROLL 11"); |
574 | //DBG("REDRAW SCROLL 11"); |
569 | if (widget == NULL) |
575 | if (widget == NULL) |
570 | return false; |
576 | return false; |
Line 571... | Line 577... | ||
571 | 577 | ||
572 | if ((widget->type != FB_WIDGET_TYPE_HSCROLL) && |
578 | if ((widget->type != FB_WIDGET_TYPE_HSCROLL) && |
Line 591... | Line 597... | ||
591 | /* exported function documented in fbtk.h */ |
597 | /* exported function documented in fbtk.h */ |
592 | bool |
598 | bool |
593 | fbtk_set_scroll_position(fbtk_widget_t *widget, int position) |
599 | fbtk_set_scroll_position(fbtk_widget_t *widget, int position) |
594 | { |
600 | { |
595 | LOG(("REDRAW SCROLL 12")); |
601 | LOG(("REDRAW SCROLL 12")); |
596 | //__menuet__debug_out("REDRAW SCROLL 12"); |
602 | //DBG("REDRAW SCROLL 12"); |
597 | if (widget == NULL) |
603 | if (widget == NULL) |
598 | return false; |
604 | return false; |
Line 599... | Line 605... | ||
599 | 605 | ||
600 | if ((widget->type != FB_WIDGET_TYPE_HSCROLL) && |
606 | if ((widget->type != FB_WIDGET_TYPE_HSCROLL) && |