22#include <unordered_map>
29#define CONTENT_FROM_XML_RES(x) \
30 aurore::View* createContentView() override { return aurore::View::createFromXMLResource(x); }
32#define CONTENT_FROM_XML_FILE(x) \
33 aurore::View* createContentView() override { return aurore::View::createFromXMLFile(x); }
35#define CONTENT_FROM_XML_STR(x) \
36 aurore::View* createContentView() override { return aurore::View::createFromXMLString(x); }
153 void show(std::function<
void(
void)> cb,
bool animate,
float animationDuration);
158 void hide(std::function<
void(
void)> cb,
bool animate,
float animationDuration);
209 std::unordered_map<std::string, DataModel*> models;
210 View* constructorView =
nullptr;
211 View* contentView =
nullptr;
212 unsigned contentGeneration = 0;
Definition activity.hpp:45
void unregisterAction(ActionIdentifier identifier)
Activity(View *view)
An activity showing view (it then owns it).
ActionIdentifier registerAction(const std::string &hintText, enum ControllerButton button, const ActionListener &actionListener, bool hidden=false, bool allowRepeating=false, enum Sound sound=SOUND_NONE)
virtual View * createContentView()
virtual bool isTranslucent()
virtual void willDisappear(bool resetState=false)
Passed on to the content view when the activity is hidden or popped.
virtual void willAppear(bool resetState=false)
Passed on to the content view when the activity is shown.
View * swapContentView(View *view)
void setContentView(View *view)
DataModel * getModel(const std::string &name)
View * getContentView()
The root of the activity's views, nullptr before it is set.
Activity()
An activity whose content comes from createContentView() when it is pushed.
virtual void onContentAvailable()
Definition activity.hpp:91
virtual ~Activity()
Frees the content view (at the end of the frame).
void registerModel(const std::string &name, DataModel *model)
unsigned getContentGeneration() const
Definition activity.hpp:100
ActionIdentifier registerExitAction(enum ControllerButton button=aurore::BUTTON_START)
void show(std::function< void(void)> cb, bool animate, float animationDuration)
void setAlpha(float alpha)
The content view's opacity.
ActionIdentifier registerAction(AuroreKeyCombination key, const ActionListener &actionListener, bool allowRepeating=false)
The same on a keyboard key, on the content view.
virtual void onPause()
Another activity was pushed over this one.
Definition activity.hpp:140
void onWindowSizeChanged()
Resizes the activity to the window (resizeToFitWindow()).
View * getView(std::string id)
void setInFadeAnimation(bool translucent)
void hide(std::function< void(void)> cb, bool animate, float animationDuration)
virtual float getShowAnimationDuration(TransitionAnimation animation)
View * getDefaultFocus()
The view the focus goes to when the activity is shown: the content view's default.
void unregisterModel(const std::string &name)
virtual void onResume()
The activity over this one was popped: it is on top again.
Definition activity.hpp:142
bool isHidden()
Whether hide() hid the content view.
Definition observable.hpp:222
Definition actions.hpp:25
TransitionAnimation
Definition view.hpp:153
int ActionIdentifier
Definition actions.hpp:31
ControllerButton
Definition input.hpp:179
@ BUTTON_START
Definition input.hpp:192
Sound
Definition audio.hpp:23
@ SOUND_NONE
Definition audio.hpp:24
std::function< bool(View *)> ActionListener
Definition actions.hpp:29
Definition actions.hpp:36