Dillo v3.1.1-111-gd4f56d0d
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
205
206 inline int getHeight () { return allocation.ascent + allocation.descent; }
207 inline int getContentWidth() { return allocation.width - boxDiffWidth (); }
208 inline int getContentHeight() { return getHeight () - boxDiffHeight (); }
209
214 float ratio;
215
217
227
233
239
242
243 /*inline void printFlags () {
244 DBG_IF_RTFL {
245 char buf[10 * 3 - 1 + 1];
246 snprintf (buf, sizeof (buf), "%s:%s:%s:%s:%s:%s:%s",
247 (flags & RESIZE_QUEUED) ? "Rq" : "--",
248 (flags & EXTREMES_QUEUED) ? "Eq" : "--",
249 (flags & NEEDS_RESIZE) ? "nR" : "--",
250 (flags & NEEDS_ALLOCATE) ? "nA" : "--",
251 (flags & ALLOCATE_QUEUED) ? "Aq" : "--",
252 (flags & EXTREMES_CHANGED) ? "Ec" : "--",
253 (flags & WAS_ALLOCATED) ? "wA" : "--");
254 DBG_OBJ_SET_SYM ("flags", buf);
255 }
256 }*/
257
258 inline void printFlag (Flags f) {
260 switch (f) {
261 case RESIZE_QUEUED:
262 DBG_OBJ_SET_SYM ("flags.RESIZE_QUEUED",
263 (flags & RESIZE_QUEUED) ? "true" : "false");
264 break;
265
266 case EXTREMES_QUEUED:
267 DBG_OBJ_SET_SYM ("flags.EXTREMES_QUEUED",
268 (flags & EXTREMES_QUEUED) ? "true" : "false");
269 break;
270
271 case NEEDS_RESIZE:
272 DBG_OBJ_SET_SYM ("flags.NEEDS_RESIZE",
273 (flags & NEEDS_RESIZE) ? "true" : "false");
274 break;
275
276 case NEEDS_ALLOCATE:
277 DBG_OBJ_SET_SYM ("flags.NEEDS_ALLOCATE",
278 (flags & NEEDS_ALLOCATE) ? "true" : "false");
279 break;
280
281 case ALLOCATE_QUEUED:
282 DBG_OBJ_SET_SYM ("flags.ALLOCATE_QUEUED",
283 (flags & ALLOCATE_QUEUED) ? "true" : "false");
284 break;
285
286 case EXTREMES_CHANGED:
287 DBG_OBJ_SET_SYM ("flags.EXTREMES_CHANGED",
288 (flags & EXTREMES_CHANGED) ? "true" : "false");
289 break;
290
291 case WAS_ALLOCATED:
292 DBG_OBJ_SET_SYM ("flags.WAS_ALLOCATED",
293 (flags & WAS_ALLOCATED) ? "true" : "false");
294 break;
295 }
296 }
297 }
298
299 inline void setFlags (Flags f)
300 { flags = (Flags)(flags | f); printFlag (f); }
301 inline void unsetFlags (Flags f)
302 { flags = (Flags)(flags & ~f); printFlag (f); }
303
304 inline void queueDraw ()
306 void queueDrawArea (int x, int y, int width, int height);
307 inline void queueResize (int ref, bool extremesChanged)
308 { queueResize (ref, extremesChanged, false); }
309
313 virtual void sizeRequestImpl (Requisition *requisition, int numPos,
314 Widget **references, int *x, int *y);
315
321
325 virtual void getExtremesImpl (Extremes *extremes, int numPos,
326 Widget **references, int *x, int *y);
327
332 virtual void getExtremesSimpl (Extremes *extremes);
333
334 virtual void calcExtraSpaceImpl (int numPos, Widget **references, int *x,
335 int *y);
336
340 virtual void sizeAllocateImpl (Allocation *allocation);
341
346 virtual void resizeDrawImpl () { queueDraw (); };
347
351 virtual void markSizeChange (int ref);
352
356 virtual void markExtremesChange (int ref);
357
358 virtual int getAvailWidthOfChild (Widget *child, bool forceValue);
359 virtual int getAvailHeightOfChild (Widget *child, bool forceValue);
360
361 virtual void correctRequisitionOfChild (Widget *child,
363 void (*splitHeightFun) (int, int*,
364 int*),
365 bool allowDecreaseWidth,
366 bool allowDecreaseHeight);
368 void (*splitHeightFun) (int, int*, int*),
369 bool allowDecreaseWidth, bool allowDecreaseHeight);
371 bool allowDecreaseWidth);
373 void (*splitHeightFun) (int, int*, int*),
374 bool allowDecreaseHeight);
375 bool correctReqAspectRatio (int pass, Widget *child, Requisition *requisition,
376 bool allowDecreaseWidth, bool allowDecreaseHeight,
377 void (*splitHeightFun) (int, int*, int*));
378 virtual void correctExtremesOfChild (Widget *child, Extremes *extremes,
379 bool useAdjustmentWidth);
380
381 virtual void containerSizeChangedForChildren ();
382
383 virtual bool affectedByContainerSizeChange ();
384 virtual bool affectsSizeChangeContainerChild (Widget *child);
385 virtual bool usesAvailWidth ();
386 virtual bool usesAvailHeight ();
387
388 virtual void notifySetAsTopLevel();
389 virtual void notifySetParent();
390
391 virtual bool buttonPressImpl (EventButton *event);
392 virtual bool buttonReleaseImpl (EventButton *event);
393 virtual bool motionNotifyImpl (EventMotion *event);
394 virtual void enterNotifyImpl (EventCrossing *event);
395 virtual void leaveNotifyImpl (EventCrossing *event);
396
397 inline char *addAnchor (const char* name)
398 { return layout->addAnchor (this, name); }
399
400 inline char *addAnchor (const char* name, int y)
401 { return layout->addAnchor (this, name, y); }
402
403 inline void changeAnchor (char* name, int y)
404 { layout->changeAnchor (this, name, y); }
405
406 inline void removeAnchor (char* name)
407 { if (layout) layout->removeAnchor (this, name); }
408
409 //inline void updateBgColor () { layout->updateBgColor (); }
410
411 inline void setCursor (style::Cursor cursor)
412 { layout->setCursor (cursor); }
413#if 0
414 inline bool selectionButtonPress (Iterator *it, int charPos, int linkNo,
415 EventButton *event, bool withinContent)
416 { return layout->selectionState.buttonPress (it, charPos, linkNo, event); }
417
418 inline bool selectionButtonRelease (Iterator *it, int charPos, int linkNo,
419 EventButton *event, bool withinContent)
420 { return layout->selectionState.buttonRelease (it, charPos, linkNo, event);}
421
422 inline bool selectionButtonMotion (Iterator *it, int charPos, int linkNo,
423 EventMotion *event, bool withinContent)
424 { return layout->selectionState.buttonMotion (it, charPos, linkNo, event); }
425#endif
427 Iterator *it, int charPos, int linkNo,
428 MousePositionEvent *event)
429 { return layout->selectionState.handleEvent (eventType, it, charPos, linkNo,
430 event); }
431
432private:
435
436public:
437 inline void setDeleteCallback(DW_Callback_t func, void *data)
438 { deleteCallbackFunc = func; deleteCallbackData = data; }
439
440private:
442
446
450
454
458
459
460public:
461 static int CLASS_ID;
462
465
466 Widget ();
467 ~Widget ();
468
469 inline bool resizeQueued () { return flags & RESIZE_QUEUED; }
470 inline bool extremesQueued () { return flags & EXTREMES_QUEUED; }
471 inline bool needsResize () { return flags & NEEDS_RESIZE; }
472 inline bool needsAllocate () { return flags & NEEDS_ALLOCATE; }
473 inline bool allocateQueued () { return flags & ALLOCATE_QUEUED; }
474 inline bool extremesChanged () { return flags & EXTREMES_CHANGED; }
475 inline bool wasAllocated () { return flags & WAS_ALLOCATED; }
476
477 void setParent (Widget *parent);
479
480 void setGenerator (Widget *generator) { this->generator = generator; }
481
482 inline style::Style *getStyle () { return style; }
484 inline Allocation *getAllocation () { return &allocation; }
485 inline bool inAllocation (int x, int y) {
486 return wasAllocated () && x >= allocation.x && y >= allocation.y &&
487 x <= allocation.x + allocation.width &&
488 y <= allocation.y + getHeight ();
489 }
490
491 inline int boxOffsetX ()
492 { return extraSpace.left + getStyle()->boxOffsetX (); }
493 inline int boxRestWidth ()
494 { return extraSpace.right + getStyle()->boxRestWidth (); }
495 inline int boxDiffWidth () { return boxOffsetX () + boxRestWidth (); }
496 inline int boxOffsetY ()
497 { return extraSpace.top + getStyle()->boxOffsetY (); }
498 inline int boxRestHeight ()
499 { return extraSpace.bottom + getStyle()->boxRestHeight (); }
500 inline int boxDiffHeight () { return boxOffsetY () + boxRestHeight (); }
501
505 virtual int numSizeRequestReferences ();
506
510 virtual Widget *sizeRequestReference (int index);
511
515 virtual int numGetExtremesReferences ();
516
520 virtual Widget *getExtremesReference (int index);
521
522 void sizeRequest (Requisition *requisition, int numPos = 0,
523 Widget **references = NULL, int *x = NULL, int *y = NULL);
524 void getExtremes (Extremes *extremes, int numPos = 0,
525 Widget **references = NULL, int *x = NULL, int *y = NULL);
527
528 void calcExtraSpace (int numPos, Widget **references, int *x, int *y);
529
530 int getAvailWidth (bool forceValue);
531 int getAvailHeight (bool forceValue);
532 virtual bool getAdjustMinWidth () { return Widget::adjustMinWidth; }
534 void (*splitHeightFun) (int, int*, int*),
535 bool allowDecreaseWidth, bool allowDecreaseHeight);
536 void correctExtremes (Extremes *extremes, bool useAdjustmentWidth);
537 int calcWidth (style::Length cssValue, int refWidth, Widget *refWidget,
538 int limitMinWidth, bool forceValue);
539 void calcFinalWidth (style::Style *style, int refWidth, Widget *refWidget,
540 int limitMinWidth, bool forceValue, int *finalWidth);
541 int calcHeight (style::Length cssValue, bool usePercentage, int refHeight,
542 Widget *refWidget, bool forceValue);
543 static void adjustHeight (int *height, bool allowDecreaseHeight, int ascent,
544 int descent);
545
546 virtual int applyPerWidth (int containerWidth, style::Length perWidth);
547 virtual int applyPerHeight (int containerHeight, style::Length perHeight);
548
549 int getMinWidth (Extremes *extremes, bool forceValue);
550
551 virtual bool isBlockLevel ();
552 virtual bool isPossibleContainer ();
553
554 void containerSizeChanged ();
555
556 bool intersects (Widget *refWidget, Rectangle *area,
557 Rectangle *intersection);
558
560 virtual void draw (View *view, Rectangle *area, DrawingContext *context) = 0;
561 void drawInterruption (View *view, Rectangle *area, DrawingContext *context);
562
563 virtual Widget *getWidgetAtPoint (int x, int y,
565 Widget *getWidgetAtPointInterrupted (int x, int y,
567
568 bool buttonPress (EventButton *event);
569 bool buttonRelease (EventButton *event);
570 bool motionNotify (EventMotion *event);
571 void enterNotify (EventCrossing *event);
572 void leaveNotify (EventCrossing *event);
573
574 virtual void setStyle (style::Style *style);
578
579 void drawBox (View *view, style::Style *style, Rectangle *area,
580 int x, int y, int width, int height, bool inverse);
581 void drawWidgetBox (View *view, Rectangle *area, bool inverse);
582 void drawSelected (View *view, Rectangle *area);
583
585 inline bool isButtonSensitive () { return buttonSensitive; }
586
587 inline Widget *getParent () { return parent; }
588 inline Widget *getContainer () { return container; }
590 int getLevel ();
591 int getGeneratorLevel ();
592 Widget *getNearestCommonAncestor (Widget *otherWidget);
593
596 this->widgetReference = widgetReference;
597 DBG_OBJ_SET_PTR ("widgetReference", widgetReference);
598 }
599
600 inline Widget *getGenerator () { return generator ? generator : parent; }
601
602 inline Layout *getLayout () { return layout; }
603
604 void scrollTo (HPosition hpos, VPosition vpos,
605 int x, int y, int width, int height);
606
607 void getMarginArea (int *xMar, int *yMar, int *widthMar, int *heightMar);
608 void getBorderArea (int *xBor, int *yBor, int *widthBor, int *heightBor);
609 void getPaddingArea (int *xPad, int *yPad, int *widthPad, int *heightPad);
610
624 virtual Iterator *iterator (Content::Type mask, bool atEnd) = 0;
625
626 virtual void removeChild (Widget *child);
627};
628
629void splitHeightPreserveAscent (int height, int *ascent, int *descent);
630void splitHeightPreserveDescent (int height, int *ascent, int *descent);
631
632} // namespace core
633} // namespace dw
634
635#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:774
void setCursor(style::Cursor cursor)
Definition layout.cc:810
char * addAnchor(Widget *widget, const char *name)
Used, when the widget is not allocated yet.
Definition layout.cc:751
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:784
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:45
style::Style * getStyle()
Return the style this background image is part of.
Definition widget.cc:62
void getBgArea(int *x, int *y, int *width, int *height)
Return the area covered by the background image.
Definition widget.cc:50
void getRefArea(int *xRef, int *yRef, int *widthRef, int *heightRef)
Return the "reference area".
Definition widget.cc:56
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:67
The base class of all dillo widgets.
Definition widget.hh:44
char * addAnchor(const char *name)
Definition widget.hh:397
virtual void notifySetParent()
This method is called after a widget has been added to a parent.
Definition widget.cc:2188
virtual void setStyle(style::Style *style)
Change the style of a widget.
Definition widget.cc:1316
void setGenerator(Widget *generator)
Definition widget.hh:480
void leaveSizeRequest()
Definition widget.hh:452
Allocation * getAllocation()
Definition widget.hh:484
WidgetImgRenderer * widgetImgRenderer
Definition widget.hh:119
virtual void leaveNotifyImpl(EventCrossing *event)
Definition widget.cc:2227
void sizeAllocate(Allocation *allocation)
Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed.
Definition widget.cc:1209
bool queueResizeEntered()
Definition widget.hh:445
bool motionNotify(EventMotion *event)
Definition widget.cc:1294
void setWidgetReference(WidgetReference *widgetReference)
Definition widget.hh:595
Extremes extremes
Analogue to dw::core::Widget::requisition.
Definition widget.hh:166
Layout * layout
Definition widget.hh:216
Widget * container
The containing widget, equivalent to the "containing block" defined by CSS.
Definition widget.hh:146
void enterQueueResize()
Definition widget.hh:443
SizeParams requisitionParams
Definition widget.hh:161
virtual bool usesAvailWidth()
Must be implemengted by a method returning true, when getAvailWidth() is called.
Definition widget.cc:528
StackingContextMgr * getNextStackingContextMgr()
Definition widget.hh:240
bool intersects(Widget *refWidget, Rectangle *area, Rectangle *intersection)
Calculates the intersection of the visible allocation (i.
Definition widget.cc:151
void setQuasiParent(Widget *quasiParent)
Definition widget.cc:288
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition widget.hh:204
static void adjustHeight(int *height, bool allowDecreaseHeight, int ascent, int descent)
Definition widget.cc:1083
virtual bool affectedByContainerSizeChange()
Definition widget.cc:445
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:1450
void leaveGetExtremes()
Definition widget.hh:456
virtual void draw(View *view, Rectangle *area, DrawingContext *context)=0
Area is given in widget coordinates.
void setButtonSensitive(bool buttonSensitive)
Definition widget.cc:1568
virtual void markExtremesChange(int ref)
See Sizes of Dillo Widgets.
Definition widget.cc:1753
@ 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:1779
void setDeleteCallback(DW_Callback_t func, void *data)
Definition widget.hh:437
virtual bool affectsSizeChangeContainerChild(Widget *child)
Definition widget.cc:479
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
int boxDiffWidth()
Definition widget.hh:495
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:665
bool sizeRequestEntered()
Definition widget.hh:453
static void setAdjustMinWidth(bool adjustMinWidth)
Definition widget.hh:463
void enterNotify(EventCrossing *event)
Definition widget.cc:1299
void calcFinalWidth(style::Style *style, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue, int *finalWidth)
Computes the final width if posible and constraints it by min-width and max-width.
Definition widget.cc:991
void drawWidgetBox(View *view, Rectangle *area, bool inverse)
Draw borders and background of a widget.
Definition widget.cc:1512
bool needsAllocate()
Definition widget.hh:472
void correctRequisition(Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
Definition widget.cc:820
void drawSelected(View *view, Rectangle *area)
Definition widget.cc:1563
void calcExtraSpace(int numPos, Widget **references, int *x, int *y)
Calculates dw::core::Widget::extraSpace.
Definition widget.cc:1164
bool sizeAllocateEntered()
Definition widget.hh:449
virtual bool getAdjustMinWidth()
Definition widget.hh:532
style::Style * getStyle()
Definition widget.hh:482
int getLevel()
Get the level of the widget within the tree.
Definition widget.cc:1593
bool resizeQueued()
Definition widget.hh:469
virtual void removeChild(Widget *child)
Definition widget.cc:2236
virtual bool motionNotifyImpl(EventMotion *event)
Definition widget.cc:2214
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
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:232
Requisition requisition
Size_request() stores the result of the last call of size_request_impl().
Definition widget.hh:160
Widget * getGenerator()
Definition widget.hh:600
Widget * getWidgetAtPointInterrupted(int x, int y, GettingWidgetAtPointContext *context)
Definition widget.cc:234
virtual void enterNotifyImpl(EventCrossing *event)
Definition widget.cc:2219
style::Box extraSpace
Space around the margin box.
Definition widget.hh:226
int calcWidth(style::Length cssValue, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue)
Computes a width value in pixels from cssValue.
Definition widget.cc:932
virtual void getExtremesSimpl(Extremes *extremes)
Simple variant, to be implemented by widgets with extremes not depending on positions.
Definition widget.cc:1725
void queueDrawArea(int x, int y, int width, int height)
Definition widget.cc:297
virtual int getAvailHeightOfChild(Widget *child, bool forceValue)
Definition widget.cc:1836
bool selectionHandleEvent(SelectionState::EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event)
Definition widget.hh:426
bool resizeIdleEntered()
Definition widget.hh:441
bool isButtonSensitive()
Definition widget.hh:585
bool inAllocation(int x, int y)
Definition widget.hh:485
virtual void correctRequisitionOfChild(Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
Definition widget.cc:1893
Widget * getNearestCommonAncestor(Widget *otherWidget)
Get the widget with the highest level, which is a direct ancestor of widget1 and widget2.
Definition widget.cc:1629
virtual void sizeAllocateImpl(Allocation *allocation)
See Sizes of Dillo Widgets.
Definition widget.cc:1731
void setCursor(style::Cursor cursor)
Definition widget.hh:411
bool extremesQueued()
Definition widget.hh:470
WidgetReference * getWidgetReference()
Definition widget.hh:594
bool extremesChanged()
Definition widget.hh:474
virtual void correctExtremesOfChild(Widget *child, Extremes *extremes, bool useAdjustmentWidth)
Definition widget.cc:2128
void changeAnchor(char *name, int y)
Definition widget.hh:403
bool getExtremesEntered()
Definition widget.hh:457
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:602
virtual void sizeRequestSimpl(Requisition *requisition)
Simple variant, to be implemented by widgets with sizes not depending on positions.
Definition widget.cc:1710
void * deleteCallbackData
Definition widget.hh:433
char * addAnchor(const char *name, int y)
Definition widget.hh:400
int getMinWidth(Extremes *extremes, bool forceValue)
Used to evaluate Widget::adjustMinWidth.
Definition widget.cc:620
virtual void calcExtraSpaceImpl(int numPos, Widget **references, int *x, int *y)
The actual implementation for calculating dw::core::Widget::extraSpace.
Definition widget.cc:1744
virtual void resizeDrawImpl()
Called after sizeAllocateImpl() to redraw necessary areas.
Definition widget.hh:346
virtual bool buttonPressImpl(EventButton *event)
Definition widget.cc:2204
void setParent(Widget *parent)
Definition widget.cc:243
virtual bool isPossibleContainer()
Definition widget.cc:2198
DW_Callback_t deleteCallbackFunc
Definition widget.hh:434
int boxRestWidth()
Definition widget.hh:493
virtual void getExtremesImpl(Extremes *extremes, int numPos, Widget **references, int *x, int *y)
See Sizes of Dillo Widgets.
Definition widget.cc:1716
void queueResizeFast(int ref, bool extremesChanged)
Definition widget.hh:185
int getContentHeight()
Definition widget.hh:208
bool needsResize()
Definition widget.hh:471
virtual void containerSizeChangedForChildren()
Definition widget.cc:509
void scrollTo(HPosition hpos, VPosition vpos, int x, int y, int width, int height)
Definition widget.cc:1659
int boxRestHeight()
Definition widget.hh:498
void enterSizeAllocate()
Definition widget.hh:447
Widget * getContainer()
Definition widget.hh:588
int calcHeight(style::Length cssValue, bool usePercentage, int refHeight, Widget *refWidget, bool forceValue)
Definition widget.cc:1037
virtual Widget * getWidgetAtPoint(int x, int y, GettingWidgetAtPointContext *context)
Definition widget.cc:223
virtual int applyPerHeight(int containerHeight, style::Length perHeight)
Definition widget.cc:1763
void leaveNotify(EventCrossing *event)
Definition widget.cc:1304
void drawInterruption(View *view, Rectangle *area, DrawingContext *context)
See Interrupted drawing for details.
Definition widget.cc:213
bool correctReqAspectRatio(int pass, Widget *child, Requisition *requisition, bool allowDecreaseWidth, bool allowDecreaseHeight, void(*splitHeightFun)(int, int *, int *))
Correct a child requisition aspect ratio if needed.
Definition widget.cc:1958
virtual int numGetExtremesReferences()
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1190
virtual Widget * sizeRequestReference(int index)
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1184
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:705
void leaveQueueResize()
Definition widget.hh:444
style::Style * style
Definition widget.hh:150
static bool adjustMinWidth
Definition widget.hh:122
void containerSizeChanged()
Definition widget.cc:420
int getGeneratorLevel()
Get the level of the widget within the tree, regarting the generators, not the parents.
Definition widget.cc:1612
void leaveSizeAllocate()
Definition widget.hh:448
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
virtual void sizeRequestImpl(Requisition *requisition, int numPos, Widget **references, int *x, int *y)
See Sizes of Dillo Widgets.
Definition widget.cc:1701
bool buttonPress(EventButton *event)
Definition widget.cc:1284
void correctReqHeightOfChild(Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseHeight)
Definition widget.cc:2077
virtual bool usesAvailHeight()
Must be implemengted by a method returning true, when getAvailHeight() is called.
Definition widget.cc:537
virtual void markSizeChange(int ref)
See Sizes of Dillo Widgets.
Definition widget.cc:1749
Widget * getTopLevel()
Get the widget at the root of the tree, this widget is part from.
Definition widget.cc:1578
style::Color * getBgColor()
Get the actual background of a widget.
Definition widget.cc:1431
bool wasAllocated()
Definition widget.hh:475
virtual int numSizeRequestReferences()
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1179
virtual Widget * getExtremesReference(int index)
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition widget.cc:1195
void getBorderArea(int *xBor, int *yBor, int *widthBor, int *heightBor)
Definition widget.cc:1674
void printFlag(Flags f)
Definition widget.hh:258
int boxDiffHeight()
Definition widget.hh:500
void setBgColor(style::Color *bgColor)
Set the background "behind" the widget, if it is not the background of the parent widget,...
Definition widget.cc:1423
void queueDraw()
Definition widget.hh:304
WidgetReference * widgetReference
Definition widget.hh:148
void removeAnchor(char *name)
Definition widget.hh:406
virtual int applyPerWidth(int containerWidth, style::Length perWidth)
Definition widget.cc:1757
void correctExtremes(Extremes *extremes, bool useAdjustmentWidth)
Definition widget.cc:870
void getMarginArea(int *xMar, int *yMar, int *widthMar, int *heightMar)
Definition widget.cc:1666
bool allocateQueued()
Definition widget.hh:473
void getPaddingArea(int *xPad, int *yPad, int *widthPad, int *heightPad)
Return the padding area (content plus padding).
Definition widget.cc:1690
void queueResize(int ref, bool extremesChanged)
Definition widget.hh:307
virtual bool buttonReleaseImpl(EventButton *event)
Definition widget.cc:2209
SizeParams extremesParams
Definition widget.hh:167
float ratio
Preferred aspect ratio of the widget.
Definition widget.hh:214
void setFlags(Flags f)
Definition widget.hh:299
void correctReqWidthOfChild(Widget *child, Requisition *requisition, bool allowDecreaseWidth)
Correct a child requisition to fit the parent.
Definition widget.cc:2056
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:1093
void enterGetExtremes()
Definition widget.hh:455
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:1471
Widget * quasiParent
...
Definition widget.hh:132
static int CLASS_ID
Definition widget.hh:461
bool buttonSensitive
See dw::core::Widget::setButtonSensitive().
Definition widget.hh:177
int getContentWidth()
Definition widget.hh:207
void enterSizeRequest()
Definition widget.hh:451
virtual bool isBlockLevel()
Definition widget.cc:2192
void correctRequisitionViewport(Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
Corrects a requisition to fit in the viewport.
Definition widget.cc:768
Represents a dimension box according to the CSS box model.
Definition style.hh:505
Suitable for widgets and parts of widgets.
Definition style.hh:857
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:429
void splitHeightPreserveDescent(int height, int *ascent, int *descent)
Definition widget.cc:2258
VPosition
Definition types.hh:26
void splitHeightPreserveAscent(int height, int *ascent, int *descent)
Definition widget.cc:2244
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