dw::core::Layout Class Reference

The central class for managing and drawing a widget tree. More...

#include <layout.hh>

List of all members.

Classes

class  Anchor
class  Emitter
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.
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.
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.
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.
bool motionNotify (View *view, int x, int y, ButtonState state)
 This function is called by a view, to delegate a motion notify event.
void enterNotify (View *view, int x, int y, ButtonState state)
 This function is called by a view, to delegate a enter notify event.
void leaveNotify (View *view, ButtonState state)
 This function is called by a view, to delegate a leave notify event.
void scrollPosChanged (View *view, int x, int y)
void viewportSizeChanged (View *view, int width, int height)
int textWidth (style::Font *font, const char *text, int len)
int nextGlyph (const char *text, int idx)
int prevGlyph (const char *text, int idx)
float dpiX ()
float dpiY ()
style::FontcreateFont (style::FontAttrs *attrs, bool tryEverything)
bool fontExists (const char *name)
style::ColorcreateColor (int color)
style::TooltipcreateTooltip (const char *text)
void cancelTooltip ()
ImgbufcreateImgbuf (Imgbuf::Type type, int width, int height)
void copySelection (const char *text)
ui::ResourceFactorygetResourceFactory ()
void connect (Receiver *receiver)
FindtextState::Result search (const char *str, bool caseSens, int backwards)
 See dw::core::FindtextState::search.
void resetSearch ()
 See dw::core::FindtextState::resetSearch.
void setBgColor (style::Color *color)
style::ColorgetBgColor ()

Public Attributes

LinkEmitter linkEmitter
lout::misc::ZoneAllocatortextZone

Private Types

enum  ButtonEventType { BUTTON_PRESS, BUTTON_RELEASE, MOTION_NOTIFY }

Private Member Functions

WidgetgetWidgetAtPoint (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, );.
void moveOutOfView (ButtonState state)
 Emit the necessary crossing events, when the mouse pointer has moved out of the view.
bool processMouseEvent (MousePositionEvent *event, ButtonEventType type, bool mayBeSuppressed)
 Common processing of press, release and motion events.
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 ()
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)

Private Attributes

Emitter emitter
Platformplatform
Viewview
WidgettopLevel
WidgetwidgetAtPoint
style::ColorbgColor
style::Cursor cursor
int canvasWidth
int canvasAscent
int canvasDescent
bool usesViewport
bool drawAfterScrollReq
int scrollX
int scrollY
int viewportWidth
int viewportHeight
bool canvasHeightGreater
int hScrollbarThickness
int vScrollbarThickness
HPosition scrollTargetHpos
VPosition scrollTargetVpos
int scrollTargetX
int scrollTargetY
int scrollTargetWidth
int scrollTargetHeight
char * requestedAnchor
int scrollIdleId
int resizeIdleId
bool scrollIdleNotInterrupted
lout::container::typed::HashTable
< lout::object::String, Anchor > * 
anchorsTable
SelectionState selectionState
FindtextState findtextState

Friends

class Widget


Detailed Description

The central class for managing and drawing a widget tree.

See also:
Dillo Widget Overview, Layout and Widgets, Layout and Views

Member Enumeration Documentation

Enumerator:
BUTTON_PRESS 
BUTTON_RELEASE 
MOTION_NOTIFY 


Constructor & Destructor Documentation

dw::core::Layout::Layout ( Platform platform  ) 

dw::core::Layout::~Layout (  ) 


Member Function Documentation

char * dw::core::Layout::addAnchor ( Widget widget,
const char *  name,
int  y 
) [private]

char * dw::core::Layout::addAnchor ( Widget widget,
const char *  name 
) [private]

Used, when the widget is not allocated yet.

Referenced by dw::core::Widget::addAnchor().

void dw::core::Layout::addWidget ( Widget widget  ) 

void dw::core::Layout::adjustScrollPos (  )  [private]

void dw::core::Layout::attachView ( View view  ) 

bool dw::core::Layout::buttonEvent ( ButtonEventType  type,
View view,
int  numPressed,
int  x,
int  y,
ButtonState  state,
int  button 
) [private]

