MAP::MapWidget Class Reference

#include <MAP/MapWidget.h>

Inheritance diagram for MAP::MapWidget:

MAUI::Widget MAP::IMapCacheListener List of all members.

Detailed Description

Simple slippy map widget.


Public Member Functions

 MapWidget (int x, int y, int width, int height, Widget *parent)
virtual ~MapWidget ()
void enterMapUpdateScope ()
void exitMapUpdateScope (bool immediate)
void updateMap ()
MapSourceKind getMapSourceKind () const
void setMapSourceKind (MapSourceKind sourceKind)
LonLat getCenterPosition () const
void setCenterPosition (LonLat position)
PixelCoordinate getCenterPositionPixels () const
int getMagnification () const
void setMagnification (int magnification)
bool getHasScale () const
void setHasScale (bool hasScale)
bool getHasSmoothPanning () const
void setHasSmoothPanning (bool hasSmoothPanning)
FontgetFont () const
void setFont (Font *font)
void scroll (MapWidgetScrollDirection direction, bool largeStep)
void zoomIn ()
void zoomOut ()
virtual void setWidth (int width)
virtual void setHeight (int height)
virtual bool handleKeyPress (int keyCode)
virtual bool handleKeyRelease (int keyCode)
virtual void tileReceived (MapCache *sender, MapTile *tile)
MAPoint2d worldPixelToWidget (PixelCoordinate wpx)
PixelCoordinate widgetToWorldPixel (MAPoint2d pt)
virtual void add (Widget *w)
void setParent (Widget *w)
Widget * getParent ()
Vector< Widget * > & getChildren ()
const Vector< Widget * > & getChildren () const
virtual void draw (bool forceDraw=false)
virtual void update ()
void requestRepaint ()
virtual bool isTransparent () const
virtual void setSkin (WidgetSkin *widgetSkin)
void setDrawBackground (bool b=true)
void setBackgroundColor (int col)
Widget * widgetAt (const Point &p)
Widget * widgetAt (int x, int y)
virtual void setPosition (int x, int y)
const Point & getPosition () const
const Point & getPaddedPosition () const
int getWidth () const
int getHeight () const
virtual const Rect & getBounds ()
virtual bool contains (const Point &p)
virtual bool contains (int x, int y)
virtual void setSelected (bool selected=true)
bool isSelected () const
virtual void setEnabled (bool enabled=true)
bool isEnabled () const
virtual void trigger ()
void addWidgetListener (WidgetListener *wl)
void removeWidgetListener (WidgetListener *wl)
Vector< WidgetListener * > & getWidgetListeners ()
void setInputManager (InputManager *inputManager)
virtual void setPaddingLeft (int l)
virtual void setPaddingTop (int t)
virtual void setPaddingRight (int r)
virtual void setPaddingBottom (int b)
int getPaddingLeft () const
int getPaddingTop () const
int getPaddingRight () const
int getPaddingBottom () const
const Rect & getPaddedBounds () const
virtual void setParameter (const String &name, const String &value)

Protected Member Functions

virtual void drawOverlay ()
virtual void drawWidget ()
Point getActualPosition ()
void drawBackground ()
void updateAbsolutePosition ()
void updateAbsolutePositionChildren (int x, int y)
void updatePaddedBounds ()
bool isDirty () const
void setDirty (bool d=true)

Protected Attributes

Vector< Widget * > children
Widget * parent
Rect bounds
int relX
int relY
bool dirty
WidgetSkin * skin
int backColor
bool shouldDrawBackground
bool selected
bool enabled
Vector< WidgetListener * > widgetListeners
InputManager * mInputManager
Rect paddedBounds
int paddingLeft
int paddingTop
int paddingBottom
int paddingRight

Friends

class MapWidgetPanTimerListener


Constructor & Destructor Documentation

MAP::MapWidget::MapWidget int  x,
int  y,
int  width,
int  height,
Widget parent
 

virtual MAP::MapWidget::~MapWidget  )  [virtual]
 


