You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iBase/iProperty/ZxPtyItem.h

129 lines
3.2 KiB
C

#pragma once
#include <QVector>
#include <QWidget>
#include "IxPtyPano.h"
#include "iProperty_global.h"
class ZxXpfNode;
class ZxPtyPano;
class ZxPtyAttributeFile;
class IxPtyItemEditor;
/// @internal
/// 属性表条目.
class I_PROPERTY_EXPORT ZxPtyItem
: virtual public IxPtyItem
{
public:
ZxPtyItem(ZxPtyPano* pSheet);
~ZxPtyItem();
public:
virtual IxPtyPano* getPtyPano() const;
virtual IxPtyItem* getParent() const;
virtual bool isGroup() const;
virtual ItemType getItemType() const;
virtual void setItemType(ItemType _type);
virtual void setLimit(int nMin, int nMax);
virtual void setLimit(double fMin, double fMax);
virtual void setOptions(const QStringList& listName, const QList<QVariant>& listValue);
virtual void setOptions(const QStringList& listName, const QStringList& listValue);
virtual void setOptions(const QStringList& listName, const QList<int>& listValue);
virtual QVariant getValue() const;
virtual void setValue(const QVariant& v, IxInterface* pSetBy = 0);
virtual bool isVisible() const;
virtual void setVisible(bool bVisible);
virtual bool isReadOnly() const;
virtual void setReadOnly(bool bReadOnly);
virtual void setExpand(bool bExpand);
virtual void activate();
virtual void setHeight(int height);
virtual int getHeight() const;
int getRowBottom() const;
int getRowHeight() const;
static bool displayOrder(const ZxPtyItem* a, const ZxPtyItem* b);
static bool alphabetical(const ZxPtyItem* a, const ZxPtyItem* b);
//void applyConfig(ZxXpfNode* p);
IxPtyItemEditor* tryCreateEditor(const QString& widgetTag);
void setConfig(ZxXpfNode* p, bool isInit);
void loadInitConfig();
ZxPtyAttributeFile* getAttributeFile() const;
QWidget* getOwnerWidget();
QWidget* getItemWidget();
QString getLabel();
void onValueChanged(const QVariant& v);
int getVisibleRows();
bool isHideByCollapse();
bool isVirtualVisible();
int getParamsCount() const;
QString getParam(int index) const;
const QString& getKey() const;
QString getFullKey() const;
QString getParentConfigName(ZxXpfNode* config) const;
QString macrosExpanded(const QString& s) const;
void onDoubleCliked(int n);
public:
int realIndex; //实际的行号
int virtualIndex; //显示在第几行, 有条目展开/折叠时, 这个值可能会变
int order; //显示顺序
int offset; //当前显示位置, Y坐标
int cellHeight; //当前条目的高度
int indent; //缩进
bool expanded;
bool hidden; //配置里配的, 是否隐藏
bool active;
bool readonly;
IxPtyItemEditor* editor; //用来编辑/显示当前条目的控件
ZxPtyPano* sheet; //所属的属性表
//ZxXpfNode* config; //当前条目的配置, 从配置文件里获取. 可以为空
QString label; //显示的标签
bool hasMacros;
QStringList params; //key is at front, ie params[0]
QString help;
QVariant value; //当前值
QList<ZX_PROPERTY_CHANGED_CALLBACK_EX> handlers; //回调, 往对象回传新值
ZxPtyItem* parent; //父条目
QVector<ZxPtyItem*> children; //子条目
// 其它常量
int m_nCELL_HEIGHT;
int m_nCELL_SPACING;
};