bool dw::core::Layout::buttonPress ( View view,
int  numPressed,
int  x,
int  y,
ButtonState  state,
int  button 
) [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.

References BUTTON_PRESS, and buttonEvent().

Referenced by dw::fltk::FltkViewBase::handle().

bool dw::core::Layout::buttonRelease ( View view,
int  numPressed,
int  x,
int  y,
ButtonState  state,
int  button 
) [inline]

This function is called by a view, to delegate a button press event.

Arguments are similar to dw::core::Layout::buttonPress.

References BUTTON_RELEASE, and buttonEvent().

Referenced by dw::fltk::FltkViewBase::handle().

bool dw::core::Layout::calcScrollInto ( int  targetValue,
int  requestedSize,
int *  value,
int  viewportSize 
) [static, private]

Referenced by scrollIdle().

void dw::core::Layout::cancelTooltip (  )  [inline]

void dw::core::Layout::changeAnchor ( Widget widget,
char *  name,
int  y 
) [private]

void dw::core::Layout::connect ( Receiver receiver  )  [inline]

void dw::core::Layout::connectLink ( LinkReceiver receiver  )  [inline]

void dw::core::Layout::copySelection ( const char *  text  )  [inline]

style::Color* dw::core::Layout::createColor ( int  color  )  [inline]

style::Font* dw::core::Layout::createFont ( style::FontAttrs attrs,
bool  tryEverything 
) [inline]

Imgbuf* dw::core::Layout::createImgbuf ( Imgbuf::Type  type,
int  width,
int  height 
) [inline]

style::Tooltip* dw::core::Layout::createTooltip ( const char *  text  )  [inline]

void dw::core::Layout::detachView ( View view  ) 

Todo:
Actually, viewportMarkerWidthDiff and viewportMarkerHeightDiff have to be recalculated here, since the effective (i.e. maximal) values may change, after the view has been detached. Same applies to the usage of viewports.

References dw::core::Platform::detachView(), platform, and dw::core::View::setLayout().

float dw::core::Layout::dpiX (  )  [inline]

float dw::core::Layout::dpiY (  )  [inline]

void dw::core::Layout::draw ( View view,
Rectangle area 
) [private]

bool dw::core::Layout::emitLinkClick ( Widget w,
int  link,
int  img,
int  x,
int  y,
EventButton event 
) [inline]

bool dw::core::Layout::emitLinkEnter ( Widget w,
int  link,
int  img,
int  x,
int  y 
) [inline]

bool dw::core::Layout::emitLinkPress ( Widget w,
int  link,
int  img,
int  x,
int  y,
EventButton event 
) [inline]

bool dw::core::Layout::emitLinkRelease ( Widget w,
int  link,
int  img,
int  x,
int  y,
EventButton event 
) [inline]

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.

References dw::core::Widget::enterNotify(), moveToWidgetAtPoint(), and widgetAtPoint.

Referenced by dw::fltk::FltkViewBase::handle().

void dw::core::Layout::expose ( View view,
Rectangle area 
) [inline]

References draw().

Referenced by dw::fltk::FltkViewBase::draw().

bool dw::core::Layout::fontExists ( const char *  name  )  [inline]

style::Color* dw::core::Layout::getBgColor (  )  [inline]

int dw::core::Layout::getHeightViewport (  )  [inline]

References viewportHeight.

Referenced by dw::core::Iterator::scrollTo().

ui::ResourceFactory* dw::core::Layout::getResourceFactory (  )  [inline]

int dw::core::Layout::getScrollPosX (  )  [inline]

References scrollX.

int dw::core::Layout::getScrollPosY (  )  [inline]

References scrollY.

bool dw::core::Layout::getUsesViewport (  )  [inline]

References usesViewport.

Referenced by dw::core::Iterator::scrollTo().

Widget * dw::core::Layout::getWidgetAtPoint ( int  x,
int  y 
) [private]

int dw::core::Layout::getWidthViewport (  )  [inline]

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.

References dw::core::Widget::leaveNotify(), moveOutOfView(), and widgetAtPoint.

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.

References MOTION_NOTIFY, moveToWidgetAtPoint(), and processMouseEvent().

Referenced by dw::fltk::FltkViewBase::handle(), and dw::fltk::FltkViewport::positionChanged().

void dw::core::Layout::moveOutOfView ( ButtonState  state  )  [inline, private]

Emit the necessary crossing events, when the mouse pointer has moved out of the view.

References moveToWidget().

Referenced by leaveNotify().

void dw::core::Layout::moveToWidget ( Widget newWidgetAtPoint,
ButtonState  state 
) [private]

void dw::core::Layout::moveToWidgetAtPoint ( int  x,
int  y,
ButtonState  state 
) [inline, private]

Emit the necessary crossing events, when the mouse pointer has moved to position (x, );.

References getWidgetAtPoint(), and moveToWidget().

Referenced by buttonEvent(), enterNotify(), and motionNotify().

int dw::core::Layout::nextGlyph ( const char *  text,
int  idx 
) [inline]

int dw::core::Layout::prevGlyph ( const char *  text,
int  idx 
) [inline]

bool dw::core::Layout::processMouseEvent ( MousePositionEvent event,
ButtonEventType  type,
bool  mayBeSuppressed 
) [private]

void dw::core::Layout::queueDraw ( int  x,
int  y,
int  width,
int  height 
) [private]

void dw::core::Layout::queueDrawExcept ( int  x,
int  y,
int  width,
int  height,
int  ex,
int  ey,
int  ewidth,
int  eheight 
) [private]

void dw::core::Layout::queueResize (  )  [private]

void dw::core::Layout::removeAnchor ( Widget widget,
char *  name 
) [private]

void dw::core::Layout::removeWidget (  )  [private]

void dw::core::Layout::resetSearch (  )  [inline]

void dw::core::Layout::resizeIdle (  )  [private]

void dw::core::Layout::scroll ( ScrollCommand  cmd  ) 

void dw::core::Layout::scrollIdle (  )  [private]

void dw::core::Layout::scrollPosChanged ( View view,
int  x,
int  y 
)

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.

References scrollTo0().

Referenced by dw::core::Widget::scrollTo(), and dw::core::Iterator::scrollTo().

void dw::core::Layout::scrollTo0 ( HPosition  hpos,
VPosition  vpos,
int  x,
int  y,
int  width,
int  height,
bool  scrollingInterrupted 
) [private]

FindtextState::Result dw::core::Layout::search ( const char *  str,
bool  caseSens,
int  backwards 
) [inline]

void dw::core::Layout::setAnchor ( const char *  anchor  ) 

Sets the anchor to scroll to.

References requestedAnchor, and updateAnchor().

Referenced by removeWidget(), and scrollPosChanged().

void dw::core::Layout::setBgColor ( style::Color color  ) 

void dw::core::Layout::setCursor ( style::Cursor  cursor  )  [private]

void dw::core::Layout::setSizeHints (  )  [private]

void dw::core::Layout::setWidget ( Widget widget  ) 

int dw::core::Layout::textWidth ( style::Font font,
const char *  text,
int  len 
) [inline]

void dw::core::Layout::updateAnchor (  )  [private]

void dw::core::Layout::updateCursor (  )  [private]

void dw::core::Layout::viewportSizeChanged ( View view,
int  width,
int  height 
)


Friends And Related Function Documentation

friend class Widget [friend]


Member Data Documentation

Referenced by attachView(), and Layout().

Referenced by draw(), Layout(), and scrollIdle().

Referenced by connect(), removeWidget(), and resizeIdle().

Referenced by Layout(), setAnchor(), and updateAnchor().

Referenced by Layout(), scrollTo0(), and updateAnchor().

Referenced by scrollIdle(), and scrollTo0().

Referenced by scrollIdle(), and scrollTo0().

Referenced by scrollIdle(), and scrollTo0().

Referenced by scrollIdle(), and scrollTo0().

Referenced by scrollIdle(), and scrollTo0().

Referenced by scrollIdle(), and scrollTo0().

Referenced by Layout(), setWidget(), and ~Layout().


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

Generated on Wed Sep 7 02:00:37 2011 for Dillo by  doxygen 1.5.9