Class · aurore
aurore::Activity
On this page
#include <aurore/core/activity.hpp>
class aurore::ActivityDescription
An activity is a "screen" of your app in which the library adds the UI components. The app is made of a stack of activities, each activity containing a views tree.
Application::pushActivity() takes the activity and deletes it when it is popped; the activity owns its content view.
Constructors 3
An activity whose content comes from createContentView() when it is pushed.
activity.hpp:48Activity(View *view) An activity showing view (it then owns it).
Frees the content view (at the end of the frame).
activity.hpp:52Functions 28
void setContentView(View *view) Sets the content view of this activity, aka the root view of the tree.
When the activity is pushed, setContentView() is automatically called with the result of createContentView(). As such, you should override createContentView() if you want to use XML in your activity.
activity.hpp:63Sets the content view as setContentView() does, but gives the previous one back instead of deleting it: detached from the activity, still "appeared" (no willDisappear), for the caller to put back or delete.
activity.hpp:68virtual View * createContentView() Called when the activity is created. Should return the activity content view, if any.
Returning nullptr means the content is not known when the activity is created.
You can use View::createFromXMLFile(), View::createFromXMLResource() and View::createFromXMLString() to load a view from respectively an XML file path, an XML name in the resources/xml romfs directory and an XML string.
The CONTENT_FROM_XML_FILE, CONTENT_FROM_XML_RES, CONTENT_FROM_XML_STR macros are made to make this process simpler: just use them in the public block of your activity header and it will override createContentView() with the right code for you.
The onContentAvailable() method will be called once the content has been created, so that you can get the references to the activity views (by id).
activity.hpp:85Called when the content view is created, so that you can get the references to the activity views (by id).
activity.hpp:91View * getContentView() The root of the activity's views, nullptr before it is set.
activity.hpp:94Counts the content views set (setContentView): what views were bound to (AURORE_BIND) is looked up again in a content made anew.
activity.hpp:100View * getView(std::string id) Returns the view with the corresponding id, or nullptr if it hasn't been found in the activity.
activity.hpp:106void registerModel(const std::string &name, DataModel *model) A data model for the XML bindings of this activity's views (bind="text: name.key"), looked up before the application's (Application::registerModel). Register it before the content view is set (in the constructor); the model must outlive the activity.
activity.hpp:114Resizes the activity to fit the window. Called when the activity is created and when the window is resized (Switch dock counts as window resize).
activity.hpp:122virtual float getShowAnimationDuration(TransitionAnimation animation) Returns the duration of the activity show / hide animation.
activity.hpp:127Is this activity translucent, aka can we see the activities under it in the stack?
activity.hpp:133Passed on to the content view when the activity is shown.
activity.hpp:136Passed on to the content view when the activity is hidden or popped.
activity.hpp:138Another activity was pushed over this one.
activity.hpp:140The activity over this one was popped: it is on top again.
activity.hpp:142If set to true, will force the activity to be translucent.
activity.hpp:148Shows the activity with a fade in animation, or no animation at all.
activity.hpp:153Hides the activity with a fade in animation, or no animation at all.
activity.hpp:158Whether hide() hid the content view.
activity.hpp:161ActionIdentifier registerAction( const std::string &hintText,enum ControllerButton button,const ActionListener &actionListener,bool hidden = false,bool allowRepeating = false,enum Sound sound = SOUND_NONE)Registers an action with the given parameters on the content view. The listener will be fired when the user presses the key.
The listener should return true if the action was consumed, false otherwise. The sound will only be played if the listener returned true.
A hidden action will not show up in the bottom-right hints.
Must be called after the content view is set.
Returns the identifier for the action, so it can be unregistered later on. Returns ACTION_NONE if the action was not registered.
activity.hpp:177ActionIdentifier registerAction( AuroreKeyCombination key,const ActionListener &actionListener,bool allowRepeating = false)The same on a keyboard key, on the content view.
activity.hpp:180void unregisterAction(ActionIdentifier identifier) Unregisters an action with the given identifier on the content view.
Must be called after the content view is set.
activity.hpp:187ActionIdentifier registerExitAction( enum ControllerButton button = aurore::BUTTON_START)Registers an action to exit the application with the default button BUTTON_START.
Must be called after the content view is set.
Returns the identifier for the action, so it can be unregistered later on. Returns ACTION_NONE if the action was not registered.
activity.hpp:197Resizes the activity to the window (resizeToFitWindow()).
activity.hpp:200View * getDefaultFocus() The view the focus goes to when the activity is shown: the content view's default.
activity.hpp:203The content view's opacity.
activity.hpp:206Read from Aurore's headers by Doxygen at each build · library/include