VirtualScrollableSurface Class Reference
[C++ Wrapper for SDL]

Scrollable kind of VirtualSurface. More...

#include <VirtualScrollableSurface.hh>

Inheritance diagram for VirtualScrollableSurface:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 VirtualScrollableSurface (const std::string &name, Input &input, const Point &real_size, const Point &virtual_size)
 VirtualScrollableSurface (const std::string &name, Input &input, SDL_Surface *surf, const Point &virtual_size)
void setAutomaticAdjust (bool enable)
 Automatically center visible surface from its position/size.
void moveScreenRect (const Point &to)
 Move the absolute surface to a point on the logical surface.
virtual Rect getRenderRect () const
 Get the absolute surface from the point (0, 0) on the screen.
virtual Rect getScreenRect () const
 Get the absolute surface from the point (0, 0) on the logical surface.
virtual void setPos (const Point &to)
virtual void update ()
 Method called each frame, to perfom user custom code.
virtual void blit (Surface &to)
virtual void blit (Surface &to, const Rect &to_rect, const Rect &from_rect)

Detailed Description

Scrollable kind of VirtualSurface.

Attention:
It must be directly attached to a SDLWindow.

Member Function Documentation

Rect VirtualScrollableSurface::getRenderRect (  )  const [virtual]

Get the absolute surface from the point (0, 0) on the screen.

This is where (on the screen) the visible surface is rendered and visible by the user. This should only be used for events, ie. to compare mouse position (which has absolute position) with this surface position.

Returns:
Absolute surface Rect.

Reimplemented from Surface.

References Surface::getPos().

Referenced by sdlvisu::Map::mouseInsideMap().

Rect VirtualScrollableSurface::getScreenRect (  )  const [virtual]

Get the absolute surface from the point (0, 0) on the logical surface.

This is where (on the logical surface) the visible surface is taken from. This looks to be also used for events... ie. to compare mouse position (which has absolute position) with this surface position. (I guess that I still need an explanation... ^^)

Returns:
Visible surface Rect, relative to logical surface.

Reimplemented from Surface.

References Surface::getPos(), Surface::getScreenRect(), TPoint< T >::x, and TPoint< T >::y.

Referenced by sdlvisu::Map::centerViewTo(), sdlvisu::Map::mouseToSquare(), and sdlvisu::Map::update().

void VirtualScrollableSurface::moveScreenRect ( const Point to  ) 

Move the absolute surface to a point on the logical surface.

This is where (on the logical surface) the visible surface is taken from.

Referenced by sdlvisu::Map::centerViewTo().

void VirtualScrollableSurface::setAutomaticAdjust ( bool  enable  ) 

Automatically center visible surface from its position/size.

Parameters:
enable Switch on/off.
Note:
Default disabled.
void VirtualScrollableSurface::update (  )  [virtual]

Method called each frame, to perfom user custom code.

You should override it.

Since a parent is assigned to the surface (and this parent is itself attached by other means to the root screen), this method is called at each frame. It is not called if this surface or one of its parent is disabled. In this method you can do what you want with your object, like processing input, updating other programs attributes, changing surface property, ...

Note:
Don't forget to call update for the base class at the end of your function , otherwise strange things will happen.

Reimplemented from VirtualSurface.

Reimplemented in sdlvisu::Map.

References VirtualSurface::children_list_lock_, Surface::getPos(), Surface::getSize(), VirtualSurface::invalidate(), Surface::isEnabled(), Input::mouse_, VirtualSurface::unlockChildrenList(), TPoint< T >::x, and TPoint< T >::y.


The documentation for this class was generated from the following files:
Generated on Mon Apr 5 21:17:51 2010 for Stechec/TBT by  doxygen 1.6.3