HoverRace
2.0
|
Base class for renderable components. More...
#include <ViewModel.h>
Public Member Functions | |
ViewModel () | |
virtual | ~ViewModel () |
virtual void | AttachView (Display &disp)=0 |
View * | GetView () const |
virtual Vec3 | Measure () |
Calculate the size of the component. More... | |
void | PrepareRender () |
void | Render () |
void | SetView (std::unique_ptr< View > &&view) |
Protected Member Functions | |
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... | |
Private Attributes | |
bool | needsLayout |
std::unique_ptr< View > | view |
Base class for renderable components.
View models only track the state of the renderable. The rendering is handled by the View, which is attached by the API-specific Display when the the view model is added to the scene graph.
|
inline |
|
inlinevirtual |
|
pure virtual |
Implemented in HoverRace::Display::BaseContainer, HoverRace::Display::Button, HoverRace::Display::Wallpaper, HoverRace::Display::FillBox, HoverRace::Display::RuleLine, HoverRace::Display::Picture, HoverRace::Display::Label, HoverRace::Display::ClickRegion, HoverRace::Display::SymbolIcon, HoverRace::Display::Slider, HoverRace::Display::ActiveText, HoverRace::Display::ScreenFade, and HoverRace::Display::KeycapIcon.
|
inlineprotected |
|
inlineprotectedvirtual |
Indicate that a model property has changed.
If a view is attached, it will be notified.
prop | The model-specific ID of the property that changed. |
Reimplemented in HoverRace::Display::Button, HoverRace::Display::Slider, HoverRace::Display::StateButton, HoverRace::Display::HudDecor, and HoverRace::Display::Minimap.
|
inline |
|
inlineprotectedvirtual |
Adjust the size and position of any child elements.
Subclasses with child elements should override this function.
This is called automatically during the PrepareRender() phase if RequestLayout() has been called. It is also called the first time PrepareRender() is invoked. After this function is called, it will not be called again until another call to RequestLayout().
Reimplemented in HoverRace::Display::FlexGrid, HoverRace::Display::Hud, HoverRace::Display::BasePickList, HoverRace::Display::Button, HoverRace::Display::Slider, HoverRace::Display::Counter, HoverRace::Display::Chronometer, HoverRace::Display::HudText, HoverRace::Client::BulletinBoard, and HoverRace::Client::BulletinBoard::Bulletin.
|
inlinevirtual |
Calculate the size of the component.
For UI components, the return value is affected by layout flags.
Reimplemented in HoverRace::Display::FlexGrid, HoverRace::Display::BaseContainer, HoverRace::Display::ClickRegion, HoverRace::Display::Button, HoverRace::Display::Slider, HoverRace::Display::RuleLine, HoverRace::Display::Box, and HoverRace::Display::KeycapIcon.
|
inline |
|
inline |
|
inlineprotected |
Indicate that the current layout is out-of-date and needs to be adjusted.
Subclasses should call this when a property changes that affects the layout (such as the size).
|
inline |
|
private |
|
private |