Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
view.hpp File Reference
#include <nanovg.h>
#include <stdio.h>
#include <algorithm>
#include <array>
#include <functional>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include <aurore/core/actions.hpp>
#include <aurore/core/animation.hpp>
#include <aurore/core/event.hpp>
#include <aurore/core/frame_context.hpp>
#include <aurore/core/geometry.hpp>
#include <aurore/core/gesture.hpp>
#include <aurore/core/util.hpp>
#include <aurore/core/view_style.hpp>

Go to the source code of this file.

Classes

struct  aurore::ReadingXMLElement
 While it lives, the XML element being read (named in View::fatalXML's errors). More...
 
struct  aurore::AppletFrameItem
 
class  aurore::View
 

Namespaces

namespace  tinyxml2
 
namespace  aurore
 

Macros

#define AURORE_REGISTER_ENUM_XML_ATTRIBUTE(name, enumType, method, ...)
 
#define AURORE_REGISTER_CLICK_BY_ID(id, method)    this->getView(id)->registerClickAction([this](aurore::View* view) { return method(view); })
 

Typedefs

typedef Event< View * > aurore::GenericEvent
 
typedef Event aurore::VoidEvent
 
typedef std::function< void(void)> aurore::AutoAttributeHandler
 
typedef std::function< void(int)> aurore::IntAttributeHandler
 
typedef std::function< void(float)> aurore::FloatAttributeHandler
 
typedef std::function< void(std::string)> aurore::StringAttributeHandler
 
typedef std::function< void(NVGcolor)> aurore::ColorAttributeHandler
 
typedef std::function< void(bool)> aurore::BoolAttributeHandler
 
typedef std::function< void(std::string)> aurore::FilePathAttributeHandler
 

Enumerations

enum class  aurore::FocusDirection { aurore::UP , aurore::DOWN , aurore::LEFT , aurore::RIGHT }
 Focus direction when navigating. More...
 
enum class  aurore::ViewBackground {
  aurore::NONE , aurore::SIDEBAR , aurore::BACKDROP , aurore::SHAPE_COLOR ,
  aurore::VERTICAL_LINEAR , aurore::HORIZONTAL_LINEAR
}
 View background. More...
 
enum class  aurore::AlignSelf {
  aurore::AUTO , aurore::FLEX_START , aurore::CENTER , aurore::FLEX_END ,
  aurore::STRETCH , aurore::BASELINE , aurore::SPACE_BETWEEN , aurore::SPACE_AROUND
}
 
enum class  aurore::Visibility { aurore::VISIBLE , aurore::INVISIBLE , aurore::GONE }
 View visibility. More...
 
enum class  aurore::PositionType { aurore::RELATIVE , aurore::ABSOLUTE , aurore::STATIC }
 Position attribute behavior. More...
 
enum class  aurore::BoxSizing { aurore::BORDER_BOX , aurore::CONTENT_BOX }
 What the width and height of a view measure. More...
 
enum class  aurore::TransitionAnimation {
  aurore::FADE , aurore::SLIDE_LEFT , aurore::SLIDE_RIGHT , aurore::NONE ,
  aurore::LINEAR
}
 
enum class  aurore::ShadowType { aurore::NONE , aurore::GENERIC , aurore::CUSTOM }
 A View shape's shadow type. More...
 

Functions

void aurore::nameXMLDocument (const tinyxml2::XMLDocument *document, const std::string &name)
 
float aurore::ntz (float value)
 

Variables

const NVGcolor aurore::TRANSPARENT = nvgRGBA(0, 0, 0, 0)
 
const NVGcolor aurore::transparent
 

Macro Definition Documentation

◆ AURORE_REGISTER_CLICK_BY_ID

#define AURORE_REGISTER_CLICK_BY_ID (   id,
  method 
)     this->getView(id)->registerClickAction([this](aurore::View* view) { return method(view); })

Shortcut to register an A key action (generic click) on a view given its id, that calls any function or method To be used in activities or derivates of Box (internally uses the getView() method) The function or method must return a boolean (true if the action was consumed, false otherwise) and take a single aurore::View* parameter (useful to know what was clicked if you use the same listener for multiple views)

◆ AURORE_REGISTER_ENUM_XML_ATTRIBUTE

#define AURORE_REGISTER_ENUM_XML_ATTRIBUTE (   name,
  enumType,
  method,
  ... 
)
Value:
this->registerStringXMLAttribute(name, [this](std::string value) { \
std::unordered_map<std::string, enumType> enumMap = __VA_ARGS__; \
if (enumMap.count(value) > 0) \
method(enumMap[value]); \
else \
aurore::View::fatalXML("Illegal value \"" + value + "\" for XML attribute \"" + name + "\"; expected " + aurore::View::listXMLValues(enumMap)); })
static std::string listXMLValues(const std::unordered_map< std::string, T > &values)
An enumeration's values, sorted, for an error message.
Definition view.hpp:1249

Registers an "enum" XML attribute, which is just a string attribute with a map string -> enum inside When using this macro please use the same (wonky) formatting as what you see in Box.cpp or View.cpp otherwise clang-format will screw it up