Dillo v3.1.1-111-gd4f56d0d
Loading...
Searching...
No Matches
layout.cc
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2024 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 "core.hh"
24
25#include "dlib/dlib.h"
26#include "../lout/msg.h"
27#include "../lout/debug.hh"
28#include "../lout/misc.hh"
29
30using namespace lout;
31using namespace lout::container;
32using namespace lout::object;
33
34namespace dw {
35namespace core {
36
38{
39 return true;
40}
41
42void Layout::LayoutImgRenderer::getBgArea (int *x, int *y, int *width,
43 int *height)
44{
45 // TODO Actually not padding area, but visible area?
46 getRefArea (x, y, width, height);
47}
48
49void Layout::LayoutImgRenderer::getRefArea (int *xRef, int *yRef, int *widthRef,
50 int *heightRef)
51{
52 *xRef = 0;
53 *yRef = 0;
54 *widthRef = misc::max (layout->viewportWidth
55 - (layout->canvasHeightGreater ?
56 layout->vScrollbarThickness : 0),
57 layout->canvasWidth);
58 *heightRef = misc::max (layout->viewportHeight
59 - layout->hScrollbarThickness,
60 layout->canvasAscent + layout->canvasDescent);
61}
62
67
72
78
83
88
89void Layout::LayoutImgRenderer::draw (int x, int y, int width, int height)
90{
91 layout->queueDraw (x, y, width, height);
92}
93
94// ----------------------------------------------------------------------
95
96void Layout::Receiver::resizeQueued (bool extremesChanged)
97{
98}
99
100void Layout::Receiver::canvasSizeChanged (int width, int ascent, int descent)
101{
102}
103
104// ----------------------------------------------------------------------
105
107 int signalNo, int argc,
109{
110 Receiver *layoutReceiver = (Receiver*)receiver;
111
112 switch (signalNo) {
113 case CANVAS_SIZE_CHANGED:
114 layoutReceiver->canvasSizeChanged (((Integer*)argv[0])->getValue (),
115 ((Integer*)argv[1])->getValue (),
116 ((Integer*)argv[2])->getValue ());
117 break;
118
119 case RESIZE_QUEUED:
120 layoutReceiver->resizeQueued (((Boolean*)argv[0])->getValue ());
121 break;
122
123 default:
125 }
126
127 return false;
128}
129
130void Layout::Emitter::emitResizeQueued (bool extremesChanged)
131{
132 Boolean ec (extremesChanged);
133 Object *argv[1] = { &ec };
134 emitVoid (RESIZE_QUEUED, 1, argv);
135}
136
138 int ascent, int descent)
139{
140 Integer w (width), a (ascent), d (descent);
141 Object *argv[3] = { &w, &a, &d };
142 emitVoid (CANVAS_SIZE_CHANGED, 3, argv);
143}
144
145// ----------------------------------------------------------------------
146
147bool Layout::LinkReceiver::enter (Widget *widget, int link, int img,
148 int x, int y)
149{
150 return false;
151}
152
153bool Layout::LinkReceiver::press (Widget *widget, int link, int img,
154 int x, int y, EventButton *event)
155{
156 return false;
157}
158
159bool Layout::LinkReceiver::release (Widget *widget, int link, int img,
160 int x, int y, EventButton *event)
161{
162 return false;
163}
164
165bool Layout::LinkReceiver::click (Widget *widget, int link, int img,
166 int x, int y, EventButton *event)
167{
168 return false;
169}
170
171// ----------------------------------------------------------------------
172
174 int signalNo, int argc,
176{
177 LinkReceiver *linkReceiver = (LinkReceiver*)receiver;
178
179 switch (signalNo) {
180 case ENTER:
181 return linkReceiver->enter ((Widget*)argv[0],
182 ((Integer*)argv[1])->getValue (),
183 ((Integer*)argv[2])->getValue (),
184 ((Integer*)argv[3])->getValue (),
185 ((Integer*)argv[4])->getValue ());
186
187 case PRESS:
188 return linkReceiver->press ((Widget*)argv[0],
189 ((Integer*)argv[1])->getValue (),
190 ((Integer*)argv[2])->getValue (),
191 ((Integer*)argv[3])->getValue (),
192 ((Integer*)argv[4])->getValue (),
193 (EventButton*)argv[5]);
194
195 case RELEASE:
196 return linkReceiver->release ((Widget*)argv[0],
197 ((Integer*)argv[1])->getValue (),
198 ((Integer*)argv[2])->getValue (),
199 ((Integer*)argv[3])->getValue (),
200 ((Integer*)argv[4])->getValue (),
201 (EventButton*)argv[5]);
202
203 case CLICK:
204 return linkReceiver->click ((Widget*)argv[0],
205 ((Integer*)argv[1])->getValue (),
206 ((Integer*)argv[2])->getValue (),
207 ((Integer*)argv[3])->getValue (),
208 ((Integer*)argv[4])->getValue (),
209 (EventButton*)argv[5]);
210
211 default:
213 }
214 return false;
215}
216
217bool Layout::LinkEmitter::emitEnter (Widget *widget, int link, int img,
218 int x, int y)
219{
220 Integer ilink (link), iimg (img), ix (x), iy (y);
221 Object *argv[5] = { widget, &ilink, &iimg, &ix, &iy };
222 return emitBool (ENTER, 5, argv);
223}
224
225bool Layout::LinkEmitter::emitPress (Widget *widget, int link, int img,
226 int x, int y, EventButton *event)
227{
228 Integer ilink (link), iimg (img), ix (x), iy (y);
229 Object *argv[6] = { widget, &ilink, &iimg, &ix, &iy, event };
230 return emitBool (PRESS, 6, argv);
231}
232
233bool Layout::LinkEmitter::emitRelease (Widget *widget, int link, int img,
234 int x, int y, EventButton *event)
235{
236 Integer ilink (link), iimg (img), ix (x), iy (y);
237 Object *argv[6] = { widget, &ilink, &iimg, &ix, &iy, event };
238 return emitBool (RELEASE, 6, argv);
239}
240
241bool Layout::LinkEmitter::emitClick (Widget *widget, int link, int img,
242 int x, int y, EventButton *event)
243{
244 Integer ilink (link), iimg (img), ix (x), iy (y);
245 Object *argv[6] = { widget, &ilink, &iimg, &ix, &iy, event };
246 return emitBool (CLICK, 6, argv);
247}
248
249// ---------------------------------------------------------------------
250
252{
253 free(name);
254}
255
256// ---------------------------------------------------------------------
257
259{
260 this->platform = platform;
261 view = NULL;
262 topLevel = NULL;
263 widgetAtPoint = NULL;
264
265 queueResizeList = new typed::Vector<Widget> (4, false);
266
267 DBG_OBJ_CREATE ("dw::core::Layout");
268
269 bgColor = NULL;
270 bgImage = NULL;
272
274
275 usesViewport = false;
276 drawAfterScrollReq = false;
277 scrollX = scrollY = 0;
280
281 DBG_OBJ_SET_NUM ("viewportWidth", viewportWidth);
282 DBG_OBJ_SET_NUM ("viewportHeight", viewportHeight);
283 DBG_OBJ_SET_NUM ("hScrollbarThickness", hScrollbarThickness);
284 DBG_OBJ_SET_NUM ("vScrollbarThickness", vScrollbarThickness);
285
286 requestedAnchor = NULL;
287 scrollIdleId = -1;
289
291 new container::typed::HashTable <object::String, Anchor> (true, true);
292
293 resizeIdleId = -1;
294
295 textZone = new misc::ZoneAllocator (16 * 1024);
296
299
300 platform->setLayout (this);
301
303
306
307 layoutImgRenderer = NULL;
308
311 resizeLimit = limit;
312}
313
315{
316 widgetAtPoint = NULL;
317
318 if (layoutImgRenderer) {
319 if (bgImage)
321 delete layoutImgRenderer;
322 }
323
324 if (scrollIdleId != -1)
326 if (resizeIdleId != -1)
328 if (bgColor)
329 bgColor->unref ();
330 if (bgImage)
331 bgImage->unref ();
332 if (topLevel) {
334 Widget *w = topLevel;
335 topLevel = NULL;
336 delete w;
337 }
338
339 delete queueResizeList;
340 delete platform;
341 delete view;
342 delete anchorsTable;
343 delete textZone;
344
345 if (requestedAnchor)
346 free (requestedAnchor);
347
349}
350
352{
353 // Called form ~Layout. Sometimes, the widgets (not only the toplevel widget)
354 // do some stuff after the layout has been deleted, so *all* widgets have to
355 // be detached, and check "layout != NULL" at relevant points.
356
357 // Could be replaced by a virtual method in Widget, like getWidgetAtPoint,
358 // if performace were really a problem.
359
360 widget->layout = NULL;
361 Iterator *it =
362 widget->iterator ((Content::Type)
364 false);
365 while (it->next ())
367
368 it->unref ();
369}
370
372{
373 if (topLevel) {
374 MSG_WARN("widget already set\n");
375 return;
376 }
377
378 // The toplevel widget always establishes a stacking context. It could
379 // already be set in Widget::setStyle().
380 if (widget->stackingContextMgr == NULL && IMPL_POS) {
381 widget->stackingContextMgr = new StackingContextMgr (widget);
382 DBG_OBJ_ASSOC (widget, widget->stackingContextMgr);
383 widget->stackingContextWidget = widget;
384 }
385
386 topLevel = widget;
387 widget->layout = this;
388 widget->container = NULL;
389 DBG_OBJ_SET_PTR_O (widget, "container", widget->container);
390
391 queueResizeList->clear ();
392 widget->notifySetAsTopLevel ();
393
394 findtextState.setWidget (widget);
395
396 canvasHeightGreater = false;
397 DBG_OBJ_SET_SYM ("canvasHeightGreater",
398 canvasHeightGreater ? "true" : "false");
399
400 // Do not directly call Layout::queueResize(), but
401 // Widget::queueResize(), so that all flags are set properly,
402 // queueResizeList is filled, etc.
403 topLevel->queueResize (-1, false);
404}
405
432
434{
435 DBG_OBJ_ASSOC_CHILD (widget);
436
437 widgetAtPoint = NULL;
438 if (topLevel) {
439 Widget *w = topLevel;
440 topLevel = NULL;
441 delete w;
442 }
443 textZone->zoneFree ();
444 addWidget (widget);
445
446 updateCursor ();
447
448 /* Reset the resizeCounter when we change the top level widget, as we are
449 * changing to another page */
450 resizeCounter = 0;
451}
452
460{
461 if (this->view)
462 MSG_ERR("attachView: Multiple views for layout!\n");
463
465
466 this->view = view;
468
469 /*
470 * The layout of the view is set later, first, we "project" the current
471 * state of the layout into the new view. A view must handle this without
472 * a layout. See also at the end of this function.
473 */
474 if (bgColor)
478
479 if (view->usesViewport ()) {
480 if (usesViewport) {
488 }
489 else {
490 usesViewport = true;
491 scrollX = scrollY = 0;
492 viewportWidth = viewportHeight = 100; // random values
495 }
496
497 DBG_OBJ_SET_NUM ("viewportWidth", viewportWidth);
498 DBG_OBJ_SET_NUM ("viewportHeight", viewportHeight);
499 DBG_OBJ_SET_NUM ("hScrollbarThickness", hScrollbarThickness);
500 DBG_OBJ_SET_NUM ("vScrollbarThickness", vScrollbarThickness);
501 }
502
503 /*
504 * This is the last call within this function, so that it is safe for
505 * the implementation of dw::core::View::setLayout, to call methods
506 * of dw::core::Layout.
507 */
508 view->setLayout (this);
509}
510
512{
513 if (this->view != view) {
514 MSG_ERR("detachView: this->view: %p view %p\n",
515 (void *) this->view, (void *) view);
516 }
517
518 view->setLayout (NULL);
520 this->view = NULL;
527}
528
530{
531 if (view->usesViewport ())
532 view->scroll(cmd);
533}
534
540 int x, int y, int width, int height)
541{
542 scrollTo0 (hpos, vpos, x, y, width, height, true);
543}
544
546 int x, int y, int width, int height,
547 bool scrollingInterrupted)
548{
549 if (usesViewport) {
550 _MSG("scrollTo (%d, %d, %s)\n",
551 x, y, scrollingInterrupted ? "true" : "false");
552
553 scrollTargetHpos = hpos;
554 scrollTargetVpos = vpos;
555 scrollTargetX = x;
556 scrollTargetY = y;
557 scrollTargetWidth = width;
558 scrollTargetHeight = height;
559
560 if (scrollIdleId == -1) {
563 }
564
566 scrollIdleNotInterrupted || !scrollingInterrupted;
567 }
568}
569
571{
572 bool xChanged = true;
573 switch (scrollTargetHpos) {
574 case HPOS_LEFT:
576 break;
577 case HPOS_CENTER:
578 scrollX =
581 break;
582 case HPOS_RIGHT:
583 scrollX =
586 break;
587 case HPOS_INTO_VIEW:
590 break;
591 case HPOS_NO_CHANGE:
592 xChanged = false;
593 break;
594 }
595
596 bool yChanged = true;
597 switch (scrollTargetVpos) {
598 case VPOS_TOP:
600 break;
601 case VPOS_CENTER:
602 scrollY =
605 break;
606 case VPOS_BOTTOM:
607 scrollY =
610 break;
611 case VPOS_INTO_VIEW:
614 break;
615 case VPOS_NO_CHANGE:
616 yChanged = false;
617 break;
618 }
619
620 if (xChanged || yChanged) {
623 if (drawAfterScrollReq) {
624 drawAfterScrollReq = false;
626 }
627 }
628
629 scrollIdleId = -1;
630}
631
633{
637
641
642 _MSG("adjustScrollPos: scrollX=%d scrollY=%d\n", scrollX, scrollY);
643}
644
645bool Layout::calcScrollInto (int requestedValue, int requestedSize,
646 int *value, int viewportSize)
647{
648 if (requestedSize > viewportSize) {
649 // The viewport size is smaller than the size of the region which will
650 // be shown. If the region is already visible, do not change the
651 // position. Otherwise, show the left/upper border, this is most likely
652 // what is needed.
653 if (*value >= requestedValue &&
654 *value + viewportSize < requestedValue + requestedSize)
655 return false;
656 else
657 requestedSize = viewportSize;
658 }
659
660 if (requestedValue < *value) {
661 *value = requestedValue;
662 return true;
663 } else if (requestedValue + requestedSize > *value + viewportSize) {
664 *value = requestedValue - viewportSize + requestedSize;
665 return true;
666 } else
667 return false;
668}
669
671{
672 DBG_OBJ_ENTER ("draw", 0, "draw", "%d, %d, %d * %d",
673 area->x, area->y, area->width, area->height);
674
675 Rectangle widgetArea, intersection, widgetDrawArea;
676
677 // First of all, draw background image. (Unlike background *color*,
678 // this is not a feature of the views.)
679 if (bgImage != NULL && bgImage->getImgbufSrc() != NULL)
682 area->x, area->y, area->width,
683 area->height, 0, 0,
684 // Reference area: maximum of canvas size and
685 // viewport size.
693
694 if (scrollIdleId != -1) {
695 /* scroll is pending, defer draw until after scrollIdle() */
696 drawAfterScrollReq = true;
697
698 } else if (topLevel) {
699 /* Draw the top level widget. */
700 widgetArea.x = topLevel->allocation.x;
701 widgetArea.y = topLevel->allocation.y;
702 widgetArea.width = topLevel->allocation.width;
703 widgetArea.height = topLevel->getHeight ();
704
705 if (area->intersectsWith (&widgetArea, &intersection)) {
706 view->startDrawing (&intersection);
707
708 /* Intersection in widget coordinates. */
709 widgetDrawArea.x = intersection.x - topLevel->allocation.x;
710 widgetDrawArea.y = intersection.y - topLevel->allocation.y;
711 widgetDrawArea.width = intersection.width;
712 widgetDrawArea.height = intersection.height;
713
714 DrawingContext context (&widgetArea);
715 topLevel->draw (view, &widgetDrawArea, &context);
716
717 view->finishDrawing (&intersection);
718 }
719 }
720
721 DBG_OBJ_LEAVE ();
722}
723
728
734
738void Layout::setAnchor (const char *anchor)
739{
740 _MSG("setAnchor (%s)\n", anchor);
741
742 if (requestedAnchor)
743 free (requestedAnchor);
744 requestedAnchor = anchor ? dStrdup (anchor) : NULL;
745 updateAnchor ();
746}
747
751char *Layout::addAnchor (Widget *widget, const char* name)
752{
753 return addAnchor (widget, name, -1);
754}
755
756char *Layout::addAnchor (Widget *widget, const char* name, int y)
757{
758 String key (name);
759 if (anchorsTable->contains (&key))
760 return NULL;
761 else {
762 Anchor *anchor = new Anchor ();
763 anchor->name = dStrdup (name);
764 anchor->widget = widget;
765 anchor->y = y;
766
767 anchorsTable->put (new String (name), anchor);
768 updateAnchor ();
769
770 return anchor->name;
771 }
772}
773
774void Layout::changeAnchor (Widget *widget, char* name, int y)
775{
776 String key (name);
777 Anchor *anchor = anchorsTable->get (&key);
778 assert (anchor);
779 assert (anchor->widget == widget);
780 anchor->y = y;
781 updateAnchor ();
782}
783
784void Layout::removeAnchor (Widget *widget, char* name)
785{
786 String key (name);
787 anchorsTable->remove (&key);
788}
789
791{
792 Anchor *anchor;
793 if (requestedAnchor) {
795 anchor = anchorsTable->get (&key);
796 } else
797 anchor = NULL;
798
799 if (anchor == NULL) {
803 scrollIdleId = -1;
804 }
805 } else
806 if (anchor->y != -1)
807 scrollTo0 (HPOS_NO_CHANGE, VPOS_TOP, 0, anchor->y, 0, 0, false);
808}
809
811{
812 if (cursor != this->cursor) {
813 this->cursor = cursor;
815 }
816}
817
825
827{
828 color->ref ();
829
830 if (bgColor)
831 bgColor->unref ();
832
833 bgColor = color;
834
835 if (view)
837}
838
843{
844 if (layoutImgRenderer && this->bgImage)
846
847 if (bgImage)
848 bgImage->ref ();
849
850 if (this->bgImage)
851 this->bgImage->unref ();
852
853 this->bgImage = bgImage;
854 this->bgRepeat = bgRepeat;
855 this->bgAttachment = bgAttachment;
856 this->bgPositionX = bgPositionX;
857 this->bgPositionY = bgPositionY;
858
859 if (bgImage) {
860 // Create instance of LayoutImgRenderer when needed. Until this
861 // layout is deleted, "layoutImgRenderer" will be kept, since it
862 // is not specific to the style, but only to this layout.
863 if (layoutImgRenderer == NULL)
866 }
867}
868
869
871{
872 DBG_OBJ_ENTER0 ("resize", 0, "resizeIdle");
873
875
876 // There are two commits, 2863:b749629fbfc9 and 4645:ab70f9ce4353, the second
877 // reverting the former. Interrestingly, the second fixes a bug. However, it
878 // should still examined what happens here, and what happens the other calls
879 // to Layout::resizeIdle() which should be still in the queue. (See
880 // Layout::queueResize(), where resizeIdleId is indeed checked.)
881
882 for (int i = 0; resizeIdleId != -1; i++) {
883
884 /* Prevent infinite resize loop, if we reach this point it is very likely
885 * there is a bug in the layouting process */
886 if (resizeLimit && resizeCounter >= 1000) {
887 MSG_ERR("Emergency layout stop after %d iterations\n", resizeCounter);
888 MSG_ERR("Please file a bug report with the complete console output\n");
889 resizeIdleId = -1;
890 break;
891 }
892
893 /* Only allow 100 iterations before returning to redraw the screen. */
894 if (i >= 100) {
895 MSG_WARN("Stopping layout loop after %d iterations\n", resizeCounter);
896 break;
897 }
898
900
901 for (typed::Iterator <Widget> it = queueResizeList->iterator();
902 it.hasNext (); ) {
903 Widget *widget = it.getNext ();
904
905 if (widget->resizeQueued ()) {
908 }
909
910 if (widget->allocateQueued ()) {
913 }
914
915 if (widget->extremesQueued ()) {
918 }
919 }
920 queueResizeList->clear ();
921
922 // Reset here, since below, queueResize() may be called again.
923 resizeIdleId = -1;
924
925 // If this method is triggered by a viewport change, we can save
926 // time when the toplevel widget is not affected (as for a toplevel
927 // image resource).
928 if (topLevel &&
930 Requisition requisition;
931 Allocation allocation;
932
933 topLevel->sizeRequest (&requisition);
934 DBG_OBJ_MSGF ("resize", 1, "toplevel size: %d * (%d + %d)",
935 requisition.width, requisition.ascent,
936 requisition.descent);
937
938 // This method is triggered by Widget::queueResize, which will,
939 // in any case, set NEEDS_ALLOCATE (indirectly, as ALLOCATE_QUEUED).
940 // This assertion helps to find inconsistencies. (Cases where
941 // this method is triggered by a viewport change, but the
942 // toplevel widget is not affected, are filtered out some lines
943 // above: "if (topLevel && topLevel->needsResize ())".)
944 assert (topLevel->needsAllocate ());
945
946 allocation.x = allocation.y = 0;
948 allocation.x += currVScrollbarThickness();
949 allocation.width = requisition.width;
950 allocation.ascent = requisition.ascent;
951 allocation.descent = requisition.descent;
952 topLevel->sizeAllocate (&allocation);
953
954 canvasWidth = requisition.width;
955 canvasAscent = requisition.ascent;
956 canvasDescent = requisition.descent;
959 // Tell the view about the new world size.
961
962 if (usesViewport) {
963 int currHThickness = currHScrollbarThickness();
964 int currVThickness = currVScrollbarThickness();
965
966 if (!canvasHeightGreater &&
967 canvasAscent + canvasDescent > viewportHeight - currHThickness) {
968 canvasHeightGreater = true;
969 DBG_OBJ_SET_SYM ("canvasHeightGreater",
970 canvasHeightGreater ? "true" : "false");
972 }
973
974 // Set viewport sizes.
976 currHThickness, currVThickness);
977 }
978
979 // views are redrawn via Widget::resizeDrawImpl ()
980 }
981 }
982 updateAnchor ();
983
984 DBG_OBJ_MSGF ("resize", 1,
985 "after resizeIdle: resizeIdleId = %d", resizeIdleId);
986 DBG_OBJ_LEAVE ();
987
989}
990
991void Layout::queueDraw (int x, int y, int width, int height)
992{
993 Rectangle area;
994 area.x = x;
995 area.y = y;
996 area.width = width;
997 area.height = height;
998
999 if (area.isEmpty ()) return;
1000
1001 view->queueDraw (&area);
1002}
1003
1004void Layout::queueDrawExcept (int x, int y, int width, int height,
1005 int ex, int ey, int ewidth, int eheight) {
1006
1007 if (x == ex && y == ey && width == ewidth && height == eheight)
1008 return;
1009
1010 // queueDraw() the four rectangles within rectangle (x, y, width, height)
1011 // around rectangle (ex, ey, ewidth, eheight).
1012 // Some or all of these may be empty.
1013
1014 // upper left corner of the intersection rectangle
1015 int ix1 = misc::max (x, ex);
1016 int iy1 = misc::max (y, ey);
1017 // lower right corner of the intersection rectangle
1018 int ix2 = misc::min (x + width, ex + ewidth);
1019 int iy2 = misc::min (y + height, ey + eheight);
1020
1021 queueDraw (x, y, width, iy1 - y);
1022 queueDraw (x, iy2, width, y + height - iy2);
1023 queueDraw (x, iy1, ix1 - x, iy2 - iy1);
1024 queueDraw (ix2, iy1, x + width - ix2, iy2 - iy1);
1025}
1026
1027void Layout::queueResize (bool extremesChanged)
1028{
1029 DBG_OBJ_ENTER ("resize", 0, "queueResize", "%s",
1030 extremesChanged ? "true" : "false");
1031
1032 if (resizeIdleId == -1) {
1034
1036 DBG_OBJ_MSGF ("resize", 1, "setting resizeIdleId = %d", resizeIdleId);
1037 }
1038
1039 emitter.emitResizeQueued (extremesChanged);
1040
1041 DBG_OBJ_LEAVE ();
1042}
1043
1044
1045// Views
1046
1047bool Layout::buttonEvent (ButtonEventType type, View *view, int numPressed,
1048 int x, int y, ButtonState state, int button)
1049
1050{
1051 EventButton event;
1052
1053 moveToWidgetAtPoint (x, y, state);
1054
1055 event.xCanvas = x;
1056 event.yCanvas = y;
1057 event.state = state;
1058 event.button = button;
1059 event.numPressed = numPressed;
1060
1061 return processMouseEvent (&event, type);
1062}
1063
1070bool Layout::motionNotify (View *view, int x, int y, ButtonState state)
1071{
1072 EventButton event;
1073
1074 moveToWidgetAtPoint (x, y, state);
1075
1076 event.xCanvas = x;
1077 event.yCanvas = y;
1078 event.state = state;
1079
1080 return processMouseEvent (&event, MOTION_NOTIFY);
1081}
1082
1088void Layout::enterNotify (View *view, int x, int y, ButtonState state)
1089{
1090 Widget *lastWidget;
1091 EventCrossing event;
1092
1093 lastWidget = widgetAtPoint;
1094 moveToWidgetAtPoint (x, y, state);
1095
1096 if (widgetAtPoint) {
1097 event.state = state;
1098 event.lastWidget = lastWidget;
1099 event.currentWidget = widgetAtPoint;
1100 widgetAtPoint->enterNotify (&event);
1101 }
1102}
1103
1110{
1111#if 0
1112 Widget *lastWidget;
1113 EventCrossing event;
1114
1115 lastWidget = widgetAtPoint;
1116 moveOutOfView (state);
1117
1118 if (lastWidget) {
1119 event.state = state;
1120 event.lastWidget = lastWidget;
1121 event.currentWidget = widgetAtPoint;
1122 lastWidget->leaveNotify (&event);
1123 }
1124#else
1125 moveOutOfView (state);
1126#endif
1127}
1128
1129/*
1130 * Return the widget at position (x, y). Return NULL, if there is no widget.
1131 */
1133{
1134 DBG_OBJ_ENTER ("events", 0, "getWidgetAtPoint", "%d, %d", x, y);
1135 Widget *widget;
1136
1137 if (topLevel && topLevel->wasAllocated ()) {
1139 widget = topLevel->getWidgetAtPoint (x, y, &context);
1140 } else
1141 widget = NULL;
1142
1143 DBG_OBJ_MSGF ("events", 0, "=> %p", widget);
1144 DBG_OBJ_LEAVE ();
1145 return widget;
1146}
1147
1148
1149/*
1150 * Emit the necessary crossing events, when the mouse pointer has moved to
1151 * the given widget (by mouse or scrolling).
1152 */
1153void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state)
1154{
1155 DBG_OBJ_ENTER ("events", 0, "moveToWidget", "%p, %d",
1156 newWidgetAtPoint, state);
1157
1158 Widget *ancestor, *w;
1159 Widget **track;
1160 int trackLen, i, i_a;
1161 EventCrossing crossingEvent;
1162
1163 DBG_OBJ_MSGF ("events", 1, "(old) widgetAtPoint = %p", widgetAtPoint);
1164
1165 if (newWidgetAtPoint != widgetAtPoint) {
1166 // The mouse pointer has been moved into another widget.
1167 if (newWidgetAtPoint && widgetAtPoint)
1168 ancestor =
1169 newWidgetAtPoint->getNearestCommonAncestor (widgetAtPoint);
1170 else if (newWidgetAtPoint)
1171 ancestor = newWidgetAtPoint->getTopLevel ();
1172 else
1173 ancestor = widgetAtPoint->getTopLevel ();
1174
1175 // Construct the track.
1176 trackLen = 0;
1177 if (widgetAtPoint)
1178 // first part
1179 for (w = widgetAtPoint; w != ancestor; w = w->getParent ())
1180 trackLen++;
1181 trackLen++; // for the ancestor
1182 if (newWidgetAtPoint)
1183 // second part
1184 for (w = newWidgetAtPoint; w != ancestor; w = w->getParent ())
1185 trackLen++;
1186
1187 track = new Widget* [trackLen];
1188 i = 0;
1189 if (widgetAtPoint)
1190 /* first part */
1191 for (w = widgetAtPoint; w != ancestor; w = w->getParent ())
1192 track[i++] = w;
1193 i_a = i;
1194 track[i++] = ancestor;
1195 if (newWidgetAtPoint) {
1196 /* second part */
1197 i = trackLen - 1;
1198 for (w = newWidgetAtPoint; w != ancestor; w = w->getParent ())
1199 track[i--] = w;
1200 }
1201#if 0
1202 MSG("Track: %s[ ", widgetAtPoint ? "" : "nil ");
1203 for (i = 0; i < trackLen; i++)
1204 MSG("%s%p ", i == i_a ? ">" : "", track[i]);
1205 MSG("] %s\n", newWidgetAtPoint ? "" : "nil");
1206#endif
1207
1208 /* Send events to the widgets on the track */
1209 for (i = 0; i < trackLen; i++) {
1210 crossingEvent.state = state;
1211 crossingEvent.currentWidget = widgetAtPoint; // ???
1212 crossingEvent.lastWidget = widgetAtPoint; // ???
1213 if (i < i_a) {
1214 track[i]->leaveNotify (&crossingEvent);
1215 } else if (i == i_a) { /* ancestor */
1216 /* Don't touch ancestor unless:
1217 * - moving into/from NULL,
1218 * - ancestor becomes the newWidgetAtPoint */
1219 if (i_a == trackLen-1 && !newWidgetAtPoint)
1220 track[i]->leaveNotify (&crossingEvent);
1221 else if ((i_a == 0 && !widgetAtPoint) ||
1222 (i_a == trackLen-1 && newWidgetAtPoint))
1223 track[i]->enterNotify (&crossingEvent);
1224 } else {
1225 track[i]->enterNotify (&crossingEvent);
1226 }
1227 }
1228
1229 delete[] track;
1230
1231 widgetAtPoint = newWidgetAtPoint;
1232 updateCursor ();
1233 }
1234
1235 DBG_OBJ_LEAVE ();
1236}
1237
1245 ButtonEventType type)
1246{
1247 Widget *widget;
1248
1249 /*
1250 * If the event is outside of the visible region of the canvas, treat it
1251 * as occurring at the region's edge. Notably, this helps when selecting
1252 * text.
1253 */
1254 if (event->xCanvas < scrollX)
1255 event->xCanvas = scrollX;
1256 else {
1257 int maxX = scrollX + viewportWidth - currVScrollbarThickness() - 1;
1258
1259 if (event->xCanvas > maxX)
1260 event->xCanvas = maxX;
1261 }
1262 if (event->yCanvas < scrollY)
1263 event->yCanvas = scrollY;
1264 else {
1267
1268 if (event->yCanvas > maxY)
1269 event->yCanvas = maxY;
1270 }
1271
1272 widget = getWidgetAtPoint(event->xCanvas, event->yCanvas);
1273
1274 for (; widget; widget = widget->getParent ()) {
1275 if (widget->isButtonSensitive ()) {
1276 event->xWidget = event->xCanvas - widget->getAllocation()->x;
1277 event->yWidget = event->yCanvas - widget->getAllocation()->y;
1278
1279 switch (type) {
1280 case BUTTON_PRESS:
1281 return widget->buttonPress ((EventButton*)event);
1282
1283 case BUTTON_RELEASE:
1284 return widget->buttonRelease ((EventButton*)event);
1285
1286 case MOTION_NOTIFY:
1287 return widget->motionNotify ((EventMotion*)event);
1288
1289 default:
1291 }
1292 }
1293 }
1294 if (type == BUTTON_PRESS)
1295 return emitLinkPress (NULL, -1, -1, -1, -1, (EventButton*)event);
1296 else if (type == BUTTON_RELEASE)
1297 return emitLinkRelease(NULL, -1, -1, -1, -1, (EventButton*)event);
1298
1299 return false;
1300}
1301
1302/*
1303 * This function must be called by a view, when the user has manually changed
1304 * the viewport position. It is *not* called, when the layout has requested the
1305 * position change.
1306 */
1308{
1309 if (x != scrollX || y != scrollY) {
1310 scrollX = x;
1311 scrollY = y;
1312
1313 setAnchor (NULL);
1314 updateAnchor ();
1315 }
1316}
1317
1318/*
1319 * This function must be called by a viewport view, when its viewport size has
1320 * changed. It is *not* called, when the layout has requested the size change.
1321 */
1322void Layout::viewportSizeChanged (View *view, int width, int height)
1323{
1324 DBG_OBJ_ENTER ("resize", 0, "viewportSizeChanged", "%p, %d, %d",
1325 view, width, height);
1326
1327 /* If size changes, redraw this view. */
1328 if (viewportWidth != width || viewportHeight != height) {
1329 canvasHeightGreater = false; // reset value here
1330 viewportWidth = width;
1331 viewportHeight = height;
1332 resizeCounter = 0;
1334
1335 DBG_OBJ_SET_SYM ("canvasHeightGreater",
1336 canvasHeightGreater ? "true" : "false");
1337 DBG_OBJ_SET_NUM ("viewportWidth", viewportWidth);
1338 DBG_OBJ_SET_NUM ("viewportHeight", viewportHeight);
1339 }
1340
1341 DBG_OBJ_LEAVE ();
1342}
1343
1345{
1346 DBG_OBJ_ENTER0 ("resize", 0, "containerSizeChanged");
1347
1348 if (topLevel) {
1350 queueResize (true);
1351 }
1352
1353 DBG_OBJ_LEAVE ();
1354}
1355
1356} // namespace core
1357} // namespace dw
#define _MSG(...)
Definition bookmarks.c:45
#define MSG(...)
Definition bookmarks.c:46
Set at the top when drawing.
Definition types.hh:295
Represents a button press or release event.
Definition events.hh:58
Represents a enter or leave notify event.
Definition events.hh:75
Represents a mouse motion event.
Definition events.hh:68
void setWidget(Widget *widget)
Definition findtext.cc:55
Set at the top when getting the widget at the point.
Definition types.hh:313
Iterators are used to iterate through the contents of a widget.
Definition iterator.hh:20
virtual void unref()
Delete the iterator.
Definition iterator.cc:82
virtual bool next()=0
Move iterator forward and store content it.
Content * getContent()
Definition iterator.hh:37
bool emitToReceiver(lout::signal::Receiver *receiver, int signalNo, int argc, lout::object::Object **argv)
A sub class must implement this for a call to a single receiver.
Definition layout.cc:106
void emitResizeQueued(bool extremesChanged)
Definition layout.cc:130
void emitCanvasSizeChanged(int width, int ascent, int descent)
Definition layout.cc:137
void draw(int x, int y, int width, int height)
Draw (or queue for drawing) an area, which is given in canvas coordinates.
Definition layout.cc:89
void getBgArea(int *x, int *y, int *width, int *height)
Return the area covered by the background image.
Definition layout.cc:42
style::BackgroundRepeat getBackgroundRepeat()
Definition layout.cc:68
style::BackgroundAttachment getBackgroundAttachment()
Definition layout.cc:74
void getRefArea(int *xRef, int *yRef, int *widthRef, int *heightRef)
Return the "reference area".
Definition layout.cc:49
style::Length getBackgroundPositionX()
Definition layout.cc:79
style::Length getBackgroundPositionY()
Definition layout.cc:84
style::StyleImage * getBackgroundImage()
Definition layout.cc:63
bool readyToDraw()
If this method returns false, nothing is done at all.
Definition layout.cc:37
bool emitEnter(Widget *widget, int link, int img, int x, int y)
Definition layout.cc:217
bool emitToReceiver(lout::signal::Receiver *receiver, int signalNo, int argc, lout::object::Object **argv)
A sub class must implement this for a call to a single receiver.
Definition layout.cc:173
bool emitPress(Widget *widget, int link, int img, int x, int y, EventButton *event)
Definition layout.cc:225
bool emitRelease(Widget *widget, int link, int img, int x, int y, EventButton *event)
Definition layout.cc:233
bool emitClick(Widget *widget, int link, int img, int x, int y, EventButton *event)
Definition layout.cc:241
virtual bool click(Widget *widget, int link, int img, int x, int y, EventButton *event)
Called, when the user has clicked on a link.
Definition layout.cc:165
virtual bool press(Widget *widget, int link, int img, int x, int y, EventButton *event)
Called, when the user has pressed the mouse button on a link (but not yet released).
Definition layout.cc:153
virtual bool release(Widget *widget, int link, int img, int x, int y, EventButton *event)
Called, when the user has released the mouse button on a link.
Definition layout.cc:159
virtual bool enter(Widget *widget, int link, int img, int x, int y)
Called, when a link is entered, left, or the position has changed.
Definition layout.cc:147
Receiver interface different signals.
Definition layout.hh:48
virtual void resizeQueued(bool extremesChanged)
Definition layout.cc:96
virtual void canvasSizeChanged(int width, int ascent, int descent)
Definition layout.cc:100
void attachView(View *view)
Attach a view to the layout.
Definition layout.cc:459
lout::misc::ZoneAllocator * textZone
Definition layout.hh:277
void changeAnchor(Widget *widget, char *name, int y)
Definition layout.cc:774
void detachWidget(Widget *widget)
Definition layout.cc:351
int currHScrollbarThickness()
Definition layout.cc:724
style::Cursor cursor
Definition layout.hh:167
void updateAnchor()
Definition layout.cc:790
bool emitLinkRelease(Widget *w, int link, int img, int x, int y, EventButton *event)
Definition layout.hh:269
void setCursor(style::Cursor cursor)
Definition layout.cc:810
void scrollIdle()
Definition layout.cc:570
void enterNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a enter notify event.
Definition layout.cc:1088
void queueDraw(int x, int y, int width, int height)
Definition layout.cc:991
bool scrollIdleNotInterrupted
Definition layout.hh:181
Widget * getWidgetAtPoint(int x, int y)
Definition layout.cc:1132
int scrollTargetWidth
Definition layout.hh:177
void containerSizeChanged()
Definition layout.cc:1344
bool motionNotify(View *view, int x, int y, ButtonState state)
This function is called by a view, to delegate a motion notify event.
Definition layout.cc:1070
bool drawAfterScrollReq
Definition layout.hh:170
Layout(Platform *platform, bool limit=true)
Definition layout.cc:258
void setWidget(Widget *widget)
Definition layout.cc:433
bool processMouseEvent(MousePositionEvent *event, ButtonEventType type)
Common processing of press, release and motion events.
Definition layout.cc:1244
style::StyleImage * bgImage
Definition layout.hh:162
void setBgColor(style::Color *color)
Definition layout.cc:826
void detachView(View *view)
Definition layout.cc:511
void moveToWidgetAtPoint(int x, int y, ButtonState state)
Emit the necessary crossing events, when the mouse pointer has moved to position (x,...
Definition layout.hh:201
char * addAnchor(Widget *widget, const char *name)
Used, when the widget is not allocated yet.
Definition layout.cc:751
void leaveNotify(View *view, ButtonState state)
This function is called by a view, to delegate a leave notify event.
Definition layout.cc:1109
lout::container::typed::HashTable< lout::object::String, Anchor > * anchorsTable
Definition layout.hh:185
void queueDrawExcept(int x, int y, int width, int height, int ex, int ey, int ewidth, int eheight)
Definition layout.cc:1004
VPosition scrollTargetVpos
Definition layout.hh:176
void viewportSizeChanged(View *view, int width, int height)
Definition layout.cc:1322
HPosition scrollTargetHpos
Definition layout.hh:175
int sizeRequestCounter
Definition layout.hh:249
lout::container::typed::Vector< Widget > * queueResizeList
Definition layout.hh:158
int vScrollbarThickness
Definition layout.hh:173
void addWidget(Widget *widget)
Definition layout.cc:371
int queueResizeCounter
Definition layout.hh:248
bool buttonEvent(ButtonEventType type, View *view, int numPressed, int x, int y, ButtonState state, int button)
Definition layout.cc:1047
SelectionState selectionState
Definition layout.hh:187
void updateCursor()
Definition layout.cc:818
void resizeIdle()
Definition layout.cc:870
void draw(View *view, Rectangle *area)
Definition layout.cc:670
void moveToWidget(Widget *newWidgetAtPoint, ButtonState state)
Definition layout.cc:1153
void setBgImage(style::StyleImage *bgImage, style::BackgroundRepeat bgRepeat, style::BackgroundAttachment bgAttachment, style::Length bgPositionX, style::Length bgPositionY)
Definition layout.cc:839
void moveOutOfView(ButtonState state)
Emit the necessary crossing events, when the mouse pointer has moved out of the view.
Definition layout.hh:208
bool emitLinkPress(Widget *w, int link, int img, int x, int y, EventButton *event)
Definition layout.hh:265
void adjustScrollPos()
Definition layout.cc:632
int sizeAllocateCounter
Definition layout.hh:248
FindtextState findtextState
Definition layout.hh:188
Platform * platform
Definition layout.hh:155
style::Color * bgColor
Definition layout.hh:161
void enterResizeIdle()
Definition layout.hh:252
style::BackgroundRepeat bgRepeat
Definition layout.hh:163
void scrollTo0(HPosition hpos, VPosition vpos, int x, int y, int width, int height, bool scrollingInterrupted)
Definition layout.cc:545
Widget * widgetAtPoint
Definition layout.hh:157
void removeWidget()
Definition layout.cc:406
int getExtremesCounter
Definition layout.hh:249
Widget * topLevel
Definition layout.hh:157
void removeAnchor(Widget *widget, char *name)
Definition layout.cc:784
style::BackgroundAttachment bgAttachment
Definition layout.hh:164
static bool calcScrollInto(int targetValue, int requestedSize, int *value, int viewportSize)
Definition layout.cc:645
int scrollTargetHeight
Definition layout.hh:177
void scrollPosChanged(View *view, int x, int y)
Definition layout.cc:1307
int resizeIdleCounter
Definition layout.hh:248
void scrollTo(HPosition hpos, VPosition vpos, int x, int y, int width, int height)
Scrolls all viewports, so that the region [x, y, width, height] is seen, according to hpos and vpos.
Definition layout.cc:539
void scroll(ScrollCommand)
Definition layout.cc:529
style::Length bgPositionX
Definition layout.hh:165
style::Length bgPositionY
Definition layout.hh:165
int hScrollbarThickness
Definition layout.hh:173
char * requestedAnchor
Definition layout.hh:179
int currVScrollbarThickness()
Definition layout.cc:729
Emitter emitter
Definition layout.hh:143
void setAnchor(const char *anchor)
Sets the anchor to scroll to.
Definition layout.cc:738
bool canvasHeightGreater
Definition layout.hh:172
void queueResize(bool extremesChanged)
Definition layout.cc:1027
LayoutImgRenderer * layoutImgRenderer
Definition layout.hh:39
void leaveResizeIdle()
Definition layout.hh:253
ButtonState state
Definition events.hh:42
Base class for all mouse events related to a specific position.
Definition events.hh:49
An interface to encapsulate some platform dependencies.
Definition platform.hh:17
virtual void removeIdle(int idleId)=0
Remove an idle function, which has not been processed yet.
virtual void detachView(View *view)=0
This methods notifies the platform, that a view has been detached from the related layout.
virtual void attachView(View *view)=0
This methods notifies the platform, that a view has been attached to the related layout.
virtual void setLayout(Layout *layout)=0
This methods notifies the platform, that it has been attached to a layout.
virtual int addIdle(void(Layout::*func)())=0
Add an idle function.
dw::core::Shape implemtation for simple rectangles.
Definition types.hh:70
bool intersectsWith(Rectangle *otherRect, Rectangle *dest)
Return whether this rectangle and otherRect intersect.
Definition types.cc:53
void setLayout(Layout *layout)
Definition selection.hh:225
See Handling stacking contexts.
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
virtual void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)=0
Set the viewport size.
virtual void queueDraw(Rectangle *area)=0
Queue a region, which is given in canvas coordinates, for drawing.
virtual void startDrawing(Rectangle *area)=0
Called before drawing.
virtual int getScrollbarOnLeft()=0
virtual void scroll(ScrollCommand)
Scroll the viewport as commanded.
Definition view.hh:87
virtual int getHScrollbarThickness()=0
Get the thickness of the horizontal scrollbar, when it is visible.
virtual void setCanvasSize(int width, int ascent, int descent)=0
Set the canvas size.
virtual void finishDrawing(Rectangle *area)=0
Called after drawing.
virtual void queueDrawTotal()=0
Queue the total viewport for drawing.
virtual void setCursor(style::Cursor cursor)=0
Set the cursor appearance.
virtual bool usesViewport()=0
Return, whether this view uses a viewport.
virtual int getVScrollbarThickness()=0
Get the thickness of the vertical scrollbar, when it is visible.
virtual void setBgColor(style::Color *color)=0
Set the background of the view.
virtual void cancelQueueDraw()=0
Cancel a draw queue request.
virtual void scrollTo(int x, int y)=0
Scroll the vieport to the given position.
virtual void setLayout(Layout *layout)=0
This methods notifies the view, that it has been attached to a layout.
The base class of all dillo widgets.
Definition widget.hh:44
Allocation * getAllocation()
Definition widget.hh:484
void sizeAllocate(Allocation *allocation)
Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed.
Definition widget.cc:1209
bool motionNotify(EventMotion *event)
Definition widget.cc:1294
Layout * layout
Definition widget.hh:216
Widget * container
The containing widget, equivalent to the "containing block" defined by CSS.
Definition widget.hh:146
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition widget.hh:204
virtual Iterator * iterator(Content::Type mask, bool atEnd)=0
Return an iterator for this widget.
virtual void draw(View *view, Rectangle *area, DrawingContext *context)=0
Area is given in widget coordinates.
@ NEEDS_ALLOCATE
Only used internally, set to enforce size allocation.
Definition widget.hh:76
@ EXTREMES_CHANGED
Set, when dw::core::Widget::extremes is not up to date anymore.
Definition widget.hh:89
@ NEEDS_RESIZE
Set, when dw::core::Widget::requisition is not up to date anymore.
Definition widget.hh:65
void sizeRequest(Requisition *requisition, int numPos=0, Widget **references=NULL, int *x=NULL, int *y=NULL)
This method is a wrapper for Widget::sizeRequestImpl(); it calls the latter only when needed.
Definition widget.cc:550
Widget * getParent()
Definition widget.hh:587
void enterNotify(EventCrossing *event)
Definition widget.cc:1299
bool needsAllocate()
Definition widget.hh:472
bool resizeQueued()
Definition widget.hh:469
bool buttonRelease(EventButton *event)
Definition widget.cc:1289
Widget * stackingContextWidget
The bottom-most ancestor (or this) for which stackingContextMgr is set.
Definition widget.hh:238
virtual void notifySetAsTopLevel()
This method is called after a widget has been set as the top of a widget tree.
Definition widget.cc:2179
StackingContextMgr * stackingContextMgr
Set iff this widget constitutes a stacking context, as defined by CSS.
Definition widget.hh:232
bool isButtonSensitive()
Definition widget.hh:585
Widget * getNearestCommonAncestor(Widget *otherWidget)
Get the widget with the highest level, which is a direct ancestor of widget1 and widget2.
Definition widget.cc:1629
bool extremesQueued()
Definition widget.hh:470
bool needsResize()
Definition widget.hh:471
virtual Widget * getWidgetAtPoint(int x, int y, GettingWidgetAtPointContext *context)
Definition widget.cc:223
void leaveNotify(EventCrossing *event)
Definition widget.cc:1304
style::Style * style
Definition widget.hh:150
void containerSizeChanged()
Definition widget.cc:420
void unsetFlags(Flags f)
Definition widget.hh:301
void queueResize(int ref, bool extremesChanged, bool fast)
This method should be called, when a widget changes its size.
Definition widget.cc:321
bool buttonPress(EventButton *event)
Definition widget.cc:1284
Widget * getTopLevel()
Get the widget at the root of the tree, this widget is part from.
Definition widget.cc:1578
bool wasAllocated()
Definition widget.hh:475
bool allocateQueued()
Definition widget.hh:473
void setFlags(Flags f)
Definition widget.hh:299
void putExternalImgRenderer(ImgRenderer *ir)
Add an additional ImgRenderer, especially used for drawing.
Definition style.hh:892
void removeExternalImgRenderer(ImgRenderer *ir)
Remove a previously added additional ImgRenderer.
Definition style.hh:898
Typed version of container::untyped::Vector.
Definition container.hh:447
A simple allocator optimized to handle many small chunks of memory.
Definition misc.hh:631
An object::Object wrapper for bool's.
Definition object.hh:144
An object::Object wrapper for int's.
Definition object.hh:127
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:25
An object::Object wrapper for strings (char*).
Definition object.hh:186
The base class for signal receiver base classes.
Definition signal.hh:254
#define DBG_OBJ_ENTER0(aspect, prio, funname)
#define DBG_OBJ_DELETE()
#define DBG_OBJ_CREATE(klass)
#define DBG_OBJ_SET_SYM(var, val)
#define DBG_OBJ_MSGF(aspect, prio, fmt,...)
#define DBG_OBJ_SET_NUM(var, val)
#define DBG_OBJ_ENTER(aspect, prio, funname, fmt,...)
#define DBG_OBJ_ASSOC(parent, child)
#define DBG_OBJ_LEAVE()
#define DBG_OBJ_ASSOC_CHILD(child)
#define DBG_OBJ_SET_PTR_O(obj, var, val)
char * dStrdup(const char *s)
Definition dlib.c:77
#define MSG_ERR(...)
Definition dpid_common.h:23
static Layout * layout
#define MSG_WARN(...)
Definition msg.h:26
void drawBackgroundImage(View *view, StyleImage *backgroundImage, BackgroundRepeat backgroundRepeat, BackgroundAttachment backgroundAttachment, Length backgroundPositionX, Length backgroundPositionY, int x, int y, int width, int height, int xRef, int yRef, int widthRef, int heightRef)
Definition style.cc:1286
int Length
Type for representing all lengths within dw::core::style.
Definition style.hh:429
ButtonState
Platform independent representation.
Definition events.hh:15
VPosition
Definition types.hh:26
@ VPOS_TOP
Definition types.hh:27
@ VPOS_INTO_VIEW
Definition types.hh:30
@ VPOS_CENTER
Definition types.hh:28
@ VPOS_NO_CHANGE
Definition types.hh:32
@ VPOS_BOTTOM
Definition types.hh:29
HPosition
Definition types.hh:16
@ HPOS_CENTER
Definition types.hh:18
@ HPOS_INTO_VIEW
Definition types.hh:20
@ HPOS_LEFT
Definition types.hh:17
@ HPOS_NO_CHANGE
Definition types.hh:22
@ HPOS_RIGHT
Definition types.hh:19
ScrollCommand
Definition types.hh:35
Dw is in this namespace, or sub namespaces of this one.
@ IMPL_POS
Definition core.hh:16
This namespace contains a framework for container classes, which members are instances of object::Obj...
Definition container.cc:31
T min(T a, T b)
Definition misc.hh:40
T max(T a, T b)
Definition misc.hh:41
void assertNotReached()
Definition misc.hh:56
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
Definition object.cc:30
Represents the allocation, i.e.
Definition types.hh:164
@ WIDGET_IN_FLOW
widget in normal flow, so that this widget (containing this content) is both container (parent) and g...
Definition types.hh:207
@ WIDGET_OOF_CONT
widget out of flow (OOF); this widget (containing this content) is only the container (parent),...
Definition types.hh:212
Widget * widget
Definition types.hh:237