dillo
3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java).
![]() ![]() |
The central class for managing and drawing a widget tree. More...
#include <layout.hh>
Classes | |
class | Anchor |
class | Emitter |
class | LayoutImgRenderer |
class | LinkEmitter |
class | LinkReceiver |
class | Receiver |
Receiver interface different signals. More... | |
Public Member Functions | |
Layout (Platform *platform) | |
~Layout () | |
void | connectLink (LinkReceiver *receiver) |
bool | emitLinkEnter (Widget *w, int link, int img, int x, int y) |
bool | emitLinkPress (Widget *w, int link, int img, int x, int y, EventButton *event) |
bool | emitLinkRelease (Widget *w, int link, int img, int x, int y, EventButton *event) |
bool | emitLinkClick (Widget *w, int link, int img, int x, int y, EventButton *event) |
void | addWidget (Widget *widget) |
void | setWidget (Widget *widget) |
void | attachView (View *view) |
Attach a view to the layout. More... | |
void | detachView (View *view) |
bool | getUsesViewport () |
int | getWidthViewport () |
int | getHeightViewport () |
int | getScrollPosX () |
int | getScrollPosY () |
void | scrollTo (HPosition hpos, VPosition vpos, int x, int y, int width, int height) |
Scrolls all viewports, so that the region [x, y, width, height] is seen, according to hpos and vpos. More... | |
void | scroll (ScrollCommand) |
void | setAnchor (const char *anchor) |
void | expose (View *view, Rectangle *area) |
bool | buttonPress (View *view, int numPressed, int x, int y, ButtonState state, int button) |
This function is called by a view, to delegate a button press event. More... | |
bool | buttonRelease (View *view, int numPressed, int x, int y, ButtonState state, int button) |
This function is called by a view, to delegate a button press event. More... | |
bool | motionNotify (View *view, int x, int y, ButtonState state) |
This function is called by a view, to delegate a motion notify event. More... | |
void | enterNotify (View *view, int x, int y, ButtonState state) |
This function is called by a view, to delegate a enter notify event. More... | |
void | leaveNotify (View *view, ButtonState state) |
This function is called by a view, to delegate a leave notify event. More... | |
void | scrollPosChanged (View *view, int x, int y) |
void | viewportSizeChanged (View *view, int width, int height) |
Platform * | getPlatform () |
int | textWidth (style::Font *font, const char *text, int len) |
char * | textToUpper (const char *text, int len) |
char * | textToLower (const char *text, int len) |
int | nextGlyph (const char *text, int idx) |
int | prevGlyph (const char *text, int idx) |
float | dpiX () |
float | dpiY () |
style::Font * | createFont (style::FontAttrs *attrs, bool tryEverything) |
bool | fontExists (const char *name) |
style::Color * | createColor (int color) |
style::Tooltip * | createTooltip (const char *text) |
void | cancelTooltip () |
Imgbuf * | createImgbuf (Imgbuf::Type type, int width, int height, double gamma) |
void | copySelection (const char *text) |
ui::ResourceFactory * | getResourceFactory () |
void | connect (Receiver *receiver) |
FindtextState::Result | search (const char *str, bool caseSens, int backwards) |
See dw::core::FindtextState::search. More... | |
void | resetSearch () |
See dw::core::FindtextState::resetSearch. More... | |
void | setBgColor (style::Color *color) |
void | setBgImage (style::StyleImage *bgImage, style::BackgroundRepeat bgRepeat, style::BackgroundAttachment bgAttachment, style::Length bgPositionX, style::Length bgPositionY) |
style::Color * | getBgColor () |
style::StyleImage * | getBgImage () |
![]() | |
virtual | ~Object () |
The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. More... | |
virtual bool | equals (Object *other) |
Returns, whether two objects are equal. More... | |
virtual int | hashValue () |
Return a hash value for the object. More... | |
virtual Object * | clone () |
Return an exact copy of the object. More... | |
virtual void | intoStringBuffer (misc::StringBuffer *sb) |
Store a textual representation of the object in a misc::StringBuffer. More... | |
const char * | toString () |
Use object::Object::intoStringBuffer to return a textual representation of the object. More... | |
virtual size_t | sizeOf () |
Return the number of bytes, this object totally uses. More... | |
Public Attributes | |
LinkEmitter | linkEmitter |
lout::misc::ZoneAllocator * | textZone |
Private Types | |
enum | ButtonEventType { BUTTON_PRESS, BUTTON_RELEASE, MOTION_NOTIFY } |
Private Member Functions | |
Widget * | getWidgetAtPoint (int x, int y) |
void | moveToWidget (Widget *newWidgetAtPoint, ButtonState state) |
void | moveToWidgetAtPoint (int x, int y, ButtonState state) |
Emit the necessary crossing events, when the mouse pointer has moved to position (x, );. More... | |
void | moveOutOfView (ButtonState state) |
Emit the necessary crossing events, when the mouse pointer has moved out of the view. More... | |
bool | processMouseEvent (MousePositionEvent *event, ButtonEventType type) |
Common processing of press, release and motion events. More... | |
bool | buttonEvent (ButtonEventType type, View *view, int numPressed, int x, int y, ButtonState state, int button) |
void | resizeIdle () |
void | setSizeHints () |
void | draw (View *view, Rectangle *area) |
void | scrollTo0 (HPosition hpos, VPosition vpos, int x, int y, int width, int height, bool scrollingInterrupted) |
void | scrollIdle () |
void | adjustScrollPos () |
int | currHScrollbarThickness () |
int | currVScrollbarThickness () |
void | updateAnchor () |
char * | addAnchor (Widget *widget, const char *name) |
char * | addAnchor (Widget *widget, const char *name, int y) |
void | changeAnchor (Widget *widget, char *name, int y) |
void | removeAnchor (Widget *widget, char *name) |
void | setCursor (style::Cursor cursor) |
void | updateCursor () |
void | queueDraw (int x, int y, int width, int height) |
void | queueDrawExcept (int x, int y, int width, int height, int ex, int ey, int ewidth, int eheight) |
void | queueResize () |
void | removeWidget () |
Static Private Member Functions | |
static bool | calcScrollInto (int targetValue, int requestedSize, int *value, int viewportSize) |
Friends | |
class | Widget |
The central class for managing and drawing a widget tree.
|
private |
dw::core::Layout::Layout | ( | Platform * | platform | ) |
Definition at line 241 of file layout.cc.
References dw::core::style::CURSOR_DEFAULT, DBG_OBJ_ASSOC_CHILD, DBG_OBJ_CREATE, and dw::core::Platform::setLayout().
dw::core::Layout::~Layout | ( | ) |
Definition at line 283 of file layout.cc.
References DBG_OBJ_DELETE.
|
private |
Used, when the widget is not allocated yet.
Definition at line 658 of file layout.cc.
Referenced by dw::core::Widget::addAnchor().
|
private |
Definition at line 663 of file layout.cc.
References dw::core::Layout::Anchor::name, dw::core::Layout::Anchor::widget, and dw::core::Layout::Anchor::y.
void dw::core::Layout::addWidget | ( | Widget * | widget | ) |
Definition at line 314 of file layout.cc.
References dw::core::Widget::layout, MSG_WARN, and setWidget().
|
private |
Definition at line 545 of file layout.cc.
References _MSG, lout::misc::max(), and lout::misc::min().
void dw::core::Layout::attachView | ( | View * | view | ) |
Attach a view to the layout.
It will become a child of the layout, and so it will be destroyed, when the layout will be destroyed.
Definition at line 379 of file layout.cc.
References DBG_OBJ_ASSOC_CHILD, dw::core::View::getHScrollbarThickness(), dw::core::View::getVScrollbarThickness(), lout::misc::max(), MSG_ERR, dw::core::View::scrollTo(), dw::core::View::setBgColor(), dw::core::View::setCanvasSize(), dw::core::View::setCursor(), dw::core::View::setLayout(), dw::core::View::setViewportSize(), and dw::core::View::usesViewport().
Referenced by dw::fltk::ui::FltkComplexButtonResource::createNewWidget(), dw::fltk::FltkPreview::FltkPreview(), dw::fltk::ui::FltkComplexButtonResource::setLayout(), and UIcmd_tab_new().
|
private |
Definition at line 892 of file layout.cc.
Referenced by buttonPress(), and buttonRelease().
|
inline |
This function is called by a view, to delegate a button press event.
numPressed is 1 for simple presses, 2 for double presses etc. (more that 2 is never needed), x and y the world coordinates, and button the number of the button pressed.
Definition at line 294 of file layout.hh.
References BUTTON_PRESS, buttonEvent(), and view.
Referenced by dw::fltk::FltkViewBase::handle().
|
inline |
This function is called by a view, to delegate a button press event.
Arguments are similar to dw::core::Layout::buttonPress.
Definition at line 306 of file layout.hh.
References BUTTON_RELEASE, buttonEvent(), and view.
Referenced by dw::fltk::FltkViewBase::handle().
|
staticprivate |
|
inline |
Definition at line 382 of file layout.hh.
References dw::core::Platform::cancelTooltip(), and platform.
Referenced by dw::fltk::FltkViewBase::handle().
|
private |
Definition at line 681 of file layout.cc.
References dw::core::Layout::Anchor::widget, and dw::core::Layout::Anchor::y.
Referenced by dw::core::Widget::changeAnchor().
|
inline |
Definition at line 403 of file layout.hh.
References dw::core::Layout::Emitter::connectLayout(), and emitter.
|
inline |
Definition at line 243 of file layout.hh.
References dw::core::Layout::LinkEmitter::connectLink(), and linkEmitter.
Referenced by DilloPlain::DilloPlain().
|
inline |
Definition at line 393 of file layout.hh.
References dw::core::Platform::copySelection(), and platform.
Referenced by a_UIcmd_copy_urlstr().
|
inline |
Definition at line 372 of file layout.hh.
References dw::core::Platform::createColor(), and platform.
Referenced by dw::core::style::Color::create().
|
inline |
Definition at line 362 of file layout.hh.
References dw::core::Platform::createFont(), and platform.
Referenced by dw::core::style::Font::create0().
|
inline |
Definition at line 387 of file layout.hh.
References dw::core::Platform::createImgbuf(), and platform.
|
inline |
Definition at line 377 of file layout.hh.
References dw::core::Platform::createTooltip(), and platform.
Referenced by dw::core::style::Tooltip::create().
void dw::core::Layout::detachView | ( | View * | view | ) |
Definition at line 426 of file layout.cc.
References MSG_ERR, and dw::core::View::setLayout().
|
inline |
Definition at line 352 of file layout.hh.
References dw::core::Platform::dpiX(), and platform.
|
inline |
Definition at line 357 of file layout.hh.
References dw::core::Platform::dpiY(), and platform.
Definition at line 583 of file layout.cc.
References dw::core::style::drawBackgroundImage(), dw::core::View::finishDrawing(), dw::core::Rectangle::height, dw::core::Rectangle::intersectsWith(), lout::misc::max(), dw::core::View::startDrawing(), dw::core::Rectangle::width, dw::core::Rectangle::x, and dw::core::Rectangle::y.
Referenced by expose().
|
inline |
Definition at line 257 of file layout.hh.
References dw::core::Layout::LinkEmitter::emitClick(), and linkEmitter.
|
inline |
Definition at line 246 of file layout.hh.
References dw::core::Layout::LinkEmitter::emitEnter(), and linkEmitter.
|
inline |
Definition at line 249 of file layout.hh.
References dw::core::Layout::LinkEmitter::emitPress(), and linkEmitter.
|
inline |
Definition at line 253 of file layout.hh.
References dw::core::Layout::LinkEmitter::emitRelease(), and linkEmitter.
void dw::core::Layout::enterNotify | ( | View * | view, |
int | x, | ||
int | y, | ||
ButtonState | state | ||
) |
This function is called by a view, to delegate a enter notify event.
Arguments are similar to dw::core::Layout::buttonPress.
Definition at line 933 of file layout.cc.
References dw::core::Widget::enterNotify().
Referenced by dw::fltk::FltkViewBase::handle().
Definition at line 284 of file layout.hh.
Referenced by dw::fltk::FltkViewBase::draw().
|
inline |
Definition at line 367 of file layout.hh.
References dw::core::Platform::fontExists(), and platform.
Referenced by dw::core::style::Font::exists().
|
inline |
Definition at line 420 of file layout.hh.
References bgColor.
Referenced by dw::core::style::drawBackground().
|
inline |
Definition at line 421 of file layout.hh.
References bgImage.
Referenced by dw::core::style::drawBackground().
|
inline |
Definition at line 271 of file layout.hh.
References viewportHeight.
Referenced by dw::core::Iterator::scrollTo().
|
inline |
|
inline |
Definition at line 398 of file layout.hh.
References dw::core::Platform::getResourceFactory(), and platform.
|
inline |
Definition at line 272 of file layout.hh.
References scrollX.
Referenced by a_UIcmd_get_scroll_xy().
|
inline |
Definition at line 273 of file layout.hh.
References scrollY.
Referenced by a_UIcmd_get_scroll_xy().
|
inline |
Definition at line 269 of file layout.hh.
References usesViewport.
Referenced by dw::core::Iterator::scrollTo().
|
private |
|
inline |
Definition at line 270 of file layout.hh.
References viewportWidth.
Referenced by dw::core::Iterator::scrollTo().
void dw::core::Layout::leaveNotify | ( | View * | view, |
ButtonState | state | ||
) |
This function is called by a view, to delegate a leave notify event.
Arguments are similar to dw::core::Layout::buttonPress.
Definition at line 954 of file layout.cc.
References dw::core::Widget::leaveNotify().
Referenced by dw::fltk::FltkViewBase::handle().
bool dw::core::Layout::motionNotify | ( | View * | view, |
int | x, | ||
int | y, | ||
ButtonState | state | ||
) |
This function is called by a view, to delegate a motion notify event.
Arguments are similar to dw::core::Layout::buttonPress.
Definition at line 915 of file layout.cc.
Referenced by dw::fltk::FltkViewBase::handle(), and dw::fltk::FltkViewport::positionChanged().
|
inlineprivate |
Emit the necessary crossing events, when the mouse pointer has moved out of the view.
Definition at line 203 of file layout.hh.
References moveToWidget().
|
private |
Definition at line 992 of file layout.cc.
References _MSG, dw::core::EventCrossing::currentWidget, dw::core::Widget::enterNotify(), dw::core::Widget::getNearestCommonAncestor(), dw::core::Widget::getParent(), dw::core::Widget::getTopLevel(), dw::core::EventCrossing::lastWidget, dw::core::Widget::leaveNotify(), MSG, and dw::core::MouseEvent::state.
Referenced by moveOutOfView(), and moveToWidgetAtPoint().
|
inlineprivate |
Emit the necessary crossing events, when the mouse pointer has moved to position (x, );.
Definition at line 196 of file layout.hh.
References getWidgetAtPoint(), and moveToWidget().
|
inline |
Definition at line 342 of file layout.hh.
References dw::core::Platform::nextGlyph(), and platform.
Referenced by dw::fltk::FltkWidgetView::drawText().
|
inline |
Definition at line 347 of file layout.hh.
References platform, and dw::core::Platform::prevGlyph().
|
private |
Common processing of press, release and motion events.
This function depends on that move_to_widget_at_point() has been called before.
Definition at line 1077 of file layout.cc.
References lout::misc::assertNotReached(), dw::core::Widget::buttonPress(), dw::core::Widget::buttonRelease(), dw::core::Widget::getAllocation(), dw::core::Widget::getParent(), dw::core::Widget::isButtonSensitive(), lout::misc::min(), dw::core::Widget::motionNotify(), dw::core::Allocation::x, dw::core::MousePositionEvent::xCanvas, dw::core::Allocation::y, and dw::core::MousePositionEvent::yCanvas.
|
private |
Definition at line 844 of file layout.cc.
References dw::core::Rectangle::height, dw::core::Rectangle::isEmpty(), dw::core::Rectangle::width, dw::core::Rectangle::x, and dw::core::Rectangle::y.
|
private |
Definition at line 857 of file layout.cc.
References lout::misc::max(), and lout::misc::min().
|
private |
Definition at line 691 of file layout.cc.
Referenced by dw::core::Widget::removeAnchor().
|
private |
|
inline |
See dw::core::FindtextState::resetSearch.
Definition at line 412 of file layout.hh.
References findtextState, and dw::core::FindtextState::resetSearch().
Referenced by a_UIcmd_findtext_reset().
|
private |
Definition at line 777 of file layout.cc.
References dw::core::Allocation::ascent, dw::core::Requisition::ascent, dw::core::Allocation::descent, dw::core::Requisition::descent, dw::core::Allocation::width, dw::core::Requisition::width, dw::core::Allocation::x, and dw::core::Allocation::y.
void dw::core::Layout::scroll | ( | ScrollCommand | cmd | ) |
Definition at line 442 of file layout.cc.
References dw::core::View::scroll().
Referenced by a_UIcmd_scroll().
|
private |
Definition at line 483 of file layout.cc.
References dw::core::HPOS_CENTER, dw::core::HPOS_INTO_VIEW, dw::core::HPOS_LEFT, dw::core::HPOS_NO_CHANGE, dw::core::HPOS_RIGHT, dw::core::VPOS_BOTTOM, dw::core::VPOS_CENTER, dw::core::VPOS_INTO_VIEW, dw::core::VPOS_NO_CHANGE, and dw::core::VPOS_TOP.
void dw::core::Layout::scrollPosChanged | ( | View * | view, |
int | x, | ||
int | y | ||
) |
Definition at line 1140 of file layout.cc.
Referenced by dw::fltk::FltkViewport::scrollTo(), and dw::fltk::FltkPreviewWindow::scrollTo().
void dw::core::Layout::scrollTo | ( | HPosition | hpos, |
VPosition | vpos, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Scrolls all viewports, so that the region [x, y, width, height] is seen, according to hpos and vpos.
Definition at line 452 of file layout.cc.
Referenced by a_UIcmd_set_scroll_xy(), dw::fltk::FltkViewBase::manageTabToFocus(), and dw::core::Iterator::scrollTo().
|
inline |
See dw::core::FindtextState::search.
Definition at line 407 of file layout.hh.
References findtextState, and dw::core::FindtextState::search().
Referenced by a_UIcmd_findtext_search().
void dw::core::Layout::setAnchor | ( | const char * | anchor | ) |
Sets the anchor to scroll to.
Definition at line 645 of file layout.cc.
References _MSG.
Referenced by a_UIcmd_set_scroll_by_fragment().
void dw::core::Layout::setBgColor | ( | style::Color * | color | ) |
Definition at line 733 of file layout.cc.
References dw::core::style::Color::ref().
Referenced by a_Web_dispatch_by_type(), and UIcmd_tab_new().
void dw::core::Layout::setBgImage | ( | style::StyleImage * | bgImage, |
style::BackgroundRepeat | bgRepeat, | ||
style::BackgroundAttachment | bgAttachment, | ||
style::Length | bgPositionX, | ||
style::Length | bgPositionY | ||
) |
Definition at line 746 of file layout.cc.
References dw::core::style::StyleImage::putExternalImgRenderer(), dw::core::style::StyleImage::ref(), dw::core::style::StyleImage::removeExternalImgRenderer(), and dw::core::style::StyleImage::unref().
Referenced by a_Web_dispatch_by_type(), and UIcmd_tab_new().
|
private |
Definition at line 717 of file layout.cc.
Referenced by dw::core::Widget::setCursor().
void dw::core::Layout::setWidget | ( | Widget * | widget | ) |
Definition at line 357 of file layout.cc.
References DBG_OBJ_ASSOC_CHILD.
Referenced by a_Web_dispatch_by_type(), and addWidget().
|
inline |
Definition at line 337 of file layout.hh.
References platform, and dw::core::Platform::textToLower().
|
inline |
Definition at line 332 of file layout.hh.
References platform, and dw::core::Platform::textToUpper().
|
inline |
Definition at line 327 of file layout.hh.
References platform, and dw::core::Platform::textWidth().
Referenced by dw::TableCell::getValue().
|
private |
Definition at line 697 of file layout.cc.
References dw::core::HPOS_NO_CHANGE, dw::core::VPOS_TOP, and dw::core::Layout::Anchor::y.
|
private |
Definition at line 725 of file layout.cc.
References dw::core::style::CURSOR_DEFAULT.
void dw::core::Layout::viewportSizeChanged | ( | View * | view, |
int | width, | ||
int | height | ||
) |
Definition at line 1155 of file layout.cc.
References _MSG.
Referenced by dw::fltk::FltkViewport::resize(), and dw::fltk::FltkViewBase::setLayout().
|
private |
|
private |
|
private |
Definition at line 158 of file layout.hh.
Referenced by getBgColor().
|
private |
Definition at line 159 of file layout.hh.
Referenced by getBgImage().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 185 of file layout.hh.
Referenced by resetSearch(), and search().
|
private |
LinkEmitter dw::core::Layout::linkEmitter |
Definition at line 123 of file layout.hh.
Referenced by connectLink(), emitLinkClick(), emitLinkEnter(), emitLinkPress(), and emitLinkRelease().
|
private |
Definition at line 153 of file layout.hh.
Referenced by cancelTooltip(), copySelection(), createColor(), createFont(), createImgbuf(), createTooltip(), dpiX(), dpiY(), fontExists(), getPlatform(), getResourceFactory(), nextGlyph(), prevGlyph(), textToLower(), textToUpper(), and textWidth().
|
private |
Definition at line 168 of file layout.hh.
Referenced by getScrollPosX().
|
private |
Definition at line 168 of file layout.hh.
Referenced by getScrollPosY().
|
private |
Definition at line 184 of file layout.hh.
Referenced by dw::core::Widget::selectionHandleEvent().
lout::misc::ZoneAllocator* dw::core::Layout::textZone |
|
private |
Definition at line 167 of file layout.hh.
Referenced by getUsesViewport().
|
private |
Definition at line 154 of file layout.hh.
Referenced by buttonPress(), buttonRelease(), and expose().
|
private |
Definition at line 168 of file layout.hh.
Referenced by getHeightViewport().
|
private |
Definition at line 168 of file layout.hh.
Referenced by getWidthViewport().