Implemented app result and SelectionDialog (#96)

This commit is contained in:
Ken Van Hoeylandt
2024-11-27 21:13:07 +01:00
committed by GitHub
parent 4744565b0e
commit 6094b9c3f2
13 changed files with 345 additions and 12 deletions
+20
View File
@@ -4,6 +4,7 @@
#include "app/Manifest.h"
#include "Bundle.h"
#include "Mutex.h"
#include <memory>
namespace tt::app {
@@ -15,6 +16,20 @@ typedef enum {
StateStopped // App is not in memory
} State;
struct ResultHolder {
ResultHolder(Result result, const Bundle& resultData) {
this->result = result;
this->resultData = new Bundle(resultData);
}
~ResultHolder() {
delete resultData;
}
Result result;
Bundle* _Nullable resultData;
};
/**
* Thread-safe app instance.
*/
@@ -37,6 +52,7 @@ private:
* These manifest methods can optionally allocate/free data that is attached here.
*/
void* _Nullable data = nullptr;
std::unique_ptr<ResultHolder> resultHolder;
public:
@@ -61,6 +77,10 @@ public:
void setData(void* data);
const Bundle& getParameters() const;
void setResult(Result result, const Bundle& bundle);
bool hasResult() const;
std::unique_ptr<ResultHolder>& getResult() { return resultHolder; }
};
} // namespace