Dillo v3.1.1-46-g8a360e32
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}
312
314{
315 widgetAtPoint = NULL;
316
317 if (layoutImgRenderer) {
318 if (bgImage)
320 delete layoutImgRenderer;
321 }
322
323 if (scrollIdleId != -1)
325 if (resizeIdleId != -1)
327 if (bgColor)
328 bgColor->unref ();
329 if (bgImage)
330 bgImage->unref ();
331 if (topLevel) {
333 Widget *w = topLevel;
334 topLevel = NULL;
335 delete w;
336 }
337
338 delete queueResizeList;
339 delete platform;
340 delete view;
341 delete anchorsTable;
342 delete textZone;
343
344 if (requestedAnchor)
345 free (requestedAnchor);
346
348}
349
351{
352 // Called form ~Layout. Sometimes, the widgets (not only the toplevel widget)
353 // do some stuff after the layout has been deleted, so *all* widgets have to
354 // be detached, and check "layout != NULL" at relevant points.
355
356 // Could be replaced by a virtual method in Widget, like getWidgetAtPoint,
357 // if performace were really a problem.
358
359 widget->layout = NULL;
360 Iterator *it =
361 widget->iterator ((Content::Type)
363 false);
364 while (it->next ())
366
367 it->unref ();
368}
369
371{
372 if (topLevel) {
373 MSG_WARN("widget already set\n");
374 return;
375 }
376
377 // The toplevel widget always establishes a stacking context. It could
378 // already be set in Widget::setStyle().
379 if (widget->stackingContextMgr == NULL && IMPL_POS) {
380 widget->stackingContextMgr = new StackingContextMgr (widget);
381 DBG_OBJ_ASSOC (widget, widget->stackingContextMgr);
382 widget->stackingContextWidget = widget;
383 }
384
385 topLevel = widget;
386 widget->layout = this;
387 widget->container = NULL;
388 DBG_OBJ_SET_PTR_O (widget, "container", widget->container);
389
390 queueResizeList->clear ();
391 widget->notifySetAsTopLevel ();
392
393 findtextState.setWidget (widget);
394
395 canvasHeightGreater = false;
396 DBG_OBJ_SET_SYM ("canvasHeightGreater",
397 canvasHeightGreater ? "true" : "false");
398
399 // Do not directly call Layout::queueResize(), but
400 // Widget::queueResize(), so that all flags are set properly,
401 // queueResizeList is filled, etc.
402 topLevel->queueResize (-1, false);
403}
404
431
433{
434 DBG_OBJ_ASSOC_CHILD (widget);
435
436 widgetAtPoint = NULL;
437 if (topLevel) {
438 Widget *w = topLevel;
439 topLevel = NULL;
440 delete w;
441 }
442 textZone->zoneFree ();
443 addWidget (widget);
444
445 updateCursor ();
446
447 /* Reset the resizeCounter when we change the top level widget, as we are
448 * changing to another page */
449 resizeCounter = 0;
450}
451
459{
460 if (this->view)
461 MSG_ERR("attachView: Multiple views for layout!\n");
462
464
465 this->view = view;
467
468 /*
469 * The layout of the view is set later, first, we "project" the current
470 * state of the layout into the new view. A view must handle this without
471 * a layout. See also at the end of this function.
472 */
473 if (bgColor)
477
478 if (view->usesViewport ()) {
479 if (usesViewport) {
487 }
488 else {
489 usesViewport = true;
490 scrollX = scrollY = 0;
491 viewportWidth = viewportHeight = 100; // random values
494 }
495
496 DBG_OBJ_SET_NUM ("viewportWidth", viewportWidth);
497 DBG_OBJ_SET_NUM ("viewportHeight", viewportHeight);
498 DBG_OBJ_SET_NUM ("hScrollbarThickness", hScrollbarThickness);
499 DBG_OBJ_SET_NUM ("vScrollbarThickness", vScrollbarThickness);
500 }
501
502 /*
503 * This is the last call within this function, so that it is safe for
504 * the implementation of dw::core::View::setLayout, to call methods
505 * of dw::core::Layout.
506 */
507 view->setLayout (this);
508}
509
511{
512 if (this->view != view) {
513 MSG_ERR("detachView: this->view: %p view %p\n",
514 (void *) this->view, (void *) view);
515 }
516
517 view->setLayout (NULL);
519 this->view = NULL;
526}
527
529{
530 if (view->usesViewport ())
531 view->scroll(cmd);
532}
533
539 int x, int y, int width, int height)
540{
541 scrollTo0 (hpos, vpos, x, y, width, height, true);
542}
543
545 int x, int y, int width, int height,
546 bool scrollingInterrupted)
547{
548 if (usesViewport) {
549 _MSG("scrollTo (%d, %d, %s)\n",
550 x, y, scrollingInterrupted ? "true" : "false");
551
552 scrollTargetHpos = hpos;
553 scrollTargetVpos = vpos;
554 scrollTargetX = x;
555 scrollTargetY = y;
556 scrollTargetWidth = width;
557 scrollTargetHeight = height;
558
559 if (scrollIdleId == -1) {
562 }
563
565 scrollIdleNotInterrupted || !scrollingInterrupted;
566 }
567}
568
570{
571 bool xChanged = true;
572 switch (scrollTargetHpos) {
573 case HPOS_LEFT:
575 break;
576 case HPOS_CENTER:
577 scrollX =
580 break;
581 case HPOS_RIGHT:
582 scrollX =
585 break;
586 case HPOS_INTO_VIEW:
589 break;
590 case HPOS_NO_CHANGE:
591 xChanged = false;
592 break;
593 }
594
595 bool yChanged = true;
596 switch (scrollTargetVpos) {
597 case VPOS_TOP:
599 break;
600 case VPOS_CENTER:
601 scrollY =
604 break;
605 case VPOS_BOTTOM:
606 scrollY =
609 break;
610 case VPOS_INTO_VIEW:
613 break;
614 case VPOS_NO_CHANGE:
615 yChanged = false;
616 break;
617 }
618
619 if (xChanged || yChanged) {
622 if (drawAfterScrollReq) {
623 drawAfterScrollReq = false;
625 }
626 }
627
628 scrollIdleId = -1;
629}
630
632{
636
640
641 _MSG("adjustScrollPos: scrollX=%d scrollY=%d\n", scrollX, scrollY);
642}
643
644bool Layout::calcScrollInto (int requestedValue, int requestedSize,
645 int *value, int viewportSize)
646{
647 if (requestedSize > viewportSize) {
648 // The viewport size is smaller than the size of the region which will
649 // be shown. If the region is already visible, do not change the
650 // position. Otherwise, show the left/upper border, this is most likely
651 // what is needed.
652 if (*value >= requestedValue &&
653 *value + viewportSize < requestedValue + requestedSize)
654 return false;
655 else
656 requestedSize = viewportSize;
657 }
658
659 if (requestedValue < *value) {
660 *value = requestedValue;
661 return true;
662 } else if (requestedValue + requestedSize > *value + viewportSize) {
663 *value = requestedValue - viewportSize + requestedSize;
664 return true;
665 } else
666 return false;
667}
668
670{
671 DBG_OBJ_ENTER ("draw", 0, "draw", "%d, %d, %d * %d",
672 area->x, area->y, area->width, area->height);
673
674 Rectangle widgetArea, intersection, widgetDrawArea;
675
676 // First of all, draw background image. (Unlike background *color*,
677 // this is not a feature of the views.)
678 if (bgImage != NULL && bgImage->getImgbufSrc() != NULL)
681 area->x, area->y, area->width,
682 area->height, 0, 0,
683 // Reference area: maximum of canvas size and
684 // viewport size.
692
693 if (scrollIdleId != -1) {
694 /* scroll is pending, defer draw until after scrollIdle() */
695 drawAfterScrollReq = true;
696
697 } else if (topLevel) {
698 /* Draw the top level widget. */
699 widgetArea.x = topLevel->allocation.x;
700 widgetArea.y = topLevel->allocation.y;
701 widgetArea.width = topLevel->allocation.width;
702 widgetArea.height = topLevel->getHeight ();
703
704 if (area->intersectsWith (&widgetArea, &intersection)) {
705 view->startDrawing (&intersection);
706
707 /* Intersection in widget coordinates. */
708 widgetDrawArea.x = intersection.x - topLevel->allocation.x;
709 widgetDrawArea.y = intersection.y - topLevel->allocation.y;
710 widgetDrawArea.width = intersection.width;
711 widgetDrawArea.height = intersection.height;
712
713 DrawingContext context (&widgetArea);
714 topLevel->draw (view, &widgetDrawArea, &context);
715
716 view->finishDrawing (&intersection);
717 }
718 }
719
720 DBG_OBJ_LEAVE ();
721}
722
727
733
737void Layout::setAnchor (const char *anchor)
738{
739 _MSG("setAnchor (%s)\n", anchor);
740
741 if (requestedAnchor)
742 free (requestedAnchor);
743 requestedAnchor = anchor ? dStrdup (anchor) : NULL;
744 updateAnchor ();
745}
746
750char *Layout::addAnchor (Widget *widget, const char* name)
751{
752 return addAnchor (widget, name, -1);
753}
754
755char *Layout::addAnchor (Widget *widget, const char* name, int y)
756{
757 String key (name);
758 if (anchorsTable->contains (&key))
759 return NULL;
760 else {
761 Anchor *anchor = new Anchor ();
762 anchor->name = dStrdup (name);
763 anchor->widget = widget;
764 anchor->y = y;
765
766 anchorsTable->put (new String (name), anchor);
767 updateAnchor ();
768
769 return anchor->name;
770 }
771}
772
773void Layout::changeAnchor (Widget *widget, char* name, int y)
774{
775 String key (name);
776 Anchor *anchor = anchorsTable->get (&key);
777 assert (anchor);
778 assert (anchor->widget == widget);
779 anchor->y = y;
780 updateAnchor ();
781}
782
783void Layout::removeAnchor (Widget *widget, char* name)
784{
785 String key (name);
786 anchorsTable->remove (&key);
787}
788
790{
791 Anchor *anchor;
792 if (requestedAnchor) {
794 anchor = anchorsTable->get (&key);
795 } else
796 anchor = NULL;
797
798 if (anchor == NULL) {
802 scrollIdleId = -1;
803 }
804 } else
805 if (anchor->y != -1)
806 scrollTo0 (HPOS_NO_CHANGE, VPOS_TOP, 0, anchor->y, 0, 0, false);
807}
808
810{
811 if (cursor != this->cursor) {
812 this->cursor = cursor;
814 }
815}
816
824
826{
827 color->ref ();
828
829 if (bgColor)
830 bgColor->unref ();
831
832 bgColor = color;
833
834 if (view)
836}
837
842{
843 if (layoutImgRenderer && this->bgImage)
845
846 if (bgImage)
847 bgImage->ref ();
848
849 if (this->bgImage)
850 this->bgImage->unref ();
851
852 this->bgImage = bgImage;
853 this->bgRepeat = bgRepeat;
854 this->bgAttachment = bgAttachment;
855 this->bgPositionX = bgPositionX;
856 this->bgPositionY = bgPositionY;
857
858 if (bgImage) {
859 // Create instance of LayoutImgRenderer when needed. Until this
860 // layout is deleted, "layoutImgRenderer" will be kept, since it
861 // is not specific to the style, but only to this layout.
862 if (layoutImgRenderer == NULL)
865 }
866}
867
868
870{
871 DBG_OBJ_ENTER0 ("resize", 0, "resizeIdle");
872
874
875 // There are two commits, 2863:b749629fbfc9 and 4645:ab70f9ce4353, the second
876 // reverting the former. Interrestingly, the second fixes a bug. However, it
877 // should still examined what happens here, and what happens the other calls
878 // to Layout::resizeIdle() which should be still in the queue. (See
879 // Layout::queueResize(), where resizeIdleId is indeed checked.)
880
881 for (int i = 0; resizeIdleId != -1; i++) {
882
883 /* Prevent infinite resize loop, if we reach this point it is very likely
884 * there is a bug in the layouting process */
885 if (resizeCounter >= 1000) {
886 MSG_ERR("Emergency layout stop after %d iterations\n", resizeCounter);
887 MSG_ERR("Please file a bug report with the complete console output\n");
888 resizeIdleId = -1;
889 break;
890 }
891
892 /* Only allow 100 iterations before returning to redraw the screen. */
893 if (i >= 100) {
894 MSG_WARN("Stopping layout loop after %d iterations\n", resizeCounter);
895 break;
896 }
897
899
900 for (typed::Iterator <Widget> it = queueResizeList->iterator();
901 it.hasNext (); ) {
902 Widget *widget = it.getNext ();
903
904 if (widget->resizeQueued ()) {
907 }
908
909 if (widget->allocateQueued ()) {
912 }
913
914 if (widget->extremesQueued ()) {
917 }
918 }
919 queueResizeList->clear ();
920
921 // Reset here, since below, queueResize() may be called again.
922 resizeIdleId = -1;
923
924 // If this method is triggered by a viewport change, we can save
925 // time when the toplevel widget is not affected (as for a toplevel
926 // image resource).
927 if (topLevel &&
929 Requisition requisition;
930 Allocation allocation;
931
932 topLevel->sizeRequest (&requisition);
933 DBG_OBJ_MSGF ("resize", 1, "toplevel size: %d * (%d + %d)",
934 requisition.width, requisition.ascent,
935 requisition.descent);
936
937 // This method is triggered by Widget::queueResize, which will,
938 // in any case, set NEEDS_ALLOCATE (indirectly, as ALLOCATE_QUEUED).
939 // This assertion helps to find inconsistencies. (Cases where
940 // this method is triggered by a viewport change, but the
941 // toplevel widget is not affected, are filtered out some lines
942 // above: "if (topLevel && topLevel->needsResize ())".)
943 assert (topLevel->needsAllocate ());
944
945 allocation.x = allocation.y = 0;
946 allocation.width = requisition.width;
947 allocation.ascent = requisition.ascent;
948 allocation.descent = requisition.descent;
949 topLevel->sizeAllocate (&allocation);
950
951 canvasWidth = requisition.width;
952 canvasAscent = requisition.ascent;
953 canvasDescent = requisition.descent;
956 // Tell the view about the new world size.
958
959 if (usesViewport) {
960 int currHThickness = currHScrollbarThickness();
961 int currVThickness = currVScrollbarThickness();
962
963 if (!canvasHeightGreater &&
964 canvasAscent + canvasDescent > viewportHeight - currHThickness) {
965 canvasHeightGreater = true;
966 DBG_OBJ_SET_SYM ("canvasHeightGreater",
967 canvasHeightGreater ? "true" : "false");
969 }
970
971 // Set viewport sizes.
973 currHThickness, currVThickness);
974 }
975
976 // views are redrawn via Widget::resizeDrawImpl ()
977 }
978 }
979 updateAnchor ();
980
981 DBG_OBJ_MSGF ("resize", 1,
982 "after resizeIdle: resizeIdleId = %d", resizeIdleId);
983 DBG_OBJ_LEAVE ();
984
986}
987
988void Layout::queueDraw (int x, int y, int width, int height)
989{
990 Rectangle area;
991 area.x = x;
992 area.y = y;
993 area.width = width;
994 area.height = height;
995
996 if (area.isEmpty ()) return;
997
998 view->queueDraw (&area);
999}
1000
1001void Layout::queueDrawExcept (int x, int y, int width, int height,
1002 int ex, int ey, int ewidth, int eheight) {
1003
1004 if (x == ex && y == ey && width == ewidth && height == eheight)
1005 return;
1006
1007 // queueDraw() the four rectangles within rectangle (x, y, width, height)
1008 // around rectangle (ex, ey, ewidth, eheight).
1009 // Some or all of these may be empty.
1010
1011 // upper left corner of the intersection rectangle
1012 int ix1 = misc::max (x, ex);
1013 int iy1 = misc::max (y, ey);
1014 // lower right corner of the intersection rectangle
1015 int ix2 = misc::min (x + width, ex + ewidth);
1016 int iy2 = misc::min (y + height, ey + eheight);
1017
1018 queueDraw (x, y, width, iy1 - y);
1019 queueDraw (x, iy2, width, y + height - iy2);
1020 queueDraw (x, iy1, ix1 - x, iy2 - iy1);
1021 queueDraw (ix2, iy1, x + width - ix2, iy2 - iy1);
1022}
1023
1024void Layout::queueResize (bool extremesChanged)
1025{
1026 DBG_OBJ_ENTER ("resize", 0, "queueResize", "%s",
1027 extremesChanged ? "true" : "false");
1028
1029 if (resizeIdleId == -1) {
1031
1033 DBG_OBJ_MSGF ("resize", 1, "setting resizeIdleId = %d", resizeIdleId);
1034 }
1035
1036 emitter.emitResizeQueued (extremesChanged);
1037
1038 DBG_OBJ_LEAVE ();
1039}
1040
1041
1042// Views
1043
1044bool Layout::buttonEvent (ButtonEventType type, View *view, int numPressed,
1045 int x, int y, ButtonState state, int button)
1046
1047{
1048 EventButton event;
1049
1050 moveToWidgetAtPoint (x, y, state);
1051
1052 event.xCanvas = x;
1053 event.yCanvas = y;
1054 event.state = state;
1055 event.button = button;
1056 event.numPressed = numPressed;
1057
1058 return processMouseEvent (&event, type);
1059}
1060
1067bool Layout::motionNotify (View *view, int x, int y, ButtonState state)
1068{
1069 EventButton event;
1070
1071 moveToWidgetAtPoint (x, y, state);
1072
1073 event.xCanvas = x;
1074 event.yCanvas = y;
1075 event.state = state;
1076
1077 return processMouseEvent (&event, MOTION_NOTIFY);
1078}
1079
1085void Layout::enterNotify (View *view, int x, int y, ButtonState state)
1086{
1087 Widget *lastWidget;
1088 EventCrossing event;
1089
1090 lastWidget = widgetAtPoint;
1091 moveToWidgetAtPoint (x, y, state);
1092
1093 if (widgetAtPoint) {
1094 event.state = state;
1095 event.lastWidget = lastWidget;
1096 event.currentWidget = widgetAtPoint;
1097 widgetAtPoint->enterNotify (&event);
1098 }
1099}
1100
1107{
1108#if 0
1109 Widget *lastWidget;
1110 EventCrossing event;
1111
1112 lastWidget = widgetAtPoint;
1113 moveOutOfView (state);
1114
1115 if (lastWidget) {
1116 event.state = state;
1117 event.lastWidget = lastWidget;
1118 event.currentWidget = widgetAtPoint;
1119 lastWidget->leaveNotify (&event);
1120 }
1121#else
1122 moveOutOfView (state);
1123#endif
1124}
1125
1126/*
1127 * Return the widget at position (x, y). Return NULL, if there is no widget.
1128 */
1130{
1131 DBG_OBJ_ENTER ("events", 0, "getWidgetAtPoint", "%d, %d", x, y);
1132 Widget *widget;
1133
1134 if (topLevel && topLevel->wasAllocated ()) {
1136 widget = topLevel->getWidgetAtPoint (x, y, &context);
1137 } else
1138 widget = NULL;
1139
1140 DBG_OBJ_MSGF ("events", 0, "=> %p", widget);
1141 DBG_OBJ_LEAVE ();
1142 return widget;
1143}
1144
1145
1146/*
1147 * Emit the necessary crossing events, when the mouse pointer has moved to
1148 * the given widget (by mouse or scrolling).
1149 */
1150void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state)
1151{
1152 DBG_OBJ_ENTER ("events", 0, "moveToWidget", "%p, %d",
1153 newWidgetAtPoint, state);
1154
1155 Widget *ancestor, *w;
1156 Widget **track;
1157 int trackLen, i, i_a;
1158 EventCrossing crossingEvent;
1159
1160 DBG_OBJ_MSGF ("events", 1, "(old) widgetAtPoint = %p", widgetAtPoint);
1161
1162 if (newWidgetAtPoint != widgetAtPoint) {
1163 // The mouse pointer has been moved into another widget.
1164 if (newWidgetAtPoint && widgetAtPoint)
1165 ancestor =
1166 newWidgetAtPoint->getNearestCommonAncestor (widgetAtPoint);
1167 else if (newWidgetAtPoint)
1168 ancestor = newWidgetAtPoint->getTopLevel ();
1169 else
1170 ancestor = widgetAtPoint->getTopLevel ();
1171
1172 // Construct the track.
1173 trackLen = 0;
1174 if (widgetAtPoint)
1175 // first part
1176 for (w = widgetAtPoint; w != ancestor; w = w->getParent ())
1177 trackLen++;
1178 trackLen++; // for the ancestor
1179 if (newWidgetAtPoint)
1180 // second part
1181 for (w = newWidgetAtPoint; w != ancestor; w = w->getParent ())
1182 trackLen++;
1183
1184 track = new Widget* [trackLen];
1185 i = 0;
1186 if (widgetAtPoint)
1187 /* first part */
1188 for (w = widgetAtPoint; w != ancestor; w = w->getParent ())
1189 track[i++] = w;
1190 i_a = i;
1191 track[i++] = ancestor;
1192 if (newWidgetAtPoint) {
1193 /* second part */
1194 i = trackLen - 1;
1195 for (w = newWidgetAtPoint; w != ancestor; w = w->getParent ())
1196 track[i--] = w;
1197 }
1198#if 0
1199 MSG("Track: %s[ ", widgetAtPoint ? "" : "nil ");
1200 for (i = 0; i < trackLen; i++)
1201 MSG("%s%p ", i == i_a ? ">" : "", track[i]);
1202 MSG("] %s\n", newWidgetAtPoint ? "" : "nil");
1203#endif
1204
1205 /* Send events to the widgets on the track */
1206 for (i = 0; i < trackLen; i++) {
1207 crossingEvent.state = state;
1208 crossingEvent.currentWidget = widgetAtPoint; // ???
1209 crossingEvent.lastWidget = widgetAtPoint; // ???
1210 if (i < i_a) {
1211 track[i]->leaveNotify (&crossingEvent);
1212 } else if (i == i_a) { /* ancestor */
1213 /* Don't touch ancestor unless:
1214 * - moving into/from NULL,
1215 * - ancestor becomes the newWidgetAtPoint */
1216 if (i_a == trackLen-1 && !newWidgetAtPoint)
1217 track[i]->leaveNotify (&crossingEvent);
1218 else if ((i_a == 0 && !widgetAtPoint) ||
1219 (i_a == trackLen-1 && newWidgetAtPoint))
1220 track[i]->enterNotify (&crossingEvent);
1221 } else {
1222 track[i]->enterNotify (&crossingEvent);
1223 }
1224 }
1225
1226 delete[] track;
1227
1228 widgetAtPoint = newWidgetAtPoint;
1229 updateCursor ();
1230 }
1231
1232 DBG_OBJ_LEAVE ();
1233}
1234
1242 ButtonEventType type)
1243{
1244 Widget *widget;
1245
1246 /*
1247 * If the event is outside of the visible region of the canvas, treat it
1248 * as occurring at the region's edge. Notably, this helps when selecting
1249 * text.
1250 */
1251 if (event->xCanvas < scrollX)
1252 event->xCanvas = scrollX;
1253 else {
1254 int maxX = scrollX + viewportWidth - currVScrollbarThickness() - 1;
1255
1256 if (event->xCanvas > maxX)
1257 event->xCanvas = maxX;
1258 }
1259 if (event->yCanvas < scrollY)
1260 event->yCanvas = scrollY;
1261 else {
1264
1265 if (event->yCanvas > maxY)
1266 event->yCanvas = maxY;
1267 }
1268
1269 widget = getWidgetAtPoint(event->xCanvas, event->yCanvas);
1270
1271 for (; widget; widget = widget->getParent ()) {
1272 if (widget->isButtonSensitive ()) {
1273 event->xWidget = event->xCanvas - widget->getAllocation()->x;
1274 event->yWidget = event->yCanvas - widget->getAllocation()->y;
1275
1276 switch (type) {
1277 case BUTTON_PRESS:
1278 return widget->buttonPress ((EventButton*)event);
1279
1280 case BUTTON_RELEASE:
1281 return widget->buttonRelease ((EventButton*)event);
1282
1283 case MOTION_NOTIFY:
1284 return widget->motionNotify ((EventMotion*)event);
1285
1286 default:
1288 }
1289 }
1290 }
1291 if (type == BUTTON_PRESS)
1292 return emitLinkPress (NULL, -1, -1, -1, -1, (EventButton*)event);
1293 else if (type == BUTTON_RELEASE)
1294 return emitLinkRelease(NULL, -1, -1, -1, -1, (EventButton*)event);
1295
1296 return false;
1297}
1298
1299/*
1300 * This function must be called by a view, when the user has manually changed
1301 * the viewport position. It is *not* called, when the layout has requested the
1302 * position change.
1303 */
1305{
1306 if (x != scrollX || y != scrollY) {
1307 scrollX = x;
1308 scrollY = y;
1309
1310 setAnchor (NULL);
1311 updateAnchor ();
1312 }
1313}
1314
1315/*
1316 * This function must be called by a viewport view, when its viewport size has
1317 * changed. It is *not* called, when the layout has requested the size change.
1318 */
1319void Layout::viewportSizeChanged (View *view, int width, int height)
1320{
1321 DBG_OBJ_ENTER ("resize", 0, "viewportSizeChanged", "%p, %d, %d",
1322 view, width, height);
1323
1324 /* If size changes, redraw this view. */
1325 if (viewportWidth != width || viewportHeight != height) {
1326 canvasHeightGreater = false; // reset value here
1327 viewportWidth = width;
1328 viewportHeight = height;
1330
1331 DBG_OBJ_SET_SYM ("canvasHeightGreater",
1332 canvasHeightGreater ? "true" : "false");
1333 DBG_OBJ_SET_NUM ("viewportWidth", viewportWidth);
1334 DBG_OBJ_SET_NUM ("viewportHeight", viewportHeight);
1335 }
1336
1337 DBG_OBJ_LEAVE ();
1338}
1339
1341{
1342 DBG_OBJ_ENTER0 ("resize", 0, "containerSizeChanged");
1343
1344 if (topLevel) {
1346 queueResize (true);
1347 }
1348
1349 DBG_OBJ_LEAVE ();
1350}
1351
1352} // namespace core
1353} // 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:458
lout::misc::ZoneAllocator * textZone
Definition layout.hh:276
void changeAnchor(Widget *widget, char *name, int y)
Definition layout.cc:773
void detachWidget(Widget *widget)
Definition layout.cc:350
int currHScrollbarThickness()
Definition layout.cc:723
style::Cursor cursor
Definition layout.hh:167
void updateAnchor()
Definition layout.cc:789
bool emitLinkRelease(Widget *w, int link, int img, int x, int y, EventButton *event)
Definition layout.hh:268
void setCursor(style::Cursor cursor)
Definition layout.cc:809
void scrollIdle()
Definition layout.cc:569
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:1085
void queueDraw(int x, int y, int width, int height)
Definition layout.cc:988
bool scrollIdleNotInterrupted
Definition layout.hh:181
Widget * getWidgetAtPoint(int x, int y)
Definition layout.cc:1129
int scrollTargetWidth
Definition layout.hh:177
void containerSizeChanged()
Definition layout.cc:1340
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:1067
bool drawAfterScrollReq
Definition layout.hh:170
void setWidget(Widget *widget)
Definition layout.cc:432
bool processMouseEvent(MousePositionEvent *event, ButtonEventType type)
Common processing of press, release and motion events.
Definition layout.cc:1241
style::StyleImage * bgImage
Definition layout.hh:162
void setBgColor(style::Color *color)
Definition layout.cc:825
void detachView(View *view)
Definition layout.cc:510
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:750
void leaveNotify(View *view, ButtonState state)
This function is called by a view, to delegate a leave notify event.
Definition layout.cc:1106
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:1001
VPosition scrollTargetVpos
Definition layout.hh:176
void viewportSizeChanged(View *view, int width, int height)
Definition layout.cc:1319
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:370
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:1044
SelectionState selectionState
Definition layout.hh:187
void updateCursor()
Definition layout.cc:817
void resizeIdle()
Definition layout.cc:869
void draw(View *view, Rectangle *area)
Definition layout.cc:669
void moveToWidget(Widget *newWidgetAtPoint, ButtonState state)
Definition layout.cc:1150
void setBgImage(style::StyleImage *bgImage, style::BackgroundRepeat bgRepeat, style::BackgroundAttachment bgAttachment, style::Length bgPositionX, style::Length bgPositionY)
Definition layout.cc:838
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:264
void adjustScrollPos()
Definition layout.cc:631
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:251
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:544
Widget * widgetAtPoint
Definition layout.hh:157
void removeWidget()
Definition layout.cc:405
int getExtremesCounter
Definition layout.hh:249
Widget * topLevel
Definition layout.hh:157
void removeAnchor(Widget *widget, char *name)
Definition layout.cc:783
style::BackgroundAttachment bgAttachment
Definition layout.hh:164
static bool calcScrollInto(int targetValue, int requestedSize, int *value, int viewportSize)
Definition layout.cc:644
int scrollTargetHeight
Definition layout.hh:177
void scrollPosChanged(View *view, int x, int y)
Definition layout.cc:1304
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:538
void scroll(ScrollCommand)
Definition layout.cc:528
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:728
Emitter emitter
Definition layout.hh:143
Layout(Platform *platform)
Definition layout.cc:258
void setAnchor(const char *anchor)
Sets the anchor to scroll to.
Definition layout.cc:737
bool canvasHeightGreater
Definition layout.hh:172
void queueResize(bool extremesChanged)
Definition layout.cc:1024
LayoutImgRenderer * layoutImgRenderer
Definition layout.hh:39
void leaveResizeIdle()
Definition layout.hh:252
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 void scroll(ScrollCommand)
Scroll the viewport as commanded.
Definition view.hh:85
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:470
void sizeAllocate(Allocation *allocation)
Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed.
Definition widget.cc:1126
bool motionNotify(EventMotion *event)
Definition widget.cc:1211
Layout * layout
Definition widget.hh:209
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:203
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:534
Widget * getParent()
Definition widget.hh:573
void enterNotify(EventCrossing *event)
Definition widget.cc:1216
bool needsAllocate()
Definition widget.hh:458
bool resizeQueued()
Definition widget.hh:455
bool buttonRelease(EventButton *event)
Definition widget.cc:1206
Widget * stackingContextWidget
The bottom-most ancestor (or this) for which stackingContextMgr is set.
Definition widget.hh:231
virtual void notifySetAsTopLevel()
This method is called after a widget has been set as the top of a widget tree.
Definition widget.cc:1962
StackingContextMgr * stackingContextMgr
Set iff this widget constitutes a stacking context, as defined by CSS.
Definition widget.hh:225
bool isButtonSensitive()
Definition widget.hh:571
Widget * getNearestCommonAncestor(Widget *otherWidget)
Get the widget with the highest level, which is a direct ancestor of widget1 and widget2.
Definition widget.cc:1546
bool extremesQueued()
Definition widget.hh:456
bool needsResize()
Definition widget.hh:457
virtual Widget * getWidgetAtPoint(int x, int y, GettingWidgetAtPointContext *context)
Definition widget.cc:211
void leaveNotify(EventCrossing *event)
Definition widget.cc:1221
style::Style * style
Definition widget.hh:150
void containerSizeChanged()
Definition widget.cc:408
void unsetFlags(Flags f)
Definition widget.hh:294
void queueResize(int ref, bool extremesChanged, bool fast)
This method should be called, when a widget changes its size.
Definition widget.cc:309
bool buttonPress(EventButton *event)
Definition widget.cc:1201
Widget * getTopLevel()
Get the widget at the root of the tree, this widget is part from.
Definition widget.cc:1495
bool wasAllocated()
Definition widget.hh:461
bool allocateQueued()
Definition widget.hh:459
void setFlags(Flags f)
Definition widget.hh:292
void putExternalImgRenderer(ImgRenderer *ir)
Add an additional ImgRenderer, especially used for drawing.
Definition style.hh:890
void removeExternalImgRenderer(ImgRenderer *ir)
Remove a previously added additional ImgRenderer.
Definition style.hh:896
Typed version of container::untyped::Vector.
Definition container.hh:447
A simple allocator optimized to handle many small chunks of memory.
Definition misc.hh:628
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:428
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:20
T max(T a, T b)
Definition misc.hh:21
void assertNotReached()
Definition misc.hh:36
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