Rose
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
rose::Visual Class Referenceabstract

The properties common to all visual objects on the screen. More...

#include <Visual.h>

Inheritance diagram for rose::Visual:
Inheritance graph
[legend]
Collaboration diagram for rose::Visual:
Collaboration graph
[legend]

Public Types

using ValueMap = std::map< int, int >
 The std::map type for each hint class.
 

Public Member Functions

void setScreenRectangle (const Position< int > &containerPosition)
 Compute the screen rectangle from the Container screen Position. More...
 
Rectangle getScreenRectangle (const Position< int > &containerPosition) const
 Get the rectangle occupied by the Visual. More...
 
virtual void draw (gm::Context &context, const Position< int > &containerPosition)=0
 Draw the visual.
 
virtual Rectangle layout (rose::gm::Context &context, const Rectangle &screenRect)=0
 Layout the visual.
 
Position< int > drawPadding (const Position< int > &containerPosition)
 Pad the drawing location.
 
Rectangle layoutPadding (const Rectangle &screenRect)
 Pad the layout.
 
void setSize (const Size &size)
 Set preferred Size.
 
Size getSize () const
 Get the preferred size.
 
void setPosition (const Position< int > &position)
 Set preferred Position.
 
Position< int > getPosition () const
 Get the preferred Position.
 
void setPadding (const Padding &padding)
 Set Padding.
 
void setScreenRectangle (const Rectangle &screenRect)
 Set Screen Rectangle.
 
constexpr bool isVisible () const noexcept
 Check visibility.
 
void setVisible (bool visible) noexcept
 Set visibility.
 
void setLayoutHint (const LayoutHint &hint)
 Add a LayoutHint.
 
std::optional< int > getAttachmentHint (LayoutHint::Attachment attachment)
 Get an AttachmentHint value given a LayoutHint::Attachment. More...
 
std::optional< int > getGridHint (LayoutHint::GridLayoutHint gridLayoutHint)
 Get a GridLayoutHint value given a LayoutHint::GridLayoutHint. More...
 
template<size_t HintClass>
std::optional< const ValueMapgetHintMap () const
 
SemanticGesture supportedSemanticGestures () const
 Get supported SemanticGestures.
 

Public Attributes

std::map< size_t, ValueMapmHintsMap {}
 The std::map of hint class to ValueMap.
 

Protected Attributes

SemanticGesture mSemanticGesture {}
 
Position< int > mPos {}
 Position relative to the container, arrived at by layout.
 
Size mSize {}
 The size on screen, arrived at by layout.
 
Position< int > mPreferredPos {}
 The preferred position.
 
Size mPreferredSize {}
 The preferred size.
 
Rectangle mScreenRect {}
 The screen Rectangle computed at drawing time.
 
Padding mPadding {}
 Immediately around the Visual, used for separation and alignment.
 
State mState {}
 The object state Id string.
 
bool mVisible {true}
 If true the object is visible.
 

Friends

class LayoutManager
 

Detailed Description

The properties common to all visual objects on the screen.

Preferred values may be set by the user application or specific widgets prior to layout. They may or may not be honoured.

Member Function Documentation

◆ getAttachmentHint()

std::optional<int> rose::Visual::getAttachmentHint ( LayoutHint::Attachment  attachment)
inline

Get an AttachmentHint value given a LayoutHint::Attachment.

Parameters
attachmentA value from LayoutHint::Attachment.
Returns
A std::optional with the value if found.

◆ getGridHint()

std::optional<int> rose::Visual::getGridHint ( LayoutHint::GridLayoutHint  gridLayoutHint)
inline

Get a GridLayoutHint value given a LayoutHint::GridLayoutHint.

Parameters
attachmentA value from LayoutHint::GridLayoutHint.
Returns
A std::optional with the value if found.

◆ getScreenRectangle()

Rectangle rose::Visual::getScreenRectangle ( const Position< int > &  containerPosition) const
inline

Get the rectangle occupied by the Visual.

Parameters
containerPositionThe position of the container holding the Visual.
Returns
The rectangle.

◆ setScreenRectangle()

void rose::Visual::setScreenRectangle ( const Position< int > &  containerPosition)
inline

Compute the screen rectangle from the Container screen Position.

Parameters
containerPositionThe Container screen Position.

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