123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- #ifndef _ATTRIBUTE_H
- #define _ATTRIBUTE_H
- #include <bfc/depend.h>
- #include <bfc/named.h>
- #include <bfc/common.h>
- #include <bfc/string/StringW.h>
- class CfgItemI;
- namespace AttributeType {
-
- enum {
- NONE = 0,
- INT = MK3CC('i','n','t'),
- STRING = MK3CC('s','t','r'),
- BOOL = MK4CC('b','o','o','l'),
- FLOAT = MK4CC('f','l','o','t'),
- FILENAME = MK2CC('f','n'),
- };
- };
- class NOVTABLE Attribute : public DependentI, private NamedW
- {
- public:
- static const GUID *depend_getClassGuid() {
-
- static const GUID ret =
- { 0x5ab601d4, 0x1628, 0x4604, { 0x80, 0x8a, 0x7e, 0xd8, 0x99, 0x84, 0x9b, 0xeb } };
- return &ret;
- }
- protected:
-
-
- Attribute(const wchar_t *name=NULL, const wchar_t *desc=NULL);
-
- public:
- virtual ~Attribute();
-
- void setName(const wchar_t *newname);
-
-
- const wchar_t *getAttributeName();
-
- const wchar_t *getAttributeDesc();
-
- virtual int getAttributeType()=0;
-
-
- virtual const wchar_t *getConfigGroup() { return NULL; }
-
- int getValueAsInt();
-
-
- int setValueAsInt(int newval, bool def=false);
-
- double getValueAsDouble();
-
-
- double setValueAsDouble(double newval, bool def=false);
-
- int getDataLen();
-
- int getData(wchar_t *data, int data_len);
-
-
- int setData(const wchar_t *data, bool def=false);
- void disconnect();
- enum {
- Event_DATACHANGE=100,
- };
- protected:
- friend class CfgItemI;
-
-
- int setDataNoCB(const wchar_t *data);
-
-
- void setCfgItem(CfgItemI *item);
- StringW mkTag();
- private:
- StringW desc;
- StringW default_val, *private_storage;
- CfgItemI *cfgitemi;
- };
- #define ATTR_PERM_READ 1
- #define ATTR_PERM_WRITE 2
- #define ATTR_PERM_ALL (~0)
- enum {
- ATTR_RENDER_HINT_INT_CHECKMARK
- };
- #endif
|