|
xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
|
A button for generating child elements by importing an external file. More...
#include <xentara/workbench/bindings/ImportButton.hpp>
Inheritance diagram for xentara::workbench::bindings::ImportButton:Classes | |
| struct | Options |
| Options for the binding. More... | |
Public Types | |
| template<typename Object > | |
| using | ReadFile = auto(Object::*)(const std::filesystem::path &path) -> utils::eh::expected< std::string, ui::String > |
| The type for the function that read the file. | |
Public Member Functions | |
| template<typename Object > | |
| ImportButton (const PropertyHandle &property, Object &object, ReadFile< Object > readFile, Options options) | |
| Constructor. | |
A button for generating child elements by importing an external file.
| using xentara::workbench::bindings::ImportButton::ReadFile = auto (Object::*)(const std::filesystem::path &path) -> utils::eh::expected<std::string, ui::String> |
The type for the function that read the file.
This function is called when the import button is clicker to read the file. It must return a JSON string containing an array with the newly imported elements. The JSON format for the elements is the same as the format for Xentara model files.
The elements in the returned JSON string do not need to contain any UUIDs. Any UUIDs will be overwritten.
| xentara::workbench::bindings::ImportButton::ImportButton | ( | const PropertyHandle & | property, |
| Object & | object, | ||
| ReadFile< Object > | readFile, | ||
| Options | options | ||
| ) |
Constructor.
| property | A handle to the bound property. This property need not contain a value, it is only used to track changes in visibility. |
| object | The object on which the callback should be called |
| readFile | The callback function that reads the imported file |
| options | The binding options |