mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include "PvApp.h"
|
||
|
|
#include "DataFields.h"
|
||
|
|
|
||
|
|
class PvPopWidget : public PvObject
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
struct ParamLine
|
||
|
|
{
|
||
|
|
std::string key;
|
||
|
|
std::string type;
|
||
|
|
std::string val;
|
||
|
|
int widget;
|
||
|
|
std::vector<std::string> items;
|
||
|
|
ParamLine(std::string type, std::string key) : type(type), key(key) {}
|
||
|
|
};
|
||
|
|
|
||
|
|
PvPopWidget(PARAM* p, int width, int height);
|
||
|
|
|
||
|
|
void addParamLineEdit(std::string key, std::string title, int x, int y, bool editable=true);
|
||
|
|
|
||
|
|
void addParamCombox(std::string key, std::string title, int x, int y, std::vector<std::string> items);
|
||
|
|
|
||
|
|
void setParamText(std::shared_ptr<ParamLine> line, std::string text);
|
||
|
|
void setParamText(std::string key, std::string text);
|
||
|
|
|
||
|
|
void setCallbackConfirm(std::function<void()> callback) { callbackConfirm = callback; };
|
||
|
|
|
||
|
|
void setTitle(std::string title);
|
||
|
|
|
||
|
|
void setData(DataFields fields);
|
||
|
|
DataFields getData();
|
||
|
|
|
||
|
|
void setLineGeometry(int wKey, int wVal, int h);
|
||
|
|
|
||
|
|
int width {800};
|
||
|
|
int height {600};
|
||
|
|
|
||
|
|
int lineKeyWidth {70};
|
||
|
|
int lineValWidth {180};
|
||
|
|
int lineHeight {30};
|
||
|
|
|
||
|
|
struct {
|
||
|
|
int widget;
|
||
|
|
int title;
|
||
|
|
} ui;
|
||
|
|
|
||
|
|
std::map<std::string, std::shared_ptr<ParamLine>> mapLines;
|
||
|
|
DataFields data;
|
||
|
|
|
||
|
|
std::function<void()> callbackConfirm = nullptr;
|
||
|
|
};
|