Member Function Documentation

void MAP::MapWidget::enterMapUpdateScope  ) 
 

Map update scope

void MAP::MapWidget::exitMapUpdateScope bool  immediate  ) 
 

void MAP::MapWidget::updateMap  ) 
 

MapSourceKind MAP::MapWidget::getMapSourceKind  )  const [inline]
 

Map source property

void MAP::MapWidget::setMapSourceKind MapSourceKind  sourceKind  ) 
 

LonLat MAP::MapWidget::getCenterPosition  )  const
 

Center position property

void MAP::MapWidget::setCenterPosition LonLat  position  ) 
 

PixelCoordinate MAP::MapWidget::getCenterPositionPixels  )  const
 

int MAP::MapWidget::getMagnification  )  const
 

Magnification property

void MAP::MapWidget::setMagnification int  magnification  ) 
 

bool MAP::MapWidget::getHasScale  )  const [inline]
 

Magnification scale display property

void MAP::MapWidget::setHasScale bool  hasScale  )  [inline]
 

bool MAP::MapWidget::getHasSmoothPanning  )  const
 

Smooth panning property

void MAP::MapWidget::setHasSmoothPanning bool  hasSmoothPanning  ) 
 

Font* MAP::MapWidget::getFont  )  const [inline]
 

Returns currently used font.

void MAP::MapWidget::setFont Font font  )  [inline]
 

Sets font property.

void MAP::MapWidget::scroll MapWidgetScrollDirection  direction,
bool  largeStep
 

Scrolls the map in the specified direction.

void MAP::MapWidget::zoomIn  ) 
 

Increases magnification by 1 step, i.e. a factor of two.

void MAP::MapWidget::zoomOut  ) 
 

virtual void MAP::MapWidget::setWidth int  width  )  [virtual]
 

Sets the width of the widget

Reimplemented from MAUI::Widget.

virtual void MAP::MapWidget::setHeight int  height  )  [virtual]
 

Sets the height of the widget

Reimplemented from MAUI::Widget.

virtual bool MAP::MapWidget::handleKeyPress int  keyCode  )  [virtual]
 

Handles key press. Returns true if handled.

virtual bool MAP::MapWidget::handleKeyRelease int  keyCode  )  [virtual]
 

Handles key release. Returns true if handled.

virtual void MAP::MapWidget::tileReceived MapCache sender,
MapTile tile
[virtual]
 

Called when a requested tile has been received into cache from map source.

Implements MAP::IMapCacheListener.

MAPoint2d MAP::MapWidget::worldPixelToWidget PixelCoordinate  wpx  ) 
 

Converts from global map pixels to widget pixels.

PixelCoordinate MAP::MapWidget::widgetToWorldPixel MAPoint2d  pt  ) 
 

Converts from widget pixels to global map pixels.

virtual void MAP::MapWidget::drawOverlay  )  [protected, virtual]
 

virtual void MAP::MapWidget::drawWidget  )  [protected, virtual]
 

This is the only function that is absolutely neccesary to implement when inheriting Widget to create a custom widget. It is responsible for painting the widget. When it is called, the widget must respect its own padded bounds and not extend rendering beyond that area.

Implements MAUI::Widget.

Point MAP::MapWidget::getActualPosition  )  [protected]
 

virtual void MAUI::Widget::add Widget w  )  [virtual, inherited]
 

Function used to add childs to a widget. The parent of the children will automatically be set. The widget cannot have a parent already.

Reimplemented in MAUI::Layout, and MAUI::ListBox.

void MAUI::Widget::setParent Widget w  )  [inherited]
 

Function used to set the parent of a widget. The widget will not be added to the parent as a child. The widget cannot have a parent already.

Widget* MAUI::Widget::getParent  )  [inherited]
 

Function to retrieve the parent of a widget.

Vector<Widget*>& MAUI::Widget::getChildren  )  [inherited]
 

Function to retrieve a reference to the list of childrens for a widget.

