Dillo v3.1.1-46-g8a360e32
Loading...
Searching...
No Matches
widget.hh
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2023-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#ifndef __DW_WIDGET_HH__
22#define __DW_WIDGET_HH__
23
24#ifndef __INCLUDED_FROM_DW_CORE_HH__
25# error Do not include this file directly, use "core.hh" instead.
26#endif
27
28#include "../lout/identity.hh"
29
33typedef void (*DW_Callback_t)(void *data);
34
35namespace dw {
36namespace core {
37
44{
45 friend class Layout;
46
47protected:
48 enum Flags {
52 RESIZE_QUEUED = 1 << 0,
53
58
65 NEEDS_RESIZE = 1 << 2,
66
77
82
90
96 WAS_ALLOCATED = 1 << 6,
97 };
98
105 {
106 private:
108
109 public:
110 inline WidgetImgRenderer (Widget *widget) { this->widget = widget; }
111
112 bool readyToDraw ();
113 void getBgArea (int *x, int *y, int *width, int *height);
114 void getRefArea (int *xRef, int *yRef, int *widthRef, int *heightRef);
116 void draw (int x, int y, int width, int height);
117 };
118
120
121private:
122 static bool adjustMinWidth;
123
128
133
140
147
149
151
153
162
168
173
178
183
184 void queueResize (int ref, bool extremesChanged, bool fast);
185 inline void queueResizeFast (int ref, bool extremesChanged)
186 { queueResize (ref, extremesChanged, true); }
187
188public:
196
197protected:
198
204
205 inline int getHeight () { return allocation.ascent + allocation.descent; }
206 inline int getContentWidth() { return allocation.width - boxDiffWidth (); }
207 inline int getContentHeight() { return getHeight () - boxDiffHeight (); }
208
210
220
226
232
235
236 /*inline void printFlags () {
237 DBG_IF_RTFL {
238 char buf[10 * 3 - 1 + 1];
239 snprintf (buf, sizeof (buf), "%s:%s:%s:%s:%s:%s:%s",
240 (flags & RESIZE_QUEUED) ? "Rq" : "--",
241 (flags & EXTREMES_QUEUED) ? "Eq" : "--",
242 (flags & NEEDS_RESIZE) ? "nR" : "--",
243 (flags & NEEDS_ALLOCATE) ? "nA" : "--",
244 (flags & ALLOCATE_QUEUED) ? "Aq" : "--",
245 (flags & EXTREMES_CHANGED) ? "Ec" : "--",
246 (flags & WAS_ALLOCATED) ? "wA" : "--");
247 DBG_OBJ_SET_SYM ("flags", buf);
248 }
249 }*/
250
251 inline void printFlag (Flags f) {
253 switch (f) {
254 case RESIZE_QUEUED:
255 DBG_OBJ_SET_SYM ("flags.RESIZE_QUEUED",
256 (flags & RESIZE_QUEUED) ? "true" : "false");
257 break;
258
259 case EXTREMES_QUEUED:
260 DBG_OBJ_SET_SYM ("flags.EXTREMES_QUEUED",
261 (flags & EXTREMES_QUEUED) ? "true" : "false");
262 break;
263
264 case NEEDS_RESIZE:
265 DBG_OBJ_SET_SYM ("flags.NEEDS_RESIZE",
266 (flags & NEEDS_RESIZE) ? "true" : "false");
267 break;
268
269 case NEEDS_ALLOCATE:
270 DBG_OBJ_SET_SYM ("flags.NEEDS_ALLOCATE",
271 (flags & NEEDS_ALLOCATE) ? "true" : "false");
272 break;
273
274 case ALLOCATE_QUEUED:
275 DBG_OBJ_SET_SYM ("flags.ALLOCATE_QUEUED",
276 (flags & ALLOCATE_QUEUED) ? "true" : "false");
277 break;
278
279 case EXTREMES_CHANGED:
280 DBG_OBJ_SET_SYM ("flags.EXTREMES_CHANGED",
281 (flags & EXTREMES_CHANGED) ? "true" : "false");
282 break;
283
284 case WAS_ALLOCATED:
285 DBG_OBJ_SET_SYM ("flags.WAS_ALLOCATED",
286 (flags & WAS_ALLOCATED) ? "true" : "false");
287 break;
288 }
289 }
290 }
291
292 inline void setFlags (Flags f)
293 { flags = (Flags)(flags | f); printFlag (f); }
294 inline void unsetFlags (Flags f)
295 { flags = (Flags)(flags & ~f); printFlag (f); }
296
297 inline void queueDraw ()
299 void queueDrawArea (int x, int y, int width, int height);
300 inline void queueResize (int ref, bool extremesChanged)
301 { queueResize (ref, extremesChanged, false); }
302
306 virtual void sizeRequestImpl (Requisition *requisition, int numPos,
307 Widget **references, int *x, int *y);
308
314
318 virtual void getExtremesImpl (Extremes *extremes, int numPos,
319 Widget **references, int *x, int *y);
320
325 virtual void getExtremesSimpl (Extremes *extremes);
326
327 virtual void calcExtraSpaceImpl (int numPos, Widget **references, int *x,
328 int *y);
329
333 virtual void sizeAllocateImpl (Allocation *allocation);
334
339 virtual void resizeDrawImpl () { queueDraw (); };
340
344 virtual void markSizeChange (int ref);
345
349 virtual void markExtremesChange (int ref);
350
351 virtual int getAvailWidthOfChild (Widget *child, bool forceValue);
352 virtual int getAvailHeightOfChild (Widget *child, bool forceValue);
353 virtual void correctRequisitionOfChild (Widget *child,
355 void (*splitHeightFun) (int, int*,
356 int*),
357 bool allowDecreaseWidth,
358 bool allowDecreaseHeight);
360 bool allowDecreaseWidth);
362 void (*splitHeightFun) (int, int*, int*),
363 bool allowDecreaseHeight);
364 virtual void correctExtremesOfChild (Widget *child, Extremes *extremes,
365 bool useAdjustmentWidth);
366
367 virtual void containerSizeChangedForChildren ();
368
369 virtual bool affectedByContainerSizeChange ();
370 virtual bool affectsSizeChangeContainerChild (Widget *child);
371 virtual bool usesAvailWidth ();
372 virtual bool usesAvailHeight ();
373
374 virtual void notifySetAsTopLevel();
375 virtual void notifySetParent();
376
377 virtual bool buttonPressImpl (EventButton *event);
378 virtual bool buttonReleaseImpl (EventButton *event);
379 virtual bool motionNotifyImpl (EventMotion *event);
380 virtual void enterNotifyImpl (EventCrossing *event);
381 virtual void leaveNotifyImpl (EventCrossing *event);
382
383 inline char *addAnchor (const char* name)
384 { return layout->addAnchor (this, name); }
385
386 inline char *addAnchor (const char* name, int y)
387 { return layout->addAnchor (this, name, y); }
388
389 inline void changeAnchor (char* name, int y)
390 { layout->changeAnchor (this, name, y); }
391
392 inline void removeAnchor (char* name)
393 { if (layout) layout->removeAnchor (this, name); }
394
395 //inline void updateBgColor () { layout->updateBgColor (); }
396
397 inline void setCursor (style::Cursor cursor)
398 { layout->setCursor (cursor); }
399#if 0
400 inline bool selectionButtonPress (Iterator *it, int charPos, int linkNo,
401 EventButton *event, bool withinContent)
402 { return layout->selectionState.buttonPress (it, charPos, linkNo, event); }
403
404 inline bool selectionButtonRelease (Iterator *it, int charPos, int linkNo,
405 EventButton *event, bool withinContent)
406 { return layout->selectionState.buttonRelease (it, charPos, linkNo, event);}
407
408 inline bool selectionButtonMotion (Iterator *it, int charPos, int linkNo,
409 EventMotion *event, bool withinContent)
410 { return layout->selectionState.buttonMotion (it, charPos, linkNo, event); }
411#endif
413 Iterator *it, int charPos, int linkNo,
414 MousePositionEvent *event)
415 { return layout->selectionState.handleEvent (eventType, it, charPos, linkNo,
416 event); }
417
418private:
421
422public:
423 inline void setDeleteCallback(DW_Callback_t func, void *data)
424 { deleteCallbackFunc = func; deleteCallbackData = data; }
425
426private:
428
432
436
440
444
445
446public:
447 static int CLASS_ID;
448
451
452 Widget ();
453 ~Widget ();
454
455 inline bool resizeQueued () { return flags & RESIZE_QUEUED; }
456 inline bool extremesQueued () { return flags & EXTREMES_QUEUED; }
457 inline bool needsResize () { return flags & NEEDS_RESIZE; }
458 inline bool needsAllocate () { return flags & NEEDS_ALLOCATE; }
459 inline bool allocateQueued () { return flags & ALLOCATE_QUEUED; }
460 inline bool extremesChanged () { return flags & EXTREMES_CHANGED; }
461 inline bool wasAllocated () { return flags & WAS_ALLOCATED; }
462
463 void setParent (Widget *parent);
465
466 void setGenerator (Widget *generator) { this->generator = generator; }
467
468 inline style::Style *getStyle () { return style; }
470 inline Allocation *getAllocation () { return &allocation; }
471 inline bool inAllocation (int x, int y) {
472 return wasAllocated () && x >= allocation.x && y >= allocation.y &&
473 x <= allocation.x + allocation.width &&
474 y <= allocation.y + getHeight ();
475 }
476
477 inline int boxOffsetX ()
478 { return extraSpace.left + getStyle()->boxOffsetX (); }
479 inline int boxRestWidth ()
480 { return extraSpace.right + getStyle()->boxRestWidth (); }
481 inline int boxDiffWidth () { return boxOffsetX () + boxRestWidth (); }
482 inline int boxOffsetY ()
483 { return extraSpace.top + getStyle()->boxOffsetY (); }
484 inline int boxRestHeight ()
485 { return extraSpace.bottom + getStyle()->boxRestHeight (); }
486 inline int boxDiffHeight () { return boxOffsetY () + boxRestHeight (); }
487
491 virtual int numSizeRequestReferences ();
492
496 virtual Widget *sizeRequestReference (int index);
497
501 virtual int numGetExtremesReferences ();
502
506 virtual Widget *getExtremesReference (int index);
507
508 void sizeRequest (Requisition *requisition, int numPos = 0,
509 Widget **references = NULL, int *x = NULL, int *y = NULL);
510 void getExtremes (Extremes *extremes, int numPos = 0,
511 Widget **references = NULL, int *x = NULL, int *y = NULL);
513
514 void calcExtraSpace (int numPos, Widget **references, int *x, int *y);
515
516 int getAvailWidth (bool forceValue);
517 int getAvailHeight (bool forceValue);
518 virtual bool getAdjustMinWidth () { return Widget::adjustMinWidth; }
520 void (*splitHeightFun) (int, int*, int*),
521 bool allowDecreaseWidth, bool allowDecreaseHeight);
522 void correctExtremes (Extremes *extremes, bool useAdjustmentWidth);
523 int calcWidth (style::Length cssValue, int refWidth, Widget *refWidget,
524 int limitMinWidth, bool forceValue);
525 void calcFinalWidth (style::Style *style, int refWidth, Widget *refWidget,
526 int limitMinWidth, bool forceValue, int *finalWidth);
527 int calcHeight (style::Length cssValue, bool usePercentage, int refHeight,
528 Widget *refWidget, bool forceValue);
529 static void adjustHeight (int *height, bool allowDecreaseHeight, int ascent,
530 int descent);
531
532 virtual int applyPerWidth (int containerWidth, style::Length perWidth);
533 virtual int applyPerHeight (int containerHeight, style::Length perHeight);
534
535 int getMinWidth (Extremes *extremes, bool forceValue);
536
537 virtual bool isBlockLevel ();
538 virtual bool isPossibleContainer ();
539
540 void containerSizeChanged ();
541
542 bool intersects (Widget *refWidget, Rectangle *area,
543 Rectangle *intersection);
544
546 virtual void draw (View *view, Rectangle *area, DrawingContext *context) = 0;
547 void drawInterruption (View *view, Rectangle *area, DrawingContext *context);
548
549 virtual Widget *getWidgetAtPoint (int x, int y,
551 Widget *getWidgetAtPointInterrupted (int x, int y,
553
554 bool buttonPress (EventButton *event);
555 bool buttonRelease (EventButton *event);
556 bool motionNotify (EventMotion *event);
557 void enterNotify (EventCrossing *event);
558 void leaveNotify (EventCrossing *event);
559
560 virtual void setStyle (style::Style *style);
564
565 void drawBox (View *view, style::Style *style, Rectangle *area,
566 int x, int y, int width, int height, bool inverse);
567 void drawWidgetBox (View *view, Rectangle *area, bool inverse);
568 void drawSelected (View *view, Rectangle *area);
569
571 inline bool isButtonSensitive () { return buttonSensitive; }
572
573 inline Widget *getParent () { return parent; }
574 inline Widget *getContainer () { return container; }
576 int getLevel ();
577 int getGeneratorLevel ();
578 Widget *getNearestCommonAncestor (Widget *otherWidget);
579
582 this->widgetReference = widgetReference;
583 DBG_OBJ_SET_PTR ("widgetReference", widgetReference);
584 }
585
586 inline Widget *getGenerator () { return generator ? generator : parent; }
587
588 inline Layout *getLayout () { return layout; }
589
590 void scrollTo (HPosition hpos, VPosition vpos,
591 int x, int y, int width, int height);
592
593 void getMarginArea (int *xMar, int *yMar, int *widthMar, int *heightMar);
594 void getBorderArea (int *xBor, int *yBor, int *widthBor, int *heightBor);
595 void getPaddingArea (int *xPad, int *yPad, int *widthPad, int *heightPad);
596
610 virtual Iterator *iterator (Content::Type mask, bool atEnd) = 0;
611
612 virtual void removeChild (Widget *child);
613};
614
615void splitHeightPreserveAscent (int height, int *ascent, int *descent);
616void splitHeightPreserveDescent (int height, int *ascent, int *descent);
617
618} // namespace core
619} // namespace dw
620
621#endif // __DW_WIDGET_HH__
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
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
The central class for managing and drawing a widget tree.
Definition layout.hh:17
void changeAnchor(Widget *widget, char *name, int y)
Definition layout.cc:773
void setCursor(style::Cursor cursor)
Definition layout.cc:809
char * addAnchor(Widget *widget, const char *name)
Used, when the widget is not allocated yet.
Definition layout.cc:750
int sizeRequestCounter
Definition layout.hh:249
int queueResizeCounter
Definition layout.hh:248
SelectionState selectionState
Definition layout.hh:187
int sizeAllocateCounter
Definition layout.hh:248
int getExtremesCounter
Definition layout.hh:249
void removeAnchor(Widget *widget, char *name)
Definition layout.cc:783
int resizeIdleCounter
Definition layout.hh:248
Base class for all mouse events related to a specific position.
Definition events.hh:49
dw::core::Shape implemtation for simple rectangles.
Definition types.hh:70
bool handleEvent(EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event)
General form of dw::core::SelectionState::buttonPress, dw::core::SelectionState::buttonRelease and dw...
Definition selection.cc:233
bool buttonPress(Iterator *it, int charPos, int linkNo, EventButton *event)
Definition selection.cc:93
bool buttonRelease(Iterator *it, int charPos, int linkNo, EventButton *event)
Definition selection.cc:159
bool buttonMotion(Iterator *it, int charPos, int linkNo, EventMotion *event)
Definition selection.cc:210
Hold arguments passed to dw::core::Widget::sizeRequest and dw::core::Widget::getExtremes,...
Definition tools.hh:19
See Handling stacking contexts.
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
Implementation which represents the whole widget.
Definition widget.hh:105
bool readyToDraw()
If this method returns false, nothing is done at all.
Definition widget.cc:35
style::Style * getStyle()
Return the style this background image is part of.
Definition widget.cc:52
void getBgArea(int *x, int *y, int *width, int *height)
Return the area covered by the background image.
Definition widget.cc:40
void getRefArea(int *xRef, int *yRef, int *widthRef, int *heightRef)
Return the "reference area".
Definition widget.cc:46
void draw(int x, int y, int width, int height)
Draw (or queue for drawing) an area, which is given in canvas coordinates.
Definition widget.cc:57
The base class of all dillo widgets.
Definition widget.hh:44
char * addAnchor(const char *name)
Definition widget.hh:383
virtual void notifySetParent()
This method is called after a widget has been added to a parent.
Definition widget.cc:1971
virtual void setStyle(style::Style *style)
Change the style of a widget.
Definition widget.cc:1233
void setGenerator(Widget *generator)
Definition widget.hh:466
void leaveSizeRequest()
Definition widget.hh:438
Allocation * getAllocation()
Definition widget.hh:470
WidgetImgRenderer * widgetImgRenderer
Definition widget.hh:119
virtual void leaveNotifyImpl(EventCrossing *event)
Definition widget.cc:2010
void sizeAllocate(Allocation *allocation)
Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed.
Definition widget.cc:1126
bool queueResizeEntered()
Definition widget.hh:431
bool motionNotify(EventMotion *event)
Definition widget.cc:1211
void setWidgetReference(WidgetReference *widgetReference)
Definition widget.hh:581
Extremes extremes
Analogue to dw::core::Widget::requisition.
Definition widget.hh:166
Layout * layout
Definition widget.hh:209
Widget * container
The containing widget, equivalent to the "containing block" defined by CSS.
Definition widget.hh:146
void enterQueueResize()
Definition widget.hh:429
SizeParams requisitionParams
Definition widget.hh:161
virtual bool usesAvailWidth()
Must be implemengted by a method returning true, when getAvailWidth() is called.
Definition widget.cc:516
StackingContextMgr * getNextStackingContextMgr()
Definition widget.hh:233
bool intersects(Widget *refWidget, Rectangle *area, Rectangle *intersection)
Calculates the intersection of the visible allocation (i.
Definition widget.cc:139
void setQuasiParent(Widget *quasiParent)
Definition widget.cc:276
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition widget.hh:203
static void adjustHeight(int *height, bool allowDecreaseHeight, int ascent, int descent)
Definition widget.cc:1004
virtual bool affectedByContainerSizeChange()
Definition widget.cc:433
virtual Iterator * iterator(Content::Type mask, bool atEnd)=0
Return an iterator for this widget.
style::Color * getFgColor()
Get the actual foreground color of a widget.
Definition widget.cc:1367
void leaveGetExtremes()
Definition widget.hh:442
virtual void draw(View *view, Rectangle *area, DrawingContext *context)=0
Area is given in widget coordinates.
void setButtonSensitive(bool buttonSensitive)
Definition widget.cc:1485
virtual void markExtremesChange(int ref)
See Sizes of Dillo Widgets.
Definition widget.cc:1670
@ NEEDS_ALLOCATE
Only used internally, set to enforce size allocation.
Definition widget.hh:76
@ WAS_ALLOCATED
Set, when a widget was already once allocated,.
Definition widget.hh:96
@ 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
virtual int getAvailWidthOfChild(Widget *child, bool forceValue)
Computes the content width available of a child widget.
Definition widget.cc:1696
void setDeleteCallback(DW_Callback_t func, void *data)
Definition widget.hh:423
virtual bool affectsSizeChangeContainerChild(Widget *child)
Definition widget.cc:467
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
int boxDiffWidth()
Definition widget.hh:481
int parentRef
This value is defined by the parent widget, and used for incremential resizing.
Definition widget.hh:195
int getAvailWidth(bool forceValue)
Return available width including margin/border/padding (extraSpace?), not only the content width.
Definition widget.cc:649
bool sizeRequestEntered()
Definition widget.hh:439
static void setAdjustMinWidth(bool adjustMinWidth)
Definition widget.hh:449
void enterNotify(EventCrossing *event)
Definition widget.cc:1216
void calcFinalWidth(style::Style *style, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue, int *finalWidth)
Definition widget.cc:927
void drawWidgetBox(View *view, Rectangle *area, bool inverse)
Draw borders and background of a widget.
Definition widget.cc:1429
bool needsAllocate()
Definition widget.hh:458
void correctRequisition(Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
Definition widget.cc:744
void drawSelected(View *view, Rectangle *area)
Definition widget.cc:1480
void calcExtraSpace(int numPos, Widget **references, int *x, int *y)
Calculates dw::core::Widget::extraSpace.
Definition widget.cc:1085
bool sizeAllocateEntered()
Definition widget.hh:435
virtual bool getAdjustMinWidth()
Definition widget.hh:518
style::Style * getStyle()
Definition widget.hh:468
int getLevel()
Get the level of the widget within the tree.
Definition widget.cc:1510
bool resizeQueued()
Definition widget.hh:455
virtual void removeChild(Widget *child)
Definition widget.cc:2019
virtual bool motionNotifyImpl(EventMotion *event)
Definition widget.cc:1997
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
style::Color * bgColor
See dw::core::Widget::setBgColor().
Definition widget.hh:172
StackingContextMgr * stackingContextMgr
Set iff this widget constitutes a stacking context, as defined by CSS.
Definition widget.hh:225
Requisition requisition
Size_request() stores the result of the last call of size_request_impl().
Definition widget.hh:160
Widget * getGenerator()
Definition widget.hh:586
Widget * getWidgetAtPointInterrupted(int x, int y, GettingWidgetAtPointContext *context)
Definition widget.cc:222
virtual void enterNotifyImpl(EventCrossing *event)
Definition widget.cc:2002
style::Box extraSpace
Space around the margin box.
Definition widget.hh:219
int calcWidth(style::Length cssValue, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue)
Computes a width value in pixels from cssValue.
Definition widget.cc:883
virtual void getExtremesSimpl(Extremes *extremes)
Simple variant, to be implemented by widgets with extremes not depending on positions.
Definition widget.cc:1642
void queueDrawArea(int x, int y, int width, int height)
Definition widget.cc:285
virtual int getAvailHeightOfChild(Widget *child, bool forceValue)
Definition widget.cc:1753
bool selectionHandleEvent(SelectionState::EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event)
Definition widget.hh:412
bool resizeIdleEntered()
Definition widget.hh:427
bool isButtonSensitive()
Definition widget.hh:571
bool inAllocation(int x, int y)
Definition widget.hh:471
virtual void correctRequisitionOfChild(Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
Definition widget.cc:1810
Widget * getNearestCommonAncestor(Widget *otherWidget)
Get the widget with the highest level, which is a direct ancestor of widget1 and widget2.
Definition widget.cc:1546
virtual void sizeAllocateImpl(Allocation *allocation)
See Sizes of Dillo Widgets.
Definition widget.cc:1648
void setCursor(style::Cursor cursor)
Definition widget.hh:397
bool extremesQueued()
Definition widget.hh:456
WidgetReference * getWidgetReference()
Definition widget.hh:580
bool extremesChanged()
Definition widget.hh:460
virtual void correctExtremesOfChild(Widget *child, Extremes *extremes, bool useAdjustmentWidth)
Definition widget.cc:1911
void changeAnchor(char *name, int y)
Definition widget.hh:389
bool getExtremesEntered()
Definition widget.hh:443
Widget * generator
The generating widget, NULL for top-level widgets, or if not set; in the latter case,...
Definition widget.hh:139
Layout * getLayout()
Definition widget.hh:588
virtual void sizeRequestSimpl(Requisition *requisition)
Simple variant, to be implemented by widgets with sizes not depending on positions.
Definition widget.cc:1627
void * deleteCallbackData
Definition widget.hh:419
char * addAnchor(const char *name, int y)
Definition widget.hh:386
int getMinWidth(Extremes *extremes, bool forceValue)
Used to evaluate Widget::adjustMinWidth.
Definition widget.cc:604
virtual void calcExtraSpaceImpl(int numPos, Widget **references, int *x, int *y)
The actual implementation for calculating dw::core::Widget::extraSpace.
Definition widget.cc:1661
virtual void resizeDrawImpl()
Called after sizeAllocateImpl() to redraw necessary areas.
Definition widget.hh:339
virtual bool buttonPressImpl(EventButton *event)
Definition widget.cc:1987
void setParent(Widget *parent)
Definition widget.cc:231
virtual bool isPossibleContainer()
Definition widget.cc:1981
DW_Callback_t deleteCallbackFunc
Definition widget.hh:420
int boxRestWidth()
Definition widget.hh:479
virtual void getExtremesImpl(Extremes *extremes, int numPos, Widget **references, int *x, int *y)
See Sizes of Dillo Widgets.
Definition widget.cc:1633
void queueResizeFast(int ref, bool extremesChanged)
Definition widget.hh:185
int getContentHeight()
Definition widget.hh:207
bool needsResize()
Definition widget.hh:457
virtual void containerSizeChangedForChildren()
Definition widget.cc:497
void scrollTo(HPosition hpos, VPosition vpos, int x, int y, int width, int height)
Definition widget.cc:1576
int boxRestHeight()
Definition widget.hh:484
void enterSizeAllocate()
Definition widget.hh:433
Widget * getContainer()
Definition widget.hh:574
int calcHeight(style::Length cssValue, bool usePercentage, int refHeight, Widget *refWidget, bool forceValue)
Definition widget.cc:958
virtual Widget * getWidgetAtPoint(int x, int y, GettingWidgetAtPointContext *context)
Definition widget.cc:211
virtual int applyPerHeight(int containerHeight, style::Length perHeight)
Definition widget.cc:1680
void leaveNotify(EventCrossing *event)
Definition widget.cc:1221
void drawInterruption(View *view, Rectangle *area, DrawingContext *context)
See Interrupted drawing for details.
Definition widget.cc:201
virtual int numGetExtremesReferences()
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1111
virtual Widget * sizeRequestReference(int index)
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1105
Widget * parent
The parent widget, NULL for top-level widgets.
Definition widget.hh:127
int getAvailHeight(bool forceValue)
Return available height including margin/border/padding (extraSpace?), not only the content height.
Definition widget.cc:691
void leaveQueueResize()
Definition widget.hh:430
style::Style * style
Definition widget.hh:150
static bool adjustMinWidth
Definition widget.hh:122
void containerSizeChanged()
Definition widget.cc:408
int getGeneratorLevel()
Get the level of the widget within the tree, regarting the generators, not the parents.
Definition widget.cc:1529
void leaveSizeAllocate()
Definition widget.hh:434
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
virtual void sizeRequestImpl(Requisition *requisition, int numPos, Widget **references, int *x, int *y)
See Sizes of Dillo Widgets.
Definition widget.cc:1618
bool buttonPress(EventButton *event)
Definition widget.cc:1201
void correctReqHeightOfChild(Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseHeight)
Definition widget.cc:1867
virtual bool usesAvailHeight()
Must be implemengted by a method returning true, when getAvailHeight() is called.
Definition widget.cc:525
virtual void markSizeChange(int ref)
See Sizes of Dillo Widgets.
Definition widget.cc:1666
Widget * getTopLevel()
Get the widget at the root of the tree, this widget is part from.
Definition widget.cc:1495
style::Color * getBgColor()
Get the actual background of a widget.
Definition widget.cc:1348
bool wasAllocated()
Definition widget.hh:461
virtual int numSizeRequestReferences()
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1100
virtual Widget * getExtremesReference(int index)
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1116
void getBorderArea(int *xBor, int *yBor, int *widthBor, int *heightBor)
Definition widget.cc:1591
void printFlag(Flags f)
Definition widget.hh:251
int boxDiffHeight()
Definition widget.hh:486
void setBgColor(style::Color *bgColor)
Set the background "behind" the widget, if it is not the background of the parent widget,...
Definition widget.cc:1340
void queueDraw()
Definition widget.hh:297
WidgetReference * widgetReference
Definition widget.hh:148
void removeAnchor(char *name)
Definition widget.hh:392
virtual int applyPerWidth(int containerWidth, style::Length perWidth)
Definition widget.cc:1674
void correctExtremes(Extremes *extremes, bool useAdjustmentWidth)
Definition widget.cc:821
void getMarginArea(int *xMar, int *yMar, int *widthMar, int *heightMar)
Definition widget.cc:1583
bool allocateQueued()
Definition widget.hh:459
void getPaddingArea(int *xPad, int *yPad, int *widthPad, int *heightPad)
Return the padding area (content plus padding).
Definition widget.cc:1607
void queueResize(int ref, bool extremesChanged)
Definition widget.hh:300
virtual bool buttonReleaseImpl(EventButton *event)
Definition widget.cc:1992
SizeParams extremesParams
Definition widget.hh:167
void setFlags(Flags f)
Definition widget.hh:292
void correctReqWidthOfChild(Widget *child, Requisition *requisition, bool allowDecreaseWidth)
Definition widget.cc:1846
bool buttonSensitiveSet
See dw::core::Widget::setButtonSensitive().
Definition widget.hh:182
void getExtremes(Extremes *extremes, int numPos=0, Widget **references=NULL, int *x=NULL, int *y=NULL)
Wrapper for Widget::getExtremesImpl().
Definition widget.cc:1014
void enterGetExtremes()
Definition widget.hh:441
void drawBox(View *view, style::Style *style, Rectangle *area, int x, int y, int width, int height, bool inverse)
Draw borders and background of a widget part, which allocation is given by (x, y, width,...
Definition widget.cc:1388
Widget * quasiParent
...
Definition widget.hh:132
static int CLASS_ID
Definition widget.hh:447
bool buttonSensitive
See dw::core::Widget::setButtonSensitive().
Definition widget.hh:177
int getContentWidth()
Definition widget.hh:206
void enterSizeRequest()
Definition widget.hh:437
virtual bool isBlockLevel()
Definition widget.cc:1975
Represents a dimension box according to the CSS box model.
Definition style.hh:504
Suitable for widgets and parts of widgets.
Definition style.hh:855
Instances of classes, which are sub classes of this class, may be identified at run-time.
Definition identity.hh:99
#define DBG_IF_RTFL
Definition debug.hh:73
#define DBG_OBJ_SET_SYM(var, val)
#define DBG_OBJ_SET_PTR(var, val)
int Length
Type for representing all lengths within dw::core::style.
Definition style.hh:428
void splitHeightPreserveDescent(int height, int *ascent, int *descent)
Definition widget.cc:2041
VPosition
Definition types.hh:26
void splitHeightPreserveAscent(int height, int *ascent, int *descent)
Definition widget.cc:2027
HPosition
Definition types.hh:16
Dw is in this namespace, or sub namespaces of this one.
Represents the allocation, i.e.
Definition types.hh:164
void(* DW_Callback_t)(void *data)
The type for callback functions.
Definition widget.hh:33