Namespace sixtyfps¶
Contents
Detailed Description¶
The sixtyfps
namespace is the primary entry point into the SixtyFPS C++ API.
All available types are in this namespace.
There are two ways of loading .60
markup files in your application:
You could translate them to C++ with the help of the
sixtyfps_target_60_sources
cmake command and use the generated C++ API to instantiate the UI, set or get property values or callback handlers. That API will use types from thesixtyfps
namespace, for examplesixtyfps::SharedString
orsixtyfps::Color
.Alternatively, you can choose to load the
.60
files dynamically at run-time, using the SixtyFPS Interpreter from thesixtyfps::interpreter
namespace, starting atsixtyfps::interpreter::ComponentCompiler
.
Once you have loaded or instantiated a .60 file, you will receive a reference to the instance
in a sixtyfps::ComponentHandle
. This is a smart pointer that owns
the actual instance and keeps it alive as long as at least one
sixtyfps::ComponentHandle
is in scope, similar to std::shared_ptr<T>
.
For more complex UIs it is common to supply data in the form of an abstract data model, that is
used with for
- in
repetitions or ListView
elements in the .60
language. All models in C++ are sub-classes of the sixtyfps::Model
and you can
sub-class it yourself. For convenience, the sixtyfps::VectorModel
provides an
implementation that is backed by a std::vector<T>
.