const Vector<Widget*>& MAUI::Widget::getChildren  )  const [inherited]
 

const version of getChildren()

virtual void MAUI::Widget::draw bool  forceDraw = false  )  [virtual, inherited]
 

Renders the Widget and all its children recursively.

Reimplemented in MAUI::ListBox.

virtual void MAUI::Widget::update  )  [virtual, inherited]
 

Reimplemented in MAUI::Label, MAUI::Layout, and MAUI::ListBox.

void MAUI::Widget::requestRepaint  )  [inherited]
 

Registers an idle listener with the current environment that will redraw the widget and anything else that may be made dirty by doing so. For instance, if the widget is transparent its parent also has to be repainted, and so on recursively.

virtual bool MAUI::Widget::isTransparent  )  const [virtual, inherited]
 

Returns whether or not the widget is transparent. A widget is transparent if it has a skin that is transparent in the current selection state (selected/unselected) or if it has no solid background color.

virtual void MAUI::Widget::setSkin WidgetSkin widgetSkin  )  [virtual, inherited]
 

Assigns a widget skin to be used during the rendering of the widget. What The skin applies to varies depending on the widget. Labels extend the skin over their entire area, while listboxes apply the skin to each individual item they contain.

void MAUI::Widget::setDrawBackground bool  b = true  )  [inherited]
 

Sets the background drawing state. If b is true, the Widget's background will be drawn - otherwise not. In most cases, the background is either a constant color or a skin.

void MAUI::Widget::setBackgroundColor int  col  )  [inherited]
 

Widget* MAUI::Widget::widgetAt const Point p  )  [inherited]
 

Returns a pointer to the first child widget or deeper descendant, surrounding the point. Returns NULL if no widget is found.

Widget* MAUI::Widget::widgetAt int  x,
int  y
[inherited]
 

virtual void MAUI::Widget::setPosition int  x,
int  y
[virtual, inherited]
 

Sets the widget's position relative to its parent.

Reimplemented in MAUI::Layout.

const Point& MAUI::Widget::getPosition  )  const [inherited]
 

Gets the widget's position relative to its parent.

const Point& MAUI::Widget::getPaddedPosition  )  const [inherited]
 

Gets the widget's padded position relative to its parent.

int MAUI::Widget::getWidth  )  const [inherited]
 

Returns the width of the widget

int MAUI::Widget::getHeight  )  const [inherited]
 

Returns the height of the widget

virtual const Rect& MAUI::Widget::getBounds  )  [virtual, inherited]
 

Returns a Rect containing the absolute screen position of the widget together with its dimensions.

virtual bool MAUI::Widget::contains const Point p  )  [virtual, inherited]
 

Check if widget surrounds position 'p'.

virtual bool MAUI::Widget::contains int  x,
int  y
[virtual, inherited]
 

Check if widget surrounds position 'x' and 'y'.

virtual void MAUI::Widget::setSelected bool  selected = true  )  [virtual, inherited]
 

Set widget selected state (default: true).

Reimplemented in MAUI::EditBox.

bool MAUI::Widget::isSelected  )  const [inherited]
 

Is widget selected?.

virtual void MAUI::Widget::setEnabled bool  enabled = true  )  [virtual, inherited]
 

Set Widget enabled state

Reimplemented in MAUI::EditBox.

bool MAUI::Widget::isEnabled  )  const [inherited]
 

Is Widget enabled ?

virtual void MAUI::Widget::trigger  )  [virtual, inherited]
 

This function is called whenever the widget is "triggered", which is roughly equivalent to having been "clicked" on. However, sice MAUI is independant of input facilities, the more input-neutral concept of triggering is used.

Reimplemented in MAUI::Layout.

void MAUI::Widget::addWidgetListener WidgetListener wl  )  [inherited]
 

Add WidgetListener.

void MAUI::Widget::removeWidgetListener WidgetListener wl  )  [inherited]
 

Remove WidgetListener.

