2025-08-20 19:00:22 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "PvApp.h"
|
2025-08-22 19:06:50 +08:00
|
|
|
#include "Fields.h"
|
|
|
|
|
|
|
|
|
|
extern const std::string POP_OPER_NEW;
|
|
|
|
|
extern const std::string POP_OPER_EDIT;
|
|
|
|
|
extern const std::string POP_OPER_DEL;
|
2025-08-20 19:00:22 +08:00
|
|
|
|
|
|
|
|
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) {}
|
|
|
|
|
};
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
PvPopWidget(PARAM* p, int width, int height, std::string name);
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<ParamLine> addParamLine(std::string type, std::string key, std::string title, int x, int y, bool editable = true);
|
2025-08-20 19:00:22 +08:00
|
|
|
|
|
|
|
|
void addParamLineEdit(std::string key, std::string title, int x, int y, bool editable=true);
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
void addParamTextEdit(std::string key, std::string title, int x, int y, bool editable = true);
|
|
|
|
|
|
2025-08-20 19:00:22 +08:00
|
|
|
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; };
|
|
|
|
|
|
2025-08-28 18:42:37 +08:00
|
|
|
void setCallbackTextEvent(std::function<void(std::string, std::string)> callback) { callbackTextEvent = callback; };
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
void setStatus(std::string text);
|
|
|
|
|
|
|
|
|
|
void setMsg(std::string msg);
|
|
|
|
|
|
|
|
|
|
void setData(const Fields& fields);
|
|
|
|
|
Fields getData();
|
|
|
|
|
Fields getChangedData();
|
|
|
|
|
void checkChangedData(Fields& fields);
|
2025-08-20 19:00:22 +08:00
|
|
|
|
|
|
|
|
void setLineGeometry(int wKey, int wVal, int h);
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
void setPrimaryKeys(std::vector<std::string> keys);
|
|
|
|
|
|
2025-08-28 18:42:37 +08:00
|
|
|
int widget() { return ui.widget; }
|
|
|
|
|
|
|
|
|
|
void resize(int width, int height);
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
std::string name;
|
|
|
|
|
std::string status;
|
|
|
|
|
|
2025-08-20 19:00:22 +08:00
|
|
|
int width {800};
|
|
|
|
|
int height {600};
|
|
|
|
|
|
|
|
|
|
int lineKeyWidth {70};
|
|
|
|
|
int lineValWidth {180};
|
|
|
|
|
int lineHeight {30};
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
int widget;
|
2025-08-28 18:42:37 +08:00
|
|
|
int bkg;
|
|
|
|
|
int bkgL;
|
|
|
|
|
int bkgR;
|
|
|
|
|
int btnOK;
|
|
|
|
|
int btnCancel;
|
2025-08-20 19:00:22 +08:00
|
|
|
int title;
|
2025-08-22 19:06:50 +08:00
|
|
|
int msg;
|
2025-08-20 19:00:22 +08:00
|
|
|
} ui;
|
|
|
|
|
|
|
|
|
|
std::map<std::string, std::shared_ptr<ParamLine>> mapLines;
|
|
|
|
|
|
|
|
|
|
std::function<void()> callbackConfirm = nullptr;
|
2025-08-28 18:42:37 +08:00
|
|
|
std::function<void(std::string, std::string)> callbackTextEvent = nullptr;
|
2025-08-22 19:06:50 +08:00
|
|
|
|
|
|
|
|
Fields dataOrigin;
|
|
|
|
|
Fields primaryKeys;
|
2025-08-20 19:00:22 +08:00
|
|
|
};
|