HoverRace  2.0
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
HoverRace::Display::RuleLine Class Reference

A horizontal or vertical line. More...

#include <RuleLine.h>

+ Inheritance diagram for HoverRace::Display::RuleLine:

Classes

struct  Props
 

Public Types

enum  Direction { Direction::H, Direction::V }
 
- Public Types inherited from HoverRace::Display::UiViewModel
enum  Alignment {
  Alignment::NW, Alignment::N, Alignment::NE, Alignment::E,
  Alignment::SE, Alignment::S, Alignment::SW, Alignment::W,
  Alignment::CENTER
}
 Imagine the component pinned to the container with a thumbtack. More...
 
using focusRelinquishedSignal_t = boost::signals2::signal< void(UiViewModel &, const Control::Nav &)>
 
using focusRequestedSignal_t = boost::signals2::signal< void(UiViewModel &)>
 

Public Member Functions

 RuleLine (Direction direction, double length, double width, const Color color, uiLayoutFlags_t layoutFlags=0)
 Constructor. More...
 
virtual ~RuleLine ()
 
void AttachView (Display &disp) override
 
const Color GetColor () const
 
Direction GetDirection () const
 
double GetLength () const
 
double GetWidth () const
 
Vec3 Measure () override
 Calculate the size of the component. More...
 
void SetColor (const Color color)
 Set the color of the line. More...
 
void SetDirection (Direction direction)
 Sets the direction of the line. More...
 
void SetLength (double length)
 Sets the length of the line. More...
 
void SetWidth (double width)
 Sets the width (thickness) of the line. More...
 
- Public Member Functions inherited from HoverRace::Display::UiViewModel
 UiViewModel (uiLayoutFlags_t layoutFlags=0)
 
virtual ~UiViewModel ()
 
virtual void DropFocus ()
 Force this widget to give up focus, if it is currently focused. More...
 
Vec2 GetAlignedPos (const Vec2 &pos, double w, double h) const
 Retrieve an arbitrary position adjusted by the current alignment. More...
 
Vec2 GetAlignedPos (double w, double h) const
 Retrieve the position adjusted by the current alignment. More...
 
Alignment GetAlignment () const
 Retrieve the alignment of the component. More...
 
focusRelinquishedSignal_tGetFocusRelinquishedSignal ()
 
focusRequestedSignal_tGetFocusRequestedSignal ()
 
uiLayoutFlags_t GetLayoutFlags () const
 Retrieve the layout flags. More...
 
const Vec2GetPos () const
 Get the position of the component. More...
 
const Vec2GetTranslation () const
 Retrieves the position translation. More...
 
bool IsFocused () const
 Check if this widget currently has input focus. More...
 
uiLayoutFlags_t IsLayoutFloating () const
 
uiLayoutFlags_t IsLayoutUnscaled () const
 
virtual bool OnAction ()
 
virtual bool OnMouseMoved (const Vec2 &)
 
virtual bool OnMousePressed (const Control::Mouse::Click &)
 
virtual bool OnMouseReleased (const Control::Mouse::Click &)
 
virtual bool OnMouseScrolled (const Control::Mouse::Scroll &)
 
virtual bool OnNavigate (const Control::Nav &)
 
void RequestFocus ()
 Attempt to hand over the input focus to this widget. More...
 
void SetAlignment (Alignment alignment)
 Set the alignment of the component. More...
 
void SetPos (const Vec2 &pos)
 Set the position of the component. More...
 
void SetPos (double x, double y)
 Convenience function for SetPos(const Vec2&). More...
 
void SetTranslation (const Vec2 &translation)
 Sets the position translation. More...
 
void SetTranslation (double x, double y)
 Convenience function for SetTranslation(const Vec2&). More...
 
virtual bool TryFocus (const Control::Nav &nav=Control::Nav::NEUTRAL)
 Attempts to give this widget focus. More...
 
- Public Member Functions inherited from HoverRace::Display::ViewModel
 ViewModel ()
 
virtual ~ViewModel ()
 
ViewGetView () const
 
void PrepareRender ()
 
void Render ()
 
void SetView (std::unique_ptr< View > &&view)
 

Private Types

using SUPER = UiViewModel
 

Private Attributes

Color color
 
Direction direction
 
double length
 
double width
 

Additional Inherited Members

- Protected Member Functions inherited from HoverRace::Display::UiViewModel
void RelinquishFocus (const Control::Nav &nav)
 Voluntarily give up input focus, passing it on to the next widget. More...
 
void SetFocused (bool focused)
 Set the focused state. More...
 
- Protected Member Functions inherited from HoverRace::Display::ViewModel
template<class T >
void AttachViewDynamic (Display &disp, T *self)
 
virtual void FireModelUpdate (int prop)
 Indicate that a model property has changed. More...
 
virtual void Layout ()
 Adjust the size and position of any child elements. More...
 
void RequestLayout ()
 Indicate that the current layout is out-of-date and needs to be adjusted. More...
 

Detailed Description

A horizontal or vertical line.

Unlike a FillBox, this line is guaranteed to be at least one pixel in width.

Author
Michael Imamura

Member Typedef Documentation

Member Enumeration Documentation

Enumerator

Constructor & Destructor Documentation

HoverRace::Display::RuleLine::RuleLine ( Direction  direction,
double  length,
double  width,
const Color  color,
uiLayoutFlags_t  layoutFlags = 0 
)

Constructor.

Parameters
directionWhether the line is horizontal or vertical.
lengthThe length of the line.
widthThe thickness of the line.
colorThe color of the line (including alpha).
layoutFlagsOptional layout flags.
virtual HoverRace::Display::RuleLine::~RuleLine ( )
inlinevirtual

Member Function Documentation

void HoverRace::Display::RuleLine::AttachView ( Display disp)
inlineoverridevirtual
const Color HoverRace::Display::RuleLine::GetColor ( ) const
inline
Direction HoverRace::Display::RuleLine::GetDirection ( ) const
inline
double HoverRace::Display::RuleLine::GetLength ( ) const
inline
double HoverRace::Display::RuleLine::GetWidth ( ) const
inline
Vec3 HoverRace::Display::RuleLine::Measure ( )
overridevirtual

Calculate the size of the component.

For UI components, the return value is affected by layout flags.

Returns
The size (may be zero if the size cannot be determined yet).
Warning
Depending on the view, this may be an expensive operation since the view may have to call View::PrepareRender to apply model changes. As such, it is recommended to call Measure in the PrepareRender phase itself.

Reimplemented from HoverRace::Display::ViewModel.

void HoverRace::Display::RuleLine::SetColor ( const Color  color)

Set the color of the line.

Parameters
colorThe color (including alpha).
void HoverRace::Display::RuleLine::SetDirection ( Direction  direction)

Sets the direction of the line.

Parameters
directionThe direction.
void HoverRace::Display::RuleLine::SetLength ( double  length)

Sets the length of the line.

Parameters
lengthThe length.
void HoverRace::Display::RuleLine::SetWidth ( double  width)

Sets the width (thickness) of the line.

Parameters
widthThe width.

Member Data Documentation

Color HoverRace::Display::RuleLine::color
private
Direction HoverRace::Display::RuleLine::direction
private
double HoverRace::Display::RuleLine::length
private
double HoverRace::Display::RuleLine::width
private

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