Dillo v3.1.1-98-g318d1f14
|
Simple widget used for testing concepts. More...
#include <dw_simple_container.hh>
Classes | |
class | SimpleContainerIterator |
Public Member Functions | |
SimpleContainer () | |
~SimpleContainer () | |
void | draw (core::View *view, core::Rectangle *area, core::DrawingContext *context) |
Area is given in widget coordinates. | |
core::Iterator * | iterator (core::Content::Type mask, bool atEnd) |
Return an iterator for this widget. | |
void | removeChild (Widget *child) |
void | setChild (core::Widget *child) |
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::Style * | getStyle () |
Allocation * | getAllocation () |
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 Widget * | sizeRequestReference (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 Widget * | getExtremesReference (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) |
Computes the final width if posible and constraints it by min-width and max-width. | |
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 Widget * | getWidgetAtPoint (int x, int y, GettingWidgetAtPointContext *context) |
Widget * | getWidgetAtPointInterrupted (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) |
virtual void | setStyle (style::Style *style) |
Change the style of a widget. | |
void | setBgColor (style::Color *bgColor) |
Set the background "behind" the widget, if it is not the background of the parent widget, e.g. | |
style::Color * | getBgColor () |
Get the actual background of a widget. | |
style::Color * | getFgColor () |
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 () |
Widget * | getParent () |
Widget * | getContainer () |
Widget * | getTopLevel () |
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. | |
Widget * | getNearestCommonAncestor (Widget *otherWidget) |
Get the widget with the highest level, which is a direct ancestor of widget1 and widget2. | |
WidgetReference * | getWidgetReference () |
void | setWidgetReference (WidgetReference *widgetReference) |
Widget * | getGenerator () |
Layout * | getLayout () |
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 Object * | clone () |
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 (core::Requisition *requisition) |
Simple variant, to be implemented by widgets with sizes not depending on positions. | |
void | getExtremesSimpl (core::Extremes *extremes) |
Simple variant, to be implemented by widgets with extremes not depending on positions. | |
void | sizeAllocateImpl (core::Allocation *allocation) |
See Sizes of Dillo Widgets. | |
Protected Member Functions inherited from dw::core::Widget | |
int | getHeight () |
int | getContentWidth () |
int | getContentHeight () |
StackingContextMgr * | getNextStackingContextMgr () |
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. | |
virtual int | getAvailWidthOfChild (Widget *child, bool forceValue) |
Computes the content width available of a child widget. | |
virtual int | getAvailHeightOfChild (Widget *child, bool forceValue) |
virtual void | correctRequisitionOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight) |
void | correctRequisitionViewport (Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight) |
Corrects a requisition to fit in the viewport. | |
void | correctReqWidthOfChild (Widget *child, Requisition *requisition, bool allowDecreaseWidth) |
Correct a child requisition to fit the parent. | |
void | correctReqHeightOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseHeight) |
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. | |
virtual void | correctExtremesOfChild (Widget *child, Extremes *extremes, bool useAdjustmentWidth) |
virtual void | containerSizeChangedForChildren () |
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 | buttonPressImpl (EventButton *event) |
virtual bool | buttonReleaseImpl (EventButton *event) |
virtual bool | motionNotifyImpl (EventMotion *event) |
virtual void | enterNotifyImpl (EventCrossing *event) |
virtual void | leaveNotifyImpl (EventCrossing *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 | |
Widget * | child |
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 | |
WidgetImgRenderer * | widgetImgRenderer |
Allocation | allocation |
The current allocation: size and position, always relative to the canvas. | |
float | ratio |
Preferred aspect ratio of the widget. | |
Layout * | layout |
style::Box | extraSpace |
Space around the margin box. | |
StackingContextMgr * | stackingContextMgr |
Set iff this widget constitutes a stacking context, as defined by CSS. | |
Widget * | stackingContextWidget |
The bottom-most ancestor (or this) for which stackingContextMgr is set. | |
Simple widget used for testing concepts.
Definition at line 11 of file dw_simple_container.hh.
dw::SimpleContainer::SimpleContainer | ( | ) |
Definition at line 151 of file dw_simple_container.cc.
References child, CLASS_ID, and lout::identity::IdentifiableObject::registerName().
dw::SimpleContainer::~SimpleContainer | ( | ) |
Definition at line 157 of file dw_simple_container.cc.
References child.
|
virtual |
Area is given in widget coordinates.
Implements dw::core::Widget.
Definition at line 211 of file dw_simple_container.cc.
References child, dw::core::Widget::draw(), dw::core::Widget::drawWidgetBox(), and dw::core::Widget::intersects().
|
protectedvirtual |
Simple variant, to be implemented by widgets with extremes not depending on positions.
Reimplemented from dw::core::Widget.
Definition at line 179 of file dw_simple_container.cc.
References dw::core::Extremes::adjustmentWidth, dw::core::Widget::boxDiffWidth(), child, dw::core::Widget::correctExtremes(), dw::core::Widget::extremes, dw::core::Widget::getExtremes(), dw::core::Extremes::maxWidth, dw::core::Extremes::maxWidthIntrinsic, dw::core::Extremes::minWidth, and dw::core::Extremes::minWidthIntrinsic.
|
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 220 of file dw_simple_container.cc.
void dw::SimpleContainer::removeChild | ( | Widget * | child | ) |
Definition at line 225 of file dw_simple_container.cc.
References child, and dw::core::Widget::queueResize().
void dw::SimpleContainer::setChild | ( | core::Widget * | child | ) |
Definition at line 233 of file dw_simple_container.cc.
References child, dw::core::Widget::queueResize(), and dw::core::Widget::setParent().
Referenced by main().
|
protectedvirtual |
Reimplemented from dw::core::Widget.
Definition at line 197 of file dw_simple_container.cc.
References dw::core::Widget::allocation, dw::core::Allocation::ascent, dw::core::Widget::boxDiffWidth(), dw::core::Widget::boxOffsetX(), dw::core::Widget::boxOffsetY(), dw::core::Widget::boxRestHeight(), child, dw::core::Allocation::descent, dw::core::Widget::sizeAllocate(), dw::core::Allocation::width, dw::core::Allocation::x, and dw::core::Allocation::y.
|
protectedvirtual |
Simple variant, to be implemented by widgets with sizes not depending on positions.
Reimplemented from dw::core::Widget.
Definition at line 163 of file dw_simple_container.cc.
References dw::core::Requisition::ascent, dw::core::Widget::boxDiffWidth(), dw::core::Widget::boxOffsetY(), dw::core::Widget::boxRestHeight(), child, dw::core::Widget::correctRequisition(), dw::core::Requisition::descent, dw::core::Widget::requisition, dw::core::Widget::sizeRequest(), dw::core::splitHeightPreserveAscent(), and dw::core::Requisition::width.
|
private |
Definition at line 34 of file dw_simple_container.hh.
Referenced by draw(), getExtremesSimpl(), dw::SimpleContainer::SimpleContainerIterator::next(), dw::SimpleContainer::SimpleContainerIterator::prev(), removeChild(), setChild(), SimpleContainer(), sizeAllocateImpl(), sizeRequestSimpl(), and ~SimpleContainer().
|
static |
Definition at line 42 of file dw_simple_container.hh.
Referenced by SimpleContainer().