Dillo v3.2.0-88-g47ab7c70
Loading...
Searching...
No Matches
fltkui.cc
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2025 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21
22
23#include "fltkcore.hh"
24#include "fltkflatview.hh"
25#include "fltkcomplexbutton.hh"
26#include "dlib/dlib.h"
27#include "../lout/msg.h"
28#include "../lout/misc.hh"
29
30#include <FL/Fl.H>
31#include <FL/fl_draw.H>
32#include <FL/Fl_Input.H>
33#include <FL/Fl_Text_Editor.H>
34#include <FL/Fl_Check_Button.H>
35#include <FL/Fl_Round_Button.H>
36#include <FL/Fl_Choice.H>
37#include <FL/Fl_Browser.H>
38
39#include <stdio.h>
40
41//----------------------------------------------------------------------------
42
43static Fl_Color fltkui_dimmed(Fl_Color c, Fl_Color bg)
44{
45 return fl_color_average(c, bg, .33f);
46}
47
48//----------------------------------------------------------------------------
49/*
50 * Local sub classes
51 */
52
53/*
54 * Used to show optional placeholder text and to enable CTRL+{a,e,d,k} in
55 * form inputs (for start,end,del,cut)
56 */
57class CustInput2 : public Fl_Input {
58public:
59 CustInput2 (int x, int y, int w, int h, const char* l=0);
60 ~CustInput2 () { if (placeholder) free(placeholder); };
61 void set_placeholder(const char *str);
62 int show_placeholder();
63 int show_normal(const char *str);
64 void textcolor(Fl_Color c);
65 void input_type(int t);
66 int value(const char* str);
67 const char* value();
68 int handle(int e);
69private:
70 char *placeholder;
71 bool showing_placeholder;
72 Fl_Color usual_color;
73 int usual_type;
74};
75
76CustInput2::CustInput2 (int x, int y, int w, int h, const char* l) :
77 Fl_Input(x,y,w,h,l)
78{
79 placeholder = NULL;
80 showing_placeholder = false;
81 usual_color = FL_BLACK; /* just init until widget style is set */
82}
83
84/*
85 * Show normal text.
86 */
87int CustInput2::show_normal(const char *str)
88{
89 showing_placeholder = false;
90 Fl_Input::textcolor(usual_color);
91 Fl_Input::input_type(usual_type);
92 return Fl_Input::value(str);
93}
94
95/*
96 * Show the placeholder text.
97 */
98int CustInput2::show_placeholder()
99{
100 int ret;
101
102 showing_placeholder = true;
103 Fl_Input::textcolor(fltkui_dimmed(usual_color, color()));
104 Fl_Input::input_type(FL_NORMAL_INPUT);
105 ret = Fl_Input::value(placeholder);
106 position(0);
107 return ret;
108}
109
110/*
111 * Set the placeholder text.
112 */
113void CustInput2::set_placeholder(const char *str)
114{
115 if (placeholder)
116 free(placeholder);
117 placeholder = dStrdup(str);
118
119 if ((Fl::focus() != this) && !*value()) {
120 show_placeholder();
121 }
122}
123
124/*
125 * Set the text color.
126 */
127void CustInput2::textcolor(Fl_Color c)
128{
129 usual_color = c;
130 if (showing_placeholder)
131 c = fltkui_dimmed(c, color());
132 Fl_Input::textcolor(c);
133}
134
135/*
136 * Set the input type (normal, password, etc.)
137 */
138void CustInput2::input_type(int t)
139{
140 usual_type = t;
141 Fl_Input::input_type(t);
142}
143
144/*
145 * Set the value of the input.
146 * NOTE that we're not being very careful with the return value, which is
147 * supposed to be nonzero iff the value was changed.
148 */
149int CustInput2::value(const char *str)
150{
151 return (placeholder && (!str || !*str) && Fl::focus() != this)
152 ? show_placeholder() : show_normal(str);
153}
154
155/*
156 * Return the value (text) of the input.
157 */
158const char* CustInput2::value()
159{
160 return showing_placeholder ? "" : Fl_Input::value();
161}
162
163int CustInput2::handle(int e)
164{
165 int rc, k = Fl::event_key();
166
167 _MSG("CustInput2::handle event=%d\n", e);
168
169 // We're only interested in some flags
170 unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
171
172 if (e == FL_KEYBOARD) {
173 if (k == FL_Page_Down || k == FL_Page_Up || k == FL_Up || k == FL_Down) {
174 // Let them through for key commands and viewport motion.
175 return 0;
176 }
177 if (modifier == FL_CTRL) {
178 if (k == 'e') {
179 position(size());
180 return 1;
181 } else if (k == 'k') {
182 cut(position(), size());
183 return 1;
184 } else if (k == 'd') {
185 cut(position(), position()+1);
186 return 1;
187 } else if (k == 'h' || k == 'i' || k == 'j' || k == 'l' || k == 'm') {
188 // Fl_Input wants to use ^H as backspace, and also "insert a few
189 // selected control characters literally", but this gets in the way
190 // of key commands.
191 return 0;
192 }
193 }
194 } else if (e == FL_UNFOCUS) {
195 if (placeholder && !value()[0]) {
196 show_placeholder();
197 }
198 }
199
200 rc = Fl_Input::handle(e);
201
202 if (rc && e == FL_FOCUS) {
203 // Nonzero return from handle() should mean that focus was accepted.
204 if (showing_placeholder)
205 show_normal("");
206 }
207 return rc;
208}
209
210/*
211 * Used to show optional placeholder text.
212 */
213class CustTextEditor : public Fl_Text_Editor {
214public:
215 CustTextEditor (int x, int y, int w, int h, const char* l=0);
216 ~CustTextEditor ();
217 void set_placeholder(const char *str);
218 void show_placeholder();
219 void show_normal(const char *str);
220 void textcolor(Fl_Color c);
221 void value(const char* str);
222 char* value();
223 int handle(int e);
224private:
225 char *placeholder;
226 bool showing_placeholder;
227 Fl_Color usual_color;
228 char *text_copy;
229};
231CustTextEditor::CustTextEditor (int x, int y, int w, int h, const char* l) :
232 Fl_Text_Editor(x,y,w,h,l)
234 placeholder = NULL;
235 showing_placeholder = false;
236 buffer(new Fl_Text_Buffer());
237 usual_color = FL_BLACK; /* just init until widget style is set */
238 text_copy = NULL;
239}
240
241CustTextEditor::~CustTextEditor ()
242{
243 Fl_Text_Buffer *buf = buffer();
244
245 buffer(NULL);
246 delete buf;
247
248 if (placeholder)
249 free(placeholder);
250 if (text_copy)
251 free(text_copy);
252}
253
254/*
255 * Show normal text.
256 */
257void CustTextEditor::show_normal(const char *str)
258{
259 showing_placeholder = false;
260 Fl_Text_Editor::textcolor(usual_color);
261 buffer()->text(str);
262}
263
264/*
265 * Show the placeholder text.
266 */
267void CustTextEditor::show_placeholder()
268{
269 showing_placeholder = true;
270 Fl_Text_Editor::textcolor(fltkui_dimmed(usual_color, color()));
271 buffer()->text(placeholder);
272}
273
274/*
275 * Set the placeholder text.
276 */
277void CustTextEditor::set_placeholder(const char *str)
278{
279 if (placeholder)
280 free(placeholder);
281 placeholder = dStrdup(str);
282
283 if ((Fl::focus() != this) && buffer()->length() == 0) {
284 show_placeholder();
285 }
286}
287
288/*
289 * Set the text color.
290 */
291void CustTextEditor::textcolor(Fl_Color c)
292{
293 usual_color = c;
294 if (showing_placeholder)
295 c = fltkui_dimmed(c, color());
296 Fl_Text_Editor::textcolor(c);
297}
298
299/*
300 * Set the value of the input.
301 */
302void CustTextEditor::value(const char *str)
303{
304 if (placeholder && (!str || !*str) && Fl::focus() != this)
305 show_placeholder();
306 else
307 show_normal(str);
308}
309
310/*
311 * Return the value (text) of the input.
312 */
313char* CustTextEditor::value()
314{
315 /* FLTK-1.3 insists upon returning a new copy of the buffer text, so
316 * we have to keep track of it.
317 */
318 if (text_copy)
319 free(text_copy);
320 text_copy = showing_placeholder ? dStrdup("") : buffer()->text();
321 return text_copy;
322}
323
324int CustTextEditor::handle(int e)
325{
326 int rc;
327
328 if (e == FL_UNFOCUS) {
329 if (placeholder && buffer()->length() == 0) {
330 show_placeholder();
331 }
332 }
333
334 rc = Fl_Text_Editor::handle(e);
335
336 if (rc && e == FL_FOCUS) {
337 // Nonzero return from handle() should mean that focus was accepted.
338 if (showing_placeholder)
339 show_normal("");
340 }
341 return rc;
342}
343
344
345/*
346 * Used to handle some keystrokes as shortcuts to option menuitems
347 * (i.e. jump to the next menuitem whose label starts with the pressed key)
348 */
349class CustChoice : public Fl_Choice {
350public:
351 CustChoice (int x, int y, int w, int h, const char* l=0) :
352 Fl_Choice(x,y,w,h,l) {};
353 int handle(int e);
354};
355
356int CustChoice::handle(int e)
357{
358 int k = Fl::event_key();
359 unsigned modifier = Fl::event_state() & (FL_SHIFT|FL_CTRL|FL_ALT|FL_META);
360
361 _MSG("CustChoice::handle %p e=%d active=%d focus=%d\n",
362 this, e, active(), (Fl::focus() == this));
363 if (Fl::focus() != this) {
364 ; // Not Focused, let FLTK handle it
365 } else if (e == FL_KEYDOWN && modifier == 0) {
366 if (k == FL_Enter || k == FL_Down) {
367 return Fl_Choice::handle(FL_PUSH); // activate menu
368
369 } else if (isalnum(k)) { // try key as shortcut to menuitem
370 int t = value()+1 >= size() ? 0 : value()+1;
371 while (t != value()) {
372 const Fl_Menu_Item *mi = &(menu()[t]);
373 if (mi->submenu()) // submenu?
374 ;
375 else if (mi->label() && mi->active()) { // menu item?
376 if (k == tolower(mi->label()[0])) {
377 value(mi);
378 return 1; // Let FLTK know we used this key
379 }
380 }
381 if (++t == size())
382 t = 0;
383 }
384 }
385 }
386
387 return Fl_Choice::handle(e);
388}
389
390//----------------------------------------------------------------------------
391
392namespace dw {
393namespace fltk {
394namespace ui {
395
397
398using namespace lout::object;
399using namespace lout::container::typed;
400
402{
403 DBG_OBJ_CREATE ("dw::fltk::ui::FltkResource");
404
405 this->platform = platform;
406
407 allocation.x = 0;
408 allocation.y = 0;
409 allocation.width = 1;
410 allocation.ascent = 1;
412
413 style = NULL;
414
415 enabled = true;
416}
417
423{
424 view = NULL;
425 widget = NULL;
426 platform->attachResource (this);
427}
428
430{
431 platform->detachResource (this);
432 if (widget) {
433 if (view) {
435 }
436 delete widget;
437 }
438 if (style)
439 style->unref ();
440
442}
443
445{
446 if (this->view)
447 MSG_ERR("FltkResource::attachView: multiple views!\n");
448
449 if (view->usesFltkWidgets ()) {
450 this->view = view;
451
454 if (style)
456 if (! enabled)
457 widget->deactivate ();
458 }
459}
460
462{
463 if (this->view != view)
464 MSG_ERR("FltkResource::detachView: this->view: %p view: %p\n",
465 (void *) this->view, (void *) view);
466 this->view = NULL;
467}
468
470{
471 DBG_OBJ_ENTER ("resize", 0, "sizeAllocate", "%d, %d; %d * (%d + %d)",
474
475 this->allocation = *allocation;
477
478 DBG_OBJ_LEAVE ();
479}
480
482 core::DrawingContext *context)
483{
484 FltkView *fltkView = (FltkView*)view;
485 if (fltkView->usesFltkWidgets () && this->view == fltkView) {
486 fltkView->drawFltkWidget (widget, area);
487 }
488}
489
491{
492 if (this->style)
493 this->style->unref ();
494
495 this->style = style;
496 style->ref ();
497
499}
500
501void FltkResource::setWidgetStyle (Fl_Widget *widget,
502 core::style::Style *style)
503{
504 FltkFont *font = (FltkFont*)style->font;
505 widget->labelsize (font->size);
506 widget->labelfont (font->font);
507
509 if (bg) {
510 int normal_bg = bg->colors[FltkColor::SHADING_NORMAL];
511
512 if (style->color) {
513 int style_fg = ((FltkColor*)style->color)->colors
515 Fl_Color fg = fl_contrast(style_fg, normal_bg);
516
517 widget->labelcolor(fg);
518 widget->selection_color(fg);
519 }
520
521 widget->color(normal_bg);
522 }
523}
524
525void FltkResource::setDisplayed(bool displayed)
526{
527 if (displayed)
528 widget->show();
529 else
530 widget->hide();
531}
532
534{
535 bool ret = false;
536
537 if (widget) {
538 // visible() is not the same thing as being show()n exactly, but
539 // show()/hide() set it appropriately for our purposes.
540 ret = widget->visible();
541 }
542 return ret;
543}
544
546{
547 return enabled;
548}
549
550void FltkResource::setEnabled (bool enabled)
551{
552 this->enabled = enabled;
553
554 if (enabled)
555 widget->activate ();
556 else
557 widget->deactivate ();
558}
559
560// ----------------------------------------------------------------------
561
563 *platform) :
565{
566 DBG_OBJ_CREATE ("dw::fltk::ui::FltkSpecificResource<>");
569}
570
575
577 *allocation)
578{
579 FltkResource::sizeAllocate (allocation);
580}
581
582template <class I> void FltkSpecificResource<I>::draw (core::View *view,
583 core::Rectangle *area,
585 *context)
586{
587 FltkResource::draw (view, area, context);
588}
589
591 *style)
592{
594}
595
596template <class I> bool FltkSpecificResource<I>::isEnabled ()
597{
598 return FltkResource::isEnabled ();
599}
600
601template <class I> void FltkSpecificResource<I>::setEnabled (bool enabled)
602{
603 FltkResource::setEnabled (enabled);
604}
605
606// ----------------------------------------------------------------------
607
608class EnterButton : public Fl_Button {
609public:
610 EnterButton (int x,int y,int w,int h, const char* label = 0) :
611 Fl_Button (x,y,w,h,label) {};
612 int handle(int e);
613};
614
615int EnterButton::handle(int e)
616{
617 if (e == FL_KEYBOARD && Fl::focus() == this && Fl::event_key() == FL_Enter){
618 set_changed();
619 simulate_key_action();
620 do_callback();
621 return 1;
622 }
623 return Fl_Button::handle(e);
624}
625
627 const char *label):
628 FltkSpecificResource <dw::core::ui::LabelButtonResource> (platform)
629{
630 this->label = dStrdup (label);
631 init (platform);
632}
633
638
640 *allocation)
641{
642 Fl_Button *button =
643 new EnterButton (allocation->x, allocation->y, allocation->width,
645 button->callback (widgetCallback, this);
646 button->when (FL_WHEN_RELEASE);
647 return button;
648}
649
651{
652 DBG_OBJ_ENTER0 ("resize", 0, "sizeRequest");
653
654 if (style) {
655 FltkFont *font = (FltkFont*)style->font;
656 fl_font(font->font,font->size);
657 requisition->width =
658 (int)fl_width (label, strlen (label))
659 + 2 * RELIEF_X_THICKNESS;
660 requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
661 requisition->descent = font->descent + RELIEF_Y_THICKNESS;
662 } else {
663 requisition->width = 1;
664 requisition->ascent = 1;
665 requisition->descent = 0;
666 }
667
668 DBG_OBJ_MSGF ("resize", 1, "result: %d * (%d + %d)",
669 requisition->width, requisition->ascent, requisition->descent);
670 DBG_OBJ_LEAVE ();
671}
672
673/*
674 * Get FLTK state and translate to dw
675 *
676 * TODO: find a good home for this and the fltkviewbase.cc original.
677 */
679{
680 int s1 = Fl::event_state ();
681 int s2 = (core::ButtonState)0;
682
683 if (s1 & FL_SHIFT) s2 |= core::SHIFT_MASK;
684 if (s1 & FL_CTRL) s2 |= core::CONTROL_MASK;
685 if (s1 & FL_ALT) s2 |= core::META_MASK;
686 if (s1 & FL_BUTTON1) s2 |= core::BUTTON1_MASK;
687 if (s1 & FL_BUTTON2) s2 |= core::BUTTON2_MASK;
688 if (s1 & FL_BUTTON3) s2 |= core::BUTTON3_MASK;
689
690 return (core::ButtonState)s2;
691}
692
694{
695 event->xCanvas = Fl::event_x();
696 event->yCanvas = Fl::event_y();
697 event->state = getDwButtonState();
698 event->button = Fl::event_button();
699 event->numPressed = Fl::event_clicks() + 1;
700}
701
703 void *data)
704{
705 if (!Fl::event_button3()) {
708 setButtonEvent(&event);
709 lbr->emitClicked(&event);
710 }
711}
712
714{
715 return label;
716}
717
718
719void FltkLabelButtonResource::setLabel (const char *label)
720{
721 free((char *)this->label);
722 this->label = dStrdup (label);
723
724 widget->label (this->label);
725 queueResize (true);
726}
727
728// ----------------------------------------------------------------------
729
732 *widget, bool relief):
733 FltkSpecificResource <dw::core::ui::ComplexButtonResource> (platform)
734{
735 flatView = topView = NULL;
736 this->relief = relief;
738 ComplexButtonResource::init (widget);
739}
740
744
746 void *data)
747{
749
750 if (Fl::event() == FL_RELEASE && Fl::event_button() != FL_RIGHT_MOUSE) {
751 int w = widget->w(), h = widget->h();
752
753 res->click_x = Fl::event_x() - widget->x();
754 res->click_y = Fl::event_y() - widget->y();
755 if (res->style) {
756 res->click_x -= res->style->boxOffsetX();
757 res->click_y -= res->style->boxOffsetY();
758 w -= res->style->boxDiffWidth();
759 h -= res->style->boxDiffHeight();
760 }
761 if (res->click_x >= 0 && res->click_y >= 0 &&
762 res->click_x < w && res->click_y < h) {
764 setButtonEvent(&event);
765 res->emitClicked(&event);
766 }
767 } else if (Fl::event() == FL_KEYBOARD) {
768 // Simulate a click.
770
771 res->click_x = res->click_y = 0;
772 event.xCanvas = widget->x() + res->style->boxOffsetX();
773 event.yCanvas = widget->y() + res->style->boxOffsetY();
774 // ButtonState doesn't have mouse button values on a release.
775 event.state = (core::ButtonState) 0;
776 event.button = 1;
777 event.numPressed = 1;
778 res->emitClicked(&event);
779 }
780}
781
786
794
799
801{
803
804 DBG_OBJ_MSGF_O ("resize", 0, flatView,
805 "<b>resize</b> (%d %d, <i>%d - 2 * %d =</i> %d, "
806 "<i>%d + %d - 2 * %d =</i> %d)",
813 - 2 * reliefYThickness ());
814
815 ((FltkFlatView*)flatView)->resize (
819
820 ((FltkFlatView*)flatView)->parent ()->init_sizes ();
821}
822
827
832
837
838
840 *allocation)
841{
842 ComplexButton *button =
845 button->callback (widgetCallback, this);
846 button->when (FL_WHEN_RELEASE);
847 if (!relief)
848 button->box(FL_NO_BOX);
849
854 - 2 * reliefYThickness ());
855 button->add ((FltkFlatView *)flatView);
856
857 if (layout)
859 return button;
860}
861
862// ----------------------------------------------------------------------
863
865 bool password, const char *label,
866 const char *placeholder):
867 FltkSpecificResource <dw::core::ui::EntryResource> (platform)
868{
869 this->size = size;
870 this->password = password;
871 this->label = label ? dStrdup(label) : NULL;
872 this->label_w = 0;
873 this->placeholder = placeholder ? dStrdup(placeholder) : NULL;
874
875 initText = NULL;
876 editable = false;
877
878 init (platform);
879}
880
882{
883 if (initText)
884 free((char *)initText);
885 if (label)
886 free(label);
887 if (placeholder)
888 free(placeholder);
889}
890
892 *allocation)
893{
894 CustInput2 *input =
895 new CustInput2(allocation->x, allocation->y, allocation->width,
897 input->input_type(password ? FL_SECRET_INPUT : FL_NORMAL_INPUT);
898 input->callback (widgetCallback, this);
899 input->when (FL_WHEN_ENTER_KEY_ALWAYS);
900
901 if (label) {
902 input->label(label);
903 input->align(FL_ALIGN_LEFT);
904 }
905 if (initText)
906 input->value (initText);
907 if (placeholder)
908 input->set_placeholder(placeholder);
909
910 return input;
911}
912
913void FltkEntryResource::setWidgetStyle (Fl_Widget *widget,
914 core::style::Style *style)
915{
916 CustInput2 *in = (CustInput2 *)widget;
917
919
920 in->textcolor(widget->labelcolor());
921 in->cursor_color(widget->labelcolor());
922 in->textsize(in->labelsize());
923 in->textfont(in->labelfont());
924
925 if (label) {
926 int h;
927 label_w = 0;
928 widget->measure_label(label_w, h);
930 }
931}
932
938
940{
941 DBG_OBJ_ENTER0 ("resize", 0, "sizeRequest");
942
943 if (displayed() && style) {
944 FltkFont *font = (FltkFont*)style->font;
945 fl_font(font->font,font->size);
946 // WORKAROUND: A bug with fl_width(uint_t) on non-xft X was present in
947 // 1.3.0 (STR #2688).
948 requisition->width =
949 (int)fl_width ("n")
950 * (size == UNLIMITED_SIZE ? 10 : size)
951 + label_w + (2 * RELIEF_X_THICKNESS);
952 requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
953 requisition->descent = font->descent + RELIEF_Y_THICKNESS;
954 } else {
955 requisition->width = 0;
956 requisition->ascent = 0;
957 requisition->descent = 0;
958 }
959
960 DBG_OBJ_MSGF ("resize", 1, "result: %d * (%d + %d)",
961 requisition->width, requisition->ascent, requisition->descent);
962 DBG_OBJ_LEAVE ();
963}
964
966{
967 if (!label) {
969 } else {
970 DBG_OBJ_MSGF ("resize", 0,
971 "<b>sizeAllocate</b> (%d, %d; %d * (%d + %d))",
974
975 this->allocation = *allocation;
976
977 /* push the Fl_Input over to the right of the label */
979 a.x += this->label_w;
980 a.width -= this->label_w;
982 }
983}
984
985void FltkEntryResource::widgetCallback (Fl_Widget *widget, void *data)
986{
987 ((FltkEntryResource*)data)->emitActivate ();
988}
989
991{
992 return ((CustInput2*)widget)->value ();
993}
994
995void FltkEntryResource::setText (const char *text)
996{
997 if (initText)
998 free((char *)initText);
999 initText = dStrdup (text);
1000
1001 ((CustInput2*)widget)->value (initText);
1002}
1003
1005{
1006 return editable;
1007}
1008
1010{
1011 this->editable = editable;
1012}
1013
1015{
1016 ((Fl_Input *)widget)->maximum_size(maxlen);
1017}
1018
1019// ----------------------------------------------------------------------
1020
1021static int kf_backspace_word (int c, Fl_Text_Editor *e)
1022{
1023 int p1, p2 = e->insert_position();
1024
1025 e->previous_word();
1026 p1 = e->insert_position();
1027 e->buffer()->remove(p1, p2);
1028 e->show_insert_position();
1029 e->set_changed();
1030 if (e->when() & FL_WHEN_CHANGED)
1031 e->do_callback();
1032 return 0;
1033}
1034
1036 int cols, int rows,
1037 const char *placeholder):
1038 FltkSpecificResource <dw::core::ui::MultiLineTextResource> (platform)
1039{
1040 editable = false;
1041
1042 numCols = cols;
1043 numRows = rows;
1044
1045 DBG_OBJ_SET_NUM ("numCols", numCols);
1046 DBG_OBJ_SET_NUM ("numRows", numRows);
1047
1048 // Check values. Upper bound check is left to the caller.
1049 if (numCols < 1) {
1050 MSG_WARN("numCols = %d is set to 1.\n", numCols);
1051 numCols = 1;
1052 }
1053 if (numRows < 1) {
1054 MSG_WARN("numRows = %d is set to 1.\n", numRows);
1055 numRows = 1;
1056 }
1057 this->placeholder = placeholder ? dStrdup(placeholder) : NULL;
1058
1059 init (platform);
1060}
1061
1067
1069 *allocation)
1070{
1071 CustTextEditor *text =
1072 new CustTextEditor (allocation->x, allocation->y, allocation->width,
1074 text->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
1075 text->remove_key_binding(FL_BackSpace, FL_TEXT_EDITOR_ANY_STATE);
1076 text->add_key_binding(FL_BackSpace, 0, Fl_Text_Editor::kf_backspace);
1077 text->add_key_binding(FL_BackSpace, FL_CTRL, kf_backspace_word);
1078 if (placeholder)
1079 text->set_placeholder(placeholder);
1080 return text;
1081}
1082
1084 core::style::Style *style)
1085{
1086 CustTextEditor *ed = (CustTextEditor *)widget;
1087
1089
1090 ed->textcolor(widget->labelcolor());
1091 ed->cursor_color(widget->labelcolor());
1092 ed->textsize(ed->labelsize());
1093 ed->textfont(ed->labelfont());
1094}
1095
1097{
1098 DBG_OBJ_ENTER0 ("resize", 0, "sizeRequest");
1099
1100 if (style) {
1101 FltkFont *font = (FltkFont*)style->font;
1102 fl_font(font->font,font->size);
1103 // WORKAROUND: A bug with fl_width(uint_t) on non-xft X was present in
1104 // 1.3.0 (STR #2688).
1105 requisition->width =
1106 (int)fl_width ("n") * numCols + 2 * RELIEF_X_THICKNESS;
1107 requisition->ascent =
1108 RELIEF_Y_THICKNESS + font->ascent +
1109 (font->ascent + font->descent) * (numRows - 1);
1110 requisition->descent =
1111 font->descent +
1113 } else {
1114 requisition->width = 1;
1115 requisition->ascent = 1;
1116 requisition->descent = 0;
1117 }
1118
1119 DBG_OBJ_MSGF ("resize", 1, "result: %d * (%d + %d)",
1120 requisition->width, requisition->ascent, requisition->descent);
1121 DBG_OBJ_LEAVE ();
1122}
1123
1125{
1126 return ((CustTextEditor*)widget)->value ();
1127}
1128
1130{
1131 ((CustTextEditor*)widget)->value (text);
1132}
1133
1135{
1136 return editable;
1137}
1138
1140{
1141 this->editable = editable;
1142}
1143
1144// ----------------------------------------------------------------------
1145
1146template <class I>
1153
1154
1155template <class I>
1159
1160
1161template <class I>
1163 *allocation)
1164{
1165 Fl_Button *button = createNewButton (allocation);
1166 button->value (initActivated);
1167 return button;
1168}
1169
1170template <class I>
1172 core::style::Style *style)
1173{
1174 FltkResource::setWidgetStyle(widget, style);
1175
1176 widget->selection_color(FL_BLACK);
1177}
1178
1179
1180template <class I>
1182{
1183 DBG_OBJ_ENTER0 ("resize", 0, "sizeRequest");
1184
1185 FltkFont *font = (FltkFont *)
1186 (this->FltkResource::style ? this->FltkResource::style->font : NULL);
1187
1188 if (font) {
1189 fl_font(font->font, font->size);
1190 requisition->width = font->ascent + font->descent + 2*RELIEF_X_THICKNESS;
1191 requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
1192 requisition->descent = font->descent + RELIEF_Y_THICKNESS;
1193 } else {
1194 requisition->width = 1;
1195 requisition->ascent = 1;
1196 requisition->descent = 0;
1197 }
1198
1199 DBG_OBJ_MSGF ("resize", 1, "result: %d * (%d + %d)",
1200 requisition->width, requisition->ascent, requisition->descent);
1201 DBG_OBJ_LEAVE ();
1202}
1203
1204
1205template <class I>
1207{
1208 return ((Fl_Button*)this->widget)->value ();
1209}
1210
1211
1212template <class I>
1214{
1215 initActivated = activated;
1216 ((Fl_Button*)this->widget)->value (initActivated);
1217}
1218
1219// ----------------------------------------------------------------------
1220
1222 bool activated):
1223 FltkToggleButtonResource<dw::core::ui::CheckButtonResource> (platform,
1224 activated)
1225{
1226 init (platform);
1227}
1228
1229
1233
1234
1236 *allocation)
1237{
1238 Fl_Check_Button *cb =
1239 new Fl_Check_Button (allocation->x, allocation->y, allocation->width,
1241 return cb;
1242}
1243
1244// ----------------------------------------------------------------------
1245
1247{
1248 return it.hasNext ();
1249}
1250
1256
1261
1262
1264 *radioButtonResource)
1265{
1266 list = new lout::container::typed::List <FltkRadioButtonResource> (false);
1267 connect (radioButtonResource);
1268}
1269
1274
1276 *radioButtonResource)
1277{
1278 list->append (radioButtonResource);
1279}
1280
1282 *radioButtonResource)
1283{
1284 list->removeRef (radioButtonResource);
1285 if (list->isEmpty ())
1286 delete this;
1287}
1288
1289
1292 *groupedWith,
1293 bool activated):
1294 FltkToggleButtonResource<dw::core::ui::RadioButtonResource> (platform,
1295 activated)
1296{
1297 init (platform);
1298
1299 if (groupedWith) {
1300 group = groupedWith->group;
1301 group->connect (this);
1302 } else
1303 group = new Group (this);
1304}
1305
1306
1311
1317
1319 void *data)
1320{
1321 if (widget->when () & FL_WHEN_CHANGED)
1322 ((FltkRadioButtonResource*)data)->buttonClicked ();
1323}
1324
1326{
1327 for (Iterator <FltkRadioButtonResource> it = group->iterator ();
1328 it.hasNext (); ) {
1329 FltkRadioButtonResource *other = it.getNext ();
1330 other->setActivated (other == this);
1331 }
1332}
1333
1335 *allocation)
1336{
1337 /*
1338 * Groups of Fl_Radio_Button must be added to one Fl_Group, which is
1339 * not possible in this context. For this, we do the grouping ourself,
1340 * based on FltkRadioButtonResource::Group.
1341 *
1342 * What we actually need for this, is a widget, which behaves like a
1343 * check button, but looks like a radio button. The first depends on the
1344 * type, the second on the style. Since the type is simpler to change
1345 * than the style, we create a radio button, and then change the type
1346 * (instead of creating a check button, and changing the style).
1347 */
1348
1349 Fl_Button *button =
1350 new Fl_Round_Button (allocation->x, allocation->y, allocation->width,
1352 button->when (FL_WHEN_CHANGED);
1353 button->callback (widgetCallback, this);
1354 button->type (FL_TOGGLE_BUTTON);
1355
1356 return button;
1357}
1358
1359// ----------------------------------------------------------------------
1360
1361template <class I> dw::core::Iterator *
1363{
1365 return new core::EmptyIterator (this->getEmbed (), mask, atEnd);
1366}
1367
1368// ----------------------------------------------------------------------
1369
1371 FltkSelectionResource <dw::core::ui::OptionMenuResource> (platform)
1372{
1373 /* Fl_Menu_ does not like multiple menu items with the same label, and
1374 * insert() treats some characters specially unless escaped, so let's
1375 * do our own menu handling.
1376 */
1377 itemsAllocated = 0x10;
1378 menu = new Fl_Menu_Item[itemsAllocated];
1379 memset(menu, 0, itemsAllocated * sizeof(Fl_Menu_Item));
1380 itemsUsed = 1; // menu[0].text == NULL, which is an end-of-menu marker.
1381
1382 init (platform);
1383}
1384
1386{
1387 for (int i = 0; i < itemsUsed; i++) {
1388 if (menu[i].text)
1389 free((char *) menu[i].text);
1390 }
1391 delete[] menu;
1392}
1393
1395 core::style::Style *style)
1396{
1397 Fl_Choice *ch = (Fl_Choice *)widget;
1398
1400
1401 ch->textcolor(widget->labelcolor());
1402 ch->textfont(ch->labelfont());
1403 ch->textsize(ch->labelsize());
1404}
1405
1407 *allocation)
1408{
1409 Fl_Choice *choice =
1410 new CustChoice (allocation->x, allocation->y,
1413 choice->menu(menu);
1414 return choice;
1415}
1416
1418 void *data)
1419{
1420}
1421
1423{
1424 int i, max = 0;
1425
1426 for (i = 0; i < itemsUsed; i++) {
1427 int width = 0;
1428 const char *str = menu[i].text;
1429
1430 if (str) {
1431 width = fl_width(str);
1432 if (width > max)
1433 max = width;
1434 }
1435 }
1436 return max;
1437}
1438
1440{
1441 DBG_OBJ_ENTER0 ("resize", 0, "sizeRequest");
1442
1443 if (style) {
1444 FltkFont *font = (FltkFont*)style->font;
1445 fl_font(font->font, font->size);
1446 int maxItemWidth = getMaxItemWidth ();
1447 requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
1448 requisition->descent = font->descent + RELIEF_Y_THICKNESS;
1449 requisition->width = maxItemWidth
1450 + (requisition->ascent + requisition->descent)
1451 + 2 * RELIEF_X_THICKNESS;
1452 } else {
1453 requisition->width = 1;
1454 requisition->ascent = 1;
1455 requisition->descent = 0;
1456 }
1457
1458 DBG_OBJ_MSGF ("resize", 1, "result: %d * (%d + %d)",
1459 requisition->width, requisition->ascent, requisition->descent);
1460 DBG_OBJ_LEAVE ();
1461}
1462
1464{
1465 Fl_Choice *ch = (Fl_Choice *)widget;
1466 int selected = ch->value();
1467 Fl_Menu_Item *newMenu;
1468
1469 itemsAllocated += 0x10;
1470 newMenu = new Fl_Menu_Item[itemsAllocated];
1471 memcpy(newMenu, menu, itemsUsed * sizeof(Fl_Menu_Item));
1472 memset(newMenu + itemsUsed, 0, 0x10 * sizeof(Fl_Menu_Item));
1473 delete[] menu;
1474 menu = newMenu;
1475 ch->menu(menu);
1476 ch->value(selected);
1477}
1478
1480{
1481 Fl_Menu_Item *item;
1482
1484 enlargeMenu();
1485
1486 item = menu + itemsUsed - 1;
1487 itemsUsed++;
1488
1489 return item;
1490}
1491
1493 bool enabled, bool selected)
1494{
1495 Fl_Menu_Item *item = newItem();
1496
1497 item->text = dStrdup(str);
1498
1499 if (enabled == false)
1500 item->flags = FL_MENU_INACTIVE;
1501
1502 if (selected)
1503 ((Fl_Choice *)widget)->value(item);
1504
1505 queueResize (true);
1506}
1507
1508void FltkOptionMenuResource::setItem (int index, bool selected)
1509{
1510 if (selected)
1511 ((Fl_Choice *)widget)->value(menu+index);
1512}
1513
1514void FltkOptionMenuResource::pushGroup (const char *name, bool enabled)
1515{
1516 Fl_Menu_Item *item = newItem();
1517
1518 item->text = dStrdup(name);
1519
1520 if (enabled == false)
1521 item->flags = FL_MENU_INACTIVE;
1522
1523 item->flags |= FL_SUBMENU;
1524
1525 queueResize (true);
1526}
1527
1529{
1530 /* Item with NULL text field closes the submenu */
1531 newItem();
1532 queueResize (true);
1533}
1534
1536{
1537 return index == ((Fl_Choice *)widget)->value();
1538}
1539
1541{
1542 return ((Fl_Choice*)widget)->size();
1543}
1544
1545// ----------------------------------------------------------------------
1546
1547class CustBrowser : public Fl_Browser {
1548public:
1549 CustBrowser(int x, int y, int w, int h) : Fl_Browser(x, y, w, h) {};
1550 int full_width() const;
1551 int full_height() const {return Fl_Browser::full_height();}
1552 int avg_height() {return size() ? Fl_Browser_::incr_height() : 0;}
1553};
1554
1555/*
1556 * Fl_Browser_ has a full_width(), but it has a tendency to contain 0, so...
1557 */
1558int CustBrowser::full_width() const
1559{
1560 int max = 0;
1561 void *item = item_first();
1562
1563 while (item) {
1564 int w = item_width(item);
1565
1566 if (w > max)
1567 max = w;
1568
1569 item = item_next(item);
1570 }
1571 return max;
1572}
1573
1576 selectionMode, int rowCount):
1577 FltkSelectionResource <dw::core::ui::ListResource> (platform),
1578 currDepth(0)
1579{
1580 mode = selectionMode;
1581 showRows = rowCount;
1582 init (platform);
1583}
1584
1588
1589
1591{
1592 CustBrowser *b =
1593 new CustBrowser (allocation->x, allocation->y, allocation->width,
1595
1596 b->type((mode == SELECTION_MULTIPLE) ? FL_MULTI_BROWSER : FL_HOLD_BROWSER);
1597 b->callback(widgetCallback, this);
1598 b->when(FL_WHEN_CHANGED);
1599 b->column_widths(colWidths);
1600 b->column_char('\a'); // I just chose a nonprinting character.
1601
1602 return b;
1603}
1604
1605void FltkListResource::setWidgetStyle (Fl_Widget *widget,
1606 core::style::Style *style)
1607{
1608 Fl_Browser *b = (Fl_Browser *)widget;
1609
1611
1612 b->textfont(widget->labelfont());
1613 b->textsize(widget->labelsize());
1614 b->textcolor(widget->labelcolor());
1615
1616 colWidths[0] = b->textsize();
1617 colWidths[1] = colWidths[0];
1618 colWidths[2] = colWidths[0];
1619 colWidths[3] = 0;
1620}
1621
1622void FltkListResource::widgetCallback (Fl_Widget *widget, void *data)
1623{
1624 Fl_Browser *b = (Fl_Browser *) widget;
1625
1626 if (b->selected(b->value())) {
1627 /* If it shouldn't be selectable, deselect it again. It would be nice to
1628 * have a less unpleasant way to do this.
1629 */
1630 const char *inactive_code;
1631 if ((inactive_code = strstr(b->text(b->value()), "@N"))) {
1632 const char *ignore_codes = strstr(b->text(b->value()), "@.");
1633
1634 if (inactive_code < ignore_codes)
1635 b->select(b->value(), 0);
1636 }
1637 }
1638}
1639
1640void *FltkListResource::newItem (const char *str, bool enabled, bool selected)
1641{
1642 Fl_Browser *b = (Fl_Browser *) widget;
1643 int index = b->size() + 1;
1644 char *label = (char *)malloc(strlen(str) + 1 + currDepth + 4),
1645 *s = label;
1646
1647 memset(s, '\a', currDepth);
1648 s += currDepth;
1649 if (!enabled) {
1650 // FL_INACTIVE_COLOR
1651 *s++ = '@';
1652 *s++ = 'N';
1653 }
1654 // ignore further '@' chars
1655 *s++ = '@';
1656 *s++ = '.';
1657
1658 strcpy(s, str);
1659
1660 b->add(label);
1661 free(label);
1662
1663 if (selected) {
1664 b->select(index, selected);
1665 if (b->type() == FL_HOLD_BROWSER) {
1666 /* Left to its own devices, it sometimes has some suboptimal ideas
1667 * about how to scroll, and sometimes doesn't seem to show everything
1668 * where it thinks it is.
1669 */
1670 if (index > showRows) {
1671 /* bottomline() and middleline() don't work because the widget is
1672 * too tiny at this point for the bbox() call in
1673 * Fl_Browser::lineposition() to do what one would want.
1674 */
1675 b->topline(index - showRows + 1);
1676 } else {
1677 b->topline(1);
1678 }
1679 }
1680 }
1681 queueResize (true);
1682 return NULL;
1683}
1684
1685void FltkListResource::addItem (const char *str, bool enabled, bool selected)
1686{
1687 // Fl_Browser_::incr_height() for item height won't do the right thing if
1688 // the first item doesn't have anything to it.
1689 if (!str || !*str)
1690 str = " ";
1691 newItem(str, enabled, selected);
1692}
1693
1694void FltkListResource::setItem (int index, bool selected)
1695{
1696 Fl_Browser *b = (Fl_Browser *) widget;
1697
1698 b->select(index + 1, selected);
1699}
1700
1701void FltkListResource::pushGroup (const char *name, bool enabled)
1702{
1703 bool en = false;
1704 bool selected = false;
1705
1706 // Fl_Browser_::incr_height() for item height won't do the right thing if
1707 // the first item doesn't have anything to it.
1708 if (!name || !*name)
1709 name = " ";
1710
1711 // TODO: Proper disabling of item groups
1712 newItem(name, en, selected);
1713
1714 if (currDepth < 3)
1715 currDepth++;
1716}
1717
1719{
1720 CustBrowser *b = (CustBrowser *) widget;
1721
1722 newItem(" ", false, false);
1723 b->hide(b->size());
1724
1725 if (currDepth)
1726 currDepth--;
1727}
1728
1730{
1731 return ((CustBrowser *) widget)->full_width();
1732}
1733
1735{
1736 DBG_OBJ_ENTER0 ("resize", 0, "sizeRequest");
1737
1738 if (style) {
1739 CustBrowser *b = (CustBrowser *) widget;
1740 int height = b->full_height();
1741 requisition->width = getMaxItemWidth() + 4;
1742
1743 if (showRows * b->avg_height() < height) {
1744 height = showRows * b->avg_height();
1745 b->has_scrollbar(Fl_Browser_::VERTICAL_ALWAYS);
1746 requisition->width += Fl::scrollbar_size();
1747 } else {
1748 b->has_scrollbar(0);
1749 }
1750
1751 requisition->descent = style->font->descent + 2;
1752 requisition->ascent = height - style->font->descent + 2;
1753 } else {
1754 requisition->width = 1;
1755 requisition->ascent = 1;
1756 requisition->descent = 0;
1757 }
1758
1759 DBG_OBJ_MSGF ("resize", 1, "result: %d * (%d + %d)",
1760 requisition->width, requisition->ascent, requisition->descent);
1761 DBG_OBJ_LEAVE ();
1762}
1763
1765{
1766 return ((Fl_Browser*)widget)->size();
1767}
1768
1770{
1771 Fl_Browser *b = (Fl_Browser *) widget;
1772
1773 return b->selected(index + 1) ? true : false;
1774}
1775
1776} // namespace ui
1777} // namespace fltk
1778} // namespace dw
1779
#define _MSG(...)
Definition bookmarks.c:45
Set at the top when drawing.
Definition types.hh:295
This implementation of dw::core::Iterator can be used by widgets with no contents.
Definition iterator.hh:97
Represents a button press or release event.
Definition events.hh:58
Iterators are used to iterate through the contents of a widget.
Definition iterator.hh:20
The central class for managing and drawing a widget tree.
Definition layout.hh:37
void attachView(View *view)
Attach a view to the layout.
Definition layout.cc:459
An interface to encapsulate some platform dependencies.
Definition platform.hh:37
dw::core::Shape implementation for simple rectangles.
Definition types.hh:70
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
The base class of all dillo widgets.
Definition widget.hh:44
void emitClicked(EventButton *event)
Definition ui.hh:353
void queueResize(bool extremesChanged)
Definition ui.hh:344
int colors[SHADING_NUM]
void attachResource(ui::FltkResource *resource)
void detachResource(ui::FltkResource *resource)
This interface adds some more methods for all flkt-based views.
virtual void drawFltkWidget(Fl_Widget *widget, core::Rectangle *area)
virtual void removeFltkWidget(Fl_Widget *widget)
virtual void addFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
virtual void allocateFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
virtual bool usesFltkWidgets()=0
FltkCheckButtonResource(FltkPlatform *platform, bool activated)
Definition fltkui.cc:1221
Fl_Button * createNewButton(core::Allocation *allocation)
Definition fltkui.cc:1235
FltkComplexButtonResource(FltkPlatform *platform, dw::core::Widget *widget, bool relief)
Definition fltkui.cc:730
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:839
void setLayout(dw::core::Layout *layout)
Definition fltkui.cc:823
dw::core::Platform * createPlatform()
Definition fltkui.cc:782
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:745
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:800
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:913
void setMaxLength(int maxlen)
Definition fltkui.cc:1014
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:939
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:965
void setDisplayed(bool displayed)
Definition fltkui.cc:933
void setEditable(bool editable)
Definition fltkui.cc:1009
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:985
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:891
FltkEntryResource(FltkPlatform *platform, int size, bool password, const char *label, const char *placeholder)
Definition fltkui.cc:864
void setText(const char *text)
Definition fltkui.cc:995
FltkLabelButtonResource(FltkPlatform *platform, const char *label)
Definition fltkui.cc:626
void setLabel(const char *label)
Definition fltkui.cc:719
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:639
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:650
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:702
ListResource::SelectionMode mode
Definition fltkui.hh:517
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1605
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1590
void * newItem(const char *str, bool enabled, bool selected)
Definition fltkui.cc:1640
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:1622
void pushGroup(const char *name, bool enabled)
Definition fltkui.cc:1701
void setItem(int index, bool selected)
Definition fltkui.cc:1694
void addItem(const char *str, bool enabled, bool selected)
Definition fltkui.cc:1685
FltkListResource(FltkPlatform *platform, core::ui::ListResource::SelectionMode selectionMode, int rows)
Definition fltkui.cc:1574
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1734
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1096
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1068
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1083
FltkMultiLineTextResource(FltkPlatform *platform, int cols, int rows, const char *placeholder)
Definition fltkui.cc:1035
void pushGroup(const char *name, bool enabled)
Definition fltkui.cc:1514
void addItem(const char *str, bool enabled, bool selected)
Definition fltkui.cc:1492
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:1417
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1394
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1439
FltkOptionMenuResource(FltkPlatform *platform)
Definition fltkui.cc:1370
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1406
void setItem(int index, bool selected)
Definition fltkui.cc:1508
lout::container::typed::Iterator< FltkRadioButtonResource > it
Definition fltkui.hh:404
lout::container::typed::List< FltkRadioButtonResource > * list
Definition fltkui.hh:417
lout::container::typed::Iterator< FltkRadioButtonResource > iterator()
Definition fltkui.hh:426
Group(FltkRadioButtonResource *radioButtonResource)
Definition fltkui.cc:1263
void unconnect(FltkRadioButtonResource *radioButtonResource)
Definition fltkui.cc:1281
dw::core::ui::RadioButtonResource::GroupIterator * groupIterator()
Definition fltkui.hh:432
void connect(FltkRadioButtonResource *radioButtonResource)
Definition fltkui.cc:1275
FltkRadioButtonResource(FltkPlatform *platform, FltkRadioButtonResource *groupedWith, bool activated)
Definition fltkui.cc:1290
Fl_Button * createNewButton(core::Allocation *allocation)
Definition fltkui.cc:1334
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:1318
virtual void detachView(FltkView *view)
Definition fltkui.cc:461
void setDisplayed(bool displayed)
Definition fltkui.cc:525
FltkPlatform * platform
Definition fltkui.hh:196
void init(FltkPlatform *platform)
This is not a constructor, since it calls some virtual methods, which should not be done in a C++ bas...
Definition fltkui.cc:422
void setEnabled(bool enabled)
Definition fltkui.cc:550
void setStyle(core::style::Style *style)
Definition fltkui.cc:490
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:469
virtual void attachView(FltkView *view)
Definition fltkui.cc:444
FltkResource(FltkPlatform *platform)
Definition fltkui.cc:401
core::style::Style * style
Definition fltkui.hh:198
virtual void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:501
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
Definition fltkui.cc:481
core::Allocation allocation
Definition fltkui.hh:195
virtual Fl_Widget * createNewWidget(core::Allocation *allocation)=0
dw::core::Iterator * iterator(dw::core::Content::Type mask, bool atEnd)
Definition fltkui.cc:1362
void setStyle(core::style::Style *style)
Definition fltkui.cc:590
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
Definition fltkui.cc:582
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:576
void setEnabled(bool enabled)
Definition fltkui.cc:601
FltkSpecificResource(FltkPlatform *platform)
Definition fltkui.cc:562
FltkToggleButtonResource(FltkPlatform *platform, bool activated)
Definition fltkui.cc:1147
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1181
void setActivated(bool activated)
Definition fltkui.cc:1213
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1171
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1162
#define DBG_OBJ_ENTER0(aspect, prio, funname)
#define DBG_OBJ_DELETE()
#define DBG_OBJ_CREATE(klass)
#define DBG_OBJ_MSGF(aspect, prio, fmt,...)
#define DBG_OBJ_SET_NUM(var, val)
#define DBG_OBJ_MSGF_O(aspect, prio, obj, fmt,...)
#define DBG_OBJ_ENTER(aspect, prio, funname, fmt,...)
#define DBG_OBJ_LEAVE()
#define DBG_OBJ_BASECLASS(klass)
char * dStrdup(const char *s)
Definition dlib.c:77
#define MSG_ERR(...)
Definition dpid_common.h:23
static Layout * layout
static FltkPlatform * platform
static Fl_Color fltkui_dimmed(Fl_Color c, Fl_Color bg)
Definition fltkui.cc:43
#define MSG_WARN(...)
Definition msg.h:26
#define I(x, y, z)
ButtonState
Platform independent representation.
Definition events.hh:15
@ SHIFT_MASK
Definition events.hh:17
@ BUTTON3_MASK
Definition events.hh:22
@ META_MASK
Definition events.hh:19
@ BUTTON1_MASK
Definition events.hh:20
@ CONTROL_MASK
Definition events.hh:18
@ BUTTON2_MASK
Definition events.hh:21
@ RELIEF_Y_THICKNESS
Definition fltkui.cc:396
@ RELIEF_X_THICKNESS
Definition fltkui.cc:396
static int kf_backspace_word(int c, Fl_Text_Editor *e)
Definition fltkui.cc:1021
static void setButtonEvent(dw::core::EventButton *event)
Definition fltkui.cc:693
static core::ButtonState getDwButtonState()
Definition fltkui.cc:678
Dw is in this namespace, or sub namespaces of this one.
This namespace provides thin wrappers, implemented as C++ templates, to gain type-safety.
Definition container.hh:387
T max(T a, T b)
Definition misc.hh:41
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
Definition object.cc:31
Represents the allocation, i.e.
Definition types.hh:164