General API reference¶
-
class Manager¶
grvl manager class.
This class is used as an entry point for all operations invoked on the library.
Public Functions¶
-
Manager &SetTransparency(float value, uint32_t milliseconds)¶
Sets transparency. TODO - Adjust the description
Remark
Calling this method will invoke registered callback called ‘set_layer_transparency’ with provided argument. It does not change internal state of a library.
-
Manager &SetActiveScreen(const char *activeScreenId, int8_t direction)¶
Changes currently displayed screen with optional animation.
-
Manager &SetLoadingImage(const Image &image)¶
Sets an image that is displayed while the application is loading its resources.
Remark
In order to switch from loading to normal state, application should call InitializationFinished method.
-
Manager &SetCollectionImage(const Image &image)¶
Sets image that is displayed as screen collection indicator.
-
Manager &SetBackgroundColor(uint32_t color)¶
Sets background color for underlying layer.
Remark
Calling this method will invoke registered callback called ‘set_background_color’ with provided argument. It does not change internal state of a library.
-
Manager &SetOverlayInfo(const std::string &info)¶
Sets application-specific information displayed in the performance overlay.
The value is copied by the manager and displayed on a separate line.
-
void ShowKeyboard()¶
Displays keyboard pop-up window if defined.
-
void SetActiveInput(TextInput *destinationInput)¶
Sets the curren active text input - triggers ShowKeyboard.
-
void RequestAutoFocus(const char *elementId)¶
Remembers the element that takes focus when a screen holding it is opened. Called by TextInput for autoFocus=”true”.
-
void SwitchKeyboardKeys()¶
Switches keyboard pop-up keys.
-
void ClosePopup()¶
Closes last pop-up window.
-
void InitializationFinished()¶
Switches library to normal state when screens are displayed.
Remark
Before calling this method loading image (if defined) is displayed.
-
bool NeedsFrames() const¶
Returns true if the next frames should be rendered even without any new input.
-
Manager &AddImageContentToContainer(std::string name, ImageContent *image)¶
Registers image content in content manager.
The image content will be accessible for other components by the provided name.
Remark
It is advised to use content manager when image content is shared by different components, as it will save memory.
-
Manager &BindImageContentToImage(const std::string &contentName, Image *image)¶
Binds registered image content to an image object.
-
Manager &AddCallbackToContainer(const std::string &name, Event::CallbackPointer Callback)¶
Registers callback method for an event.
Remark
This method filters out empty callbacks (i.e., NULLs).
-
Event GetOrCreateCallback(const std::string &callbackFunctionName, const Event::ArgVector &callbackArgs)¶
Tries to search if there is callback defined with C/C++ code (added by AddCallbackToContainer), if not then it creates new one that will call JavaScript code with provided constant args.
-
Manager &AddFontToFontContainer(const std::string &name, Font *font)¶
Register font in content manager.
The font will be accessible for other components by the provided name.
Remark
It is advised to use content manager when font is used by multiple components, as it will save memory.
-
void AddKeyMappingToContainer(uint32_t code, const std::string &name, uint32_t repeat)¶
Adds or replaces a mapping by backend-native code (including full SDL symbols). repeat is the long-press repeat interval in milliseconds.
-
void AddDefaultKeyMappingToContainer(uint32_t code, const std::string &name, uint32_t repeat)¶
Installs a backend default without replacing an existing mapping.
-
void Draw()¶
Redraws content of a display based on current state of components.
-
void MainLoopIteration(bool shouldDraw = true)¶
Executes an iteration of processing loop.
This method handles pop-up windows, processes events and redraw screen if needed.
-
Manager &SetLoaderCallback(const ContentManager::LoaderCallback &callback)¶
Registers method that is called when request for external content is issued by the library.
-
bool ShouldRedraw()¶
Check whether the screen should be redrawn this is based on multiple factors, including displayed animations, user inputs and manual requests.
-
void MarkUserActivity()¶
Mark that the user performed some action other than whats already handled (key, touch, text), additionally marks the screen for redraw
-
void ScheduleRedraw()¶
Manually mark the screen for redraw. Works like MarkUserActivity() but doesn’t affect the timestamp returned by GetLastInputTimestamp() call.
-
void SetIdleThrottle(bool throttle)¶
Set whether to limit FPS when there is no user input or animations present.
-
uint64_t GetLastInputTimestamp()¶
Get a timestamp, in milliseconds, of the last user input This includes any calls to MarkUserActivity(). This is unaffected by calls to ScheduleRedraw().
Public Members¶
-
Painter painter¶
Deprecated. Do not use painter directly, painter can only be used from specific contexts! Set a render hook with SetRenderCallback() to gain access to a Painter methods correctly. TODO make private
-
class KeyData¶
-
Manager &SetTransparency(float value, uint32_t milliseconds)¶
-
class ImageContent¶