Vector<WidgetListener*>& MAUI::Widget::getWidgetListeners  )  [inherited]
 

returns a reference the the vector of Widget listeners

void MAUI::Widget::setInputManager InputManager inputManager  )  [inherited]
 

Sets the input manager to use for this widget

virtual void MAUI::Widget::setPaddingLeft int  l  )  [virtual, inherited]
 

Set left padding width.

Reimplemented in MAUI::Label.

virtual void MAUI::Widget::setPaddingTop int  t  )  [virtual, inherited]
 

Set top padding height.

Reimplemented in MAUI::Label.

virtual void MAUI::Widget::setPaddingRight int  r  )  [virtual, inherited]
 

Set right padding width.

Reimplemented in MAUI::Label.

virtual void MAUI::Widget::setPaddingBottom int  b  )  [virtual, inherited]
 

Set bottom padding height.

Reimplemented in MAUI::Label.

int MAUI::Widget::getPaddingLeft  )  const [inherited]
 

Get left padding width.

int MAUI::Widget::getPaddingTop  )  const [inherited]
 

Get top padding height.

int MAUI::Widget::getPaddingRight  )  const [inherited]
 

Get right padding width.

int MAUI::Widget::getPaddingBottom  )  const [inherited]
 

Get bottom padding height.

const Rect& MAUI::Widget::getPaddedBounds  )  const [inherited]
 

virtual void MAUI::Widget::setParameter const String name,
const String value
[virtual, inherited]
 

Reimplemented in MAUI::Label.

void MAUI::Widget::drawBackground  )  [protected, inherited]
 

void MAUI::Widget::updateAbsolutePosition  )  [protected, inherited]
 

This function is used to regenerate the absolute positions of each widget in the tree. This is done in a depth first manner where each widget takes the parent absolute position and adds it to their own relative position to calculate their absolute position.

void MAUI::Widget::updateAbsolutePositionChildren int  x,
int  y
[protected, inherited]
 

the recursive function used by updateAbsolutePosition().

void MAUI::Widget::updatePaddedBounds  )  [protected, inherited]
 

Used to recalculate the padded bounds from the global bounds.

bool MAUI::Widget::isDirty  )  const [protected, inherited]
 

Returns the dirty state of the widget, indicating whether it requires to be redrawn or not. When a widget calls requestRepaint(), it's dirty state is set to true. Normally, you shouldn't have to use isDirty() or setDirty() unless possibly when implementing your own widgets.

void MAUI::Widget::setDirty bool  d = true  )  [protected, inherited]
 

Sets the dirty state of the widget.


Friends And Related Function Documentation

friend class MapWidgetPanTimerListener [friend]
 


Member Data Documentation

Vector<Widget*> MAUI::Widget::children [protected, inherited]
 

Widget* MAUI::Widget::parent [protected, inherited]
 

Rect MAUI::Widget::bounds [protected, inherited]
 

int MAUI::Widget::relX [protected, inherited]
 

int MAUI::Widget::relY [protected, inherited]
 

bool MAUI::Widget::dirty [protected, inherited]
 

WidgetSkin* MAUI::Widget::skin [protected, inherited]
 

int MAUI::Widget::backColor [protected, inherited]
 

bool MAUI::Widget::shouldDrawBackground [protected, inherited]
 

bool MAUI::Widget::selected [protected, inherited]
 

bool MAUI::Widget::enabled [protected, inherited]
 

Vector<WidgetListener*> MAUI::Widget::widgetListeners [protected, inherited]
 

InputManager* MAUI::Widget::mInputManager [protected, inherited]
 

Rect MAUI::Widget::paddedBounds [protected, inherited]
 

int MAUI::Widget::paddingLeft [protected, inherited]
 

int MAUI::Widget::paddingTop [protected, inherited]
 

int MAUI::Widget::paddingBottom [protected, inherited]
 

int MAUI::Widget::paddingRight [protected, inherited]
 


Generated on Sat Feb 13 00:15:38 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO