Dillo v3.1.1-46-g8a360e32
Loading...
Searching...
No Matches
dw::core::ui::Embed Class Reference

A widget for embedding UI widgets. More...

#include <ui.hh>

Public Member Functions

 Embed (Resource *resource)
 
 ~Embed ()
 
void setDisplayed (bool displayed)
 
void setEnabled (bool enabled)
 
void draw (View *view, Rectangle *area, DrawingContext *context)
 Area is given in widget coordinates.
 
Iteratoriterator (Content::Type mask, bool atEnd)
 Return an iterator for this widget.
 
void setStyle (style::Style *style)
 Change the style of a widget.
 
ResourcegetResource ()
 
void correctReqWidthOfChildNoRec (Widget *child, Requisition *requisition, bool allowDecreaseWidth)
 
void correctReqHeightOfChildNoRec (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseHeight)
 
virtual void correctExtremesOfChildNoRec (Widget *child, Extremes *extremes, bool useAdjustmentWidth)
 
- Public Member Functions inherited from dw::core::Widget
void setDeleteCallback (DW_Callback_t func, void *data)
 
 Widget ()
 
 ~Widget ()
 
bool resizeQueued ()
 
bool extremesQueued ()
 
bool needsResize ()
 
bool needsAllocate ()
 
bool allocateQueued ()
 
bool extremesChanged ()
 
bool wasAllocated ()
 
void setParent (Widget *parent)
 
void setQuasiParent (Widget *quasiParent)
 
void setGenerator (Widget *generator)
 
style::StylegetStyle ()
 
AllocationgetAllocation ()
 
bool inAllocation (int x, int y)
 
int boxOffsetX ()
 
int boxRestWidth ()
 
int boxDiffWidth ()
 
int boxOffsetY ()
 
int boxRestHeight ()
 
int boxDiffHeight ()
 
virtual int numSizeRequestReferences ()
 See Sizes of Dillo Widgets (or Size requisitions depending on positions).
 
virtual WidgetsizeRequestReference (int index)
 See Sizes of Dillo Widgets (or Size requisitions depending on positions).
 
virtual int numGetExtremesReferences ()
 See Sizes of Dillo Widgets (or Size requisitions depending on positions).
 
virtual WidgetgetExtremesReference (int index)
 See Sizes of Dillo Widgets (or Size requisitions depending on positions).
 
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.
 
void getExtremes (Extremes *extremes, int numPos=0, Widget **references=NULL, int *x=NULL, int *y=NULL)
 Wrapper for Widget::getExtremesImpl().
 
void sizeAllocate (Allocation *allocation)
 Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed.
 
void calcExtraSpace (int numPos, Widget **references, int *x, int *y)
 Calculates dw::core::Widget::extraSpace.
 
int getAvailWidth (bool forceValue)
 Return available width including margin/border/padding (extraSpace?), not only the content width.
 
int getAvailHeight (bool forceValue)
 Return available height including margin/border/padding (extraSpace?), not only the content height.
 
virtual bool getAdjustMinWidth ()
 
void correctRequisition (Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
 
void correctExtremes (Extremes *extremes, bool useAdjustmentWidth)
 
int calcWidth (style::Length cssValue, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue)
 Computes a width value in pixels from cssValue.
 
void calcFinalWidth (style::Style *style, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue, int *finalWidth)
 
int calcHeight (style::Length cssValue, bool usePercentage, int refHeight, Widget *refWidget, bool forceValue)
 
virtual int applyPerWidth (int containerWidth, style::Length perWidth)
 
virtual int applyPerHeight (int containerHeight, style::Length perHeight)
 
int getMinWidth (Extremes *extremes, bool forceValue)
 Used to evaluate Widget::adjustMinWidth.
 
virtual bool isBlockLevel ()
 
virtual bool isPossibleContainer ()
 
void containerSizeChanged ()
 
bool intersects (Widget *refWidget, Rectangle *area, Rectangle *intersection)
 Calculates the intersection of the visible allocation (i.
 
void drawInterruption (View *view, Rectangle *area, DrawingContext *context)
 See Interrupted drawing for details.
 
virtual WidgetgetWidgetAtPoint (int x, int y, GettingWidgetAtPointContext *context)
 
WidgetgetWidgetAtPointInterrupted (int x, int y, GettingWidgetAtPointContext *context)
 
bool buttonPress (EventButton *event)
 
bool buttonRelease (EventButton *event)
 
bool motionNotify (EventMotion *event)
 
void enterNotify (EventCrossing *event)
 
void leaveNotify (EventCrossing *event)
 
void setBgColor (style::Color *bgColor)
 Set the background "behind" the widget, if it is not the background of the parent widget, e.g.
 
style::ColorgetBgColor ()
 Get the actual background of a widget.
 
style::ColorgetFgColor ()
 Get the actual foreground color of a widget.
 
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, height) (widget coordinates).
 
void drawWidgetBox (View *view, Rectangle *area, bool inverse)
 Draw borders and background of a widget.
 
void drawSelected (View *view, Rectangle *area)
 
void setButtonSensitive (bool buttonSensitive)
 
bool isButtonSensitive ()
 
WidgetgetParent ()
 
WidgetgetContainer ()
 
WidgetgetTopLevel ()
 Get the widget at the root of the tree, this widget is part from.
 
int getLevel ()
 Get the level of the widget within the tree.
 
int getGeneratorLevel ()
 Get the level of the widget within the tree, regarting the generators, not the parents.
 
WidgetgetNearestCommonAncestor (Widget *otherWidget)
 Get the widget with the highest level, which is a direct ancestor of widget1 and widget2.
 
WidgetReferencegetWidgetReference ()
 
void setWidgetReference (WidgetReference *widgetReference)
 
WidgetgetGenerator ()
 
LayoutgetLayout ()
 
void scrollTo (HPosition hpos, VPosition vpos, int x, int y, int width, int height)
 
void getMarginArea (int *xMar, int *yMar, int *widthMar, int *heightMar)
 
void getBorderArea (int *xBor, int *yBor, int *widthBor, int *heightBor)
 
void getPaddingArea (int *xPad, int *yPad, int *widthPad, int *heightPad)
 Return the padding area (content plus padding).
 
virtual void removeChild (Widget *child)
 
- Public Member Functions inherited from lout::identity::IdentifiableObject
 IdentifiableObject ()
 
void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer.
 
int getClassId ()
 Returns the class identifier.
 
const char * getClassName ()
 Return the name, under which the class of this object was registered.
 
bool instanceOf (int otherClassId)
 Returns, whether this class is an instance of the class, given by otherClassId, or of a sub class of this class.
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly.
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal.
 
virtual int hashValue ()
 Return a hash value for the object.
 
virtual Objectclone ()
 Return an exact copy of the object.
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object.
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses.
 

Static Public Attributes

static int CLASS_ID = -1
 
- Static Public Attributes inherited from dw::core::Widget
static int CLASS_ID = -1
 

Protected Member Functions

void sizeRequestSimpl (Requisition *requisition)
 Simple variant, to be implemented by widgets with sizes not depending on positions.
 
void getExtremesSimpl (Extremes *extremes)
 Simple variant, to be implemented by widgets with extremes not depending on positions.
 
void sizeAllocateImpl (Allocation *allocation)
 See Sizes of Dillo Widgets.
 
int getAvailWidthOfChild (Widget *child, bool forceValue)
 Computes the content width available of a child widget.
 
int getAvailHeightOfChild (Widget *child, bool forceValue)
 
void correctRequisitionOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
 
void correctExtremesOfChild (Widget *child, Extremes *extremes, bool useAdjustmentWidth)
 
void containerSizeChangedForChildren ()
 
void enterNotifyImpl (core::EventCrossing *event)
 
void leaveNotifyImpl (core::EventCrossing *event)
 
bool buttonPressImpl (core::EventButton *event)
 
- Protected Member Functions inherited from dw::core::Widget
int getHeight ()
 
int getContentWidth ()
 
int getContentHeight ()
 
StackingContextMgrgetNextStackingContextMgr ()
 
void printFlag (Flags f)
 
void setFlags (Flags f)
 
void unsetFlags (Flags f)
 
void queueDraw ()
 
void queueDrawArea (int x, int y, int width, int height)
 
void queueResize (int ref, bool extremesChanged)
 
virtual void sizeRequestImpl (Requisition *requisition, int numPos, Widget **references, int *x, int *y)
 See Sizes of Dillo Widgets.
 
virtual void getExtremesImpl (Extremes *extremes, int numPos, Widget **references, int *x, int *y)
 See Sizes of Dillo Widgets.
 
virtual void calcExtraSpaceImpl (int numPos, Widget **references, int *x, int *y)
 The actual implementation for calculating dw::core::Widget::extraSpace.
 
virtual void resizeDrawImpl ()
 Called after sizeAllocateImpl() to redraw necessary areas.
 
virtual void markSizeChange (int ref)
 See Sizes of Dillo Widgets.
 
virtual void markExtremesChange (int ref)
 See Sizes of Dillo Widgets.
 
void correctReqWidthOfChild (Widget *child, Requisition *requisition, bool allowDecreaseWidth)
 
void correctReqHeightOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseHeight)
 
virtual bool affectedByContainerSizeChange ()
 
virtual bool affectsSizeChangeContainerChild (Widget *child)
 
virtual bool usesAvailWidth ()
 Must be implemengted by a method returning true, when getAvailWidth() is called.
 
virtual bool usesAvailHeight ()
 Must be implemengted by a method returning true, when getAvailHeight() is called.
 
virtual void notifySetAsTopLevel ()
 This method is called after a widget has been set as the top of a widget tree.
 
virtual void notifySetParent ()
 This method is called after a widget has been added to a parent.
 
virtual bool buttonReleaseImpl (EventButton *event)
 
virtual bool motionNotifyImpl (EventMotion *event)
 
char * addAnchor (const char *name)
 
char * addAnchor (const char *name, int y)
 
void changeAnchor (char *name, int y)
 
void removeAnchor (char *name)
 
void setCursor (style::Cursor cursor)
 
bool selectionHandleEvent (SelectionState::EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event)
 
- Protected Member Functions inherited from lout::identity::IdentifiableObject
void registerName (const char *className, int *classId)
 This method must be called in the constructor for the sub class.
 

Private Attributes

Resourceresource
 

Friends

class Resource
 

Additional Inherited Members

- Static Public Member Functions inherited from dw::core::Widget
static void setAdjustMinWidth (bool adjustMinWidth)
 
static void adjustHeight (int *height, bool allowDecreaseHeight, int ascent, int descent)
 
- Public Attributes inherited from dw::core::Widget
int parentRef
 This value is defined by the parent widget, and used for incremential resizing.
 
- Protected Types inherited from dw::core::Widget
enum  Flags {
  RESIZE_QUEUED = 1 << 0 , EXTREMES_QUEUED = 1 << 1 , NEEDS_RESIZE = 1 << 2 , NEEDS_ALLOCATE = 1 << 3 ,
  ALLOCATE_QUEUED = 1 << 4 , EXTREMES_CHANGED = 1 << 5 , WAS_ALLOCATED = 1 << 6
}
 
- Protected Attributes inherited from dw::core::Widget
WidgetImgRendererwidgetImgRenderer
 
Allocation allocation
 The current allocation: size and position, always relative to the canvas.
 
Layoutlayout
 
style::Box extraSpace
 Space around the margin box.
 
StackingContextMgrstackingContextMgr
 Set iff this widget constitutes a stacking context, as defined by CSS.
 
WidgetstackingContextWidget
 The bottom-most ancestor (or this) for which stackingContextMgr is set.
 

Detailed Description

A widget for embedding UI widgets.

See also
dw::core::ui

Definition at line 223 of file ui.hh.

Constructor & Destructor Documentation

◆ Embed()

dw::core::ui::Embed::Embed ( Resource resource)

◆ ~Embed()

dw::core::ui::Embed::~Embed ( )

Definition at line 45 of file ui.cc.

References DBG_OBJ_DELETE, and resource.

Member Function Documentation

◆ buttonPressImpl()

bool dw::core::ui::Embed::buttonPressImpl ( core::EventButton event)
protectedvirtual

Reimplemented from dw::core::Widget.

Definition at line 117 of file ui.cc.

References dw::core::EventButton::button, dw::core::ui::Resource::emitClicked(), and resource.

◆ containerSizeChangedForChildren()

void dw::core::ui::Embed::containerSizeChangedForChildren ( )
protectedvirtual

◆ correctExtremesOfChild()

void dw::core::ui::Embed::correctExtremesOfChild ( Widget child,
Extremes extremes,
bool  useAdjustmentWidth 
)
protectedvirtual

Reimplemented from dw::core::Widget.

Definition at line 92 of file ui.cc.

References dw::core::ui::Resource::correctExtremesOfChild(), dw::core::Widget::extremes, and resource.

◆ correctExtremesOfChildNoRec()

virtual void dw::core::ui::Embed::correctExtremesOfChildNoRec ( Widget child,
Extremes extremes,
bool  useAdjustmentWidth 
)
inlinevirtual

◆ correctReqHeightOfChildNoRec()

void dw::core::ui::Embed::correctReqHeightOfChildNoRec ( Widget child,
Requisition requisition,
void(*)(int, int *, int *)  splitHeightFun,
bool  allowDecreaseHeight 
)
inline

◆ correctRequisitionOfChild()

void dw::core::ui::Embed::correctRequisitionOfChild ( Widget child,
Requisition requisition,
void(*)(int, int *, int *)  splitHeightFun,
bool  allowDecreaseWidth,
bool  allowDecreaseHeight 
)
protectedvirtual

◆ correctReqWidthOfChildNoRec()

void dw::core::ui::Embed::correctReqWidthOfChildNoRec ( Widget child,
Requisition requisition,
bool  allowDecreaseWidth 
)
inline

◆ draw()

void dw::core::ui::Embed::draw ( View view,
Rectangle area,
DrawingContext context 
)
virtual

Area is given in widget coordinates.

Implements dw::core::Widget.

Definition at line 140 of file ui.cc.

References dw::core::ui::Resource::draw(), dw::core::Widget::drawWidgetBox(), and resource.

◆ enterNotifyImpl()

void dw::core::ui::Embed::enterNotifyImpl ( core::EventCrossing event)
protectedvirtual

Reimplemented from dw::core::Widget.

Definition at line 105 of file ui.cc.

References dw::core::ui::Resource::emitEnter(), dw::core::Widget::enterNotifyImpl(), and resource.

◆ getAvailHeightOfChild()

int dw::core::ui::Embed::getAvailHeightOfChild ( Widget child,
bool  forceValue 
)
protectedvirtual

Reimplemented from dw::core::Widget.

Definition at line 76 of file ui.cc.

References dw::core::ui::Resource::getAvailHeightOfChild(), and resource.

◆ getAvailWidthOfChild()

int dw::core::ui::Embed::getAvailWidthOfChild ( Widget child,
bool  forceValue 
)
protectedvirtual

Computes the content width available of a child widget.

Parameters
childThe child widget of which the available width will be computed.
forceValueIf true, computes the width of the child with value "auto". Otherwise, it wont.
Returns
The available width in pixels or -1.

Reimplemented from dw::core::Widget.

Definition at line 71 of file ui.cc.

References dw::core::ui::Resource::getAvailWidthOfChild(), and resource.

◆ getExtremesSimpl()

void dw::core::ui::Embed::getExtremesSimpl ( Extremes extremes)
protectedvirtual

Simple variant, to be implemented by widgets with extremes not depending on positions.

Reimplemented from dw::core::Widget.

Definition at line 58 of file ui.cc.

References dw::core::Extremes::adjustmentWidth, dw::core::Widget::correctExtremes(), dw::core::Widget::extremes, dw::core::ui::Resource::getExtremes(), lout::misc::min(), dw::core::Extremes::minWidth, dw::core::Extremes::minWidthIntrinsic, and resource.

◆ getResource()

Resource * dw::core::ui::Embed::getResource ( )
inline

Definition at line 263 of file ui.hh.

References resource.

◆ iterator()

Iterator * dw::core::ui::Embed::iterator ( Content::Type  mask,
bool  atEnd 
)
virtual

Return an iterator for this widget.

mask can narrow the types returned by the iterator, this can enhance performance quite much, e.g. when only searching for child widgets.

With atEnd == false, the iterator starts before the beginning, i.e. the first call of dw::core::Iterator::next will let the iterator point on the first piece of contents. Likewise, With atEnd == true, the iterator starts after the last piece of contents, call dw::core::Iterator::prev in this case.

Implements dw::core::Widget.

Definition at line 146 of file ui.cc.

References dw::core::ui::Resource::iterator(), and resource.

◆ leaveNotifyImpl()

void dw::core::ui::Embed::leaveNotifyImpl ( core::EventCrossing event)
protectedvirtual

Reimplemented from dw::core::Widget.

Definition at line 111 of file ui.cc.

References dw::core::ui::Resource::emitLeave(), dw::core::Widget::leaveNotifyImpl(), and resource.

◆ setDisplayed()

void dw::core::ui::Embed::setDisplayed ( bool  displayed)

Definition at line 130 of file ui.cc.

References resource, and dw::core::ui::Resource::setDisplayed().

Referenced by Html_tag_open_input().

◆ setEnabled()

void dw::core::ui::Embed::setEnabled ( bool  enabled)

Definition at line 135 of file ui.cc.

References resource, and dw::core::ui::Resource::setEnabled().

◆ setStyle()

void dw::core::ui::Embed::setStyle ( style::Style style)
virtual

Change the style of a widget.

The old style is automatically unreferred, the new is referred. If this call causes the widget to change its size, dw::core::Widget::queueResize is called.

Reimplemented from dw::core::Widget.

Definition at line 151 of file ui.cc.

References resource, dw::core::ui::Resource::setStyle(), dw::core::Widget::setStyle(), and dw::core::Widget::style.

Referenced by main().

◆ sizeAllocateImpl()

void dw::core::ui::Embed::sizeAllocateImpl ( Allocation allocation)
protectedvirtual

◆ sizeRequestSimpl()

void dw::core::ui::Embed::sizeRequestSimpl ( Requisition requisition)
protectedvirtual

Simple variant, to be implemented by widgets with sizes not depending on positions.

Reimplemented from dw::core::Widget.

Definition at line 51 of file ui.cc.

References dw::core::Widget::correctRequisition(), dw::core::Widget::requisition, resource, dw::core::ui::Resource::sizeRequest(), and dw::core::splitHeightPreserveAscent().

Friends And Related Symbol Documentation

◆ Resource

friend class Resource
friend

Definition at line 225 of file ui.hh.

Member Data Documentation

◆ CLASS_ID

int dw::core::ui::Embed::CLASS_ID = -1
static

Definition at line 252 of file ui.hh.

Referenced by Embed().

◆ resource


The documentation for this class was generated from the following files: