[286] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
| 2 | // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. |
---|
| 3 | // See LICENSE.txt for details. |
---|
[138] | 4 | |
---|
| 5 | #ifndef _MUTPARAMLIST_H_ |
---|
| 6 | #define _MUTPARAMLIST_H_ |
---|
| 7 | |
---|
| 8 | #include "param.h" |
---|
| 9 | #include "mutparamiface.h" |
---|
| 10 | #include <frams/util/list.h> |
---|
| 11 | |
---|
| 12 | struct ParamInfo; |
---|
| 13 | |
---|
[792] | 14 | class MutableParamList : public virtual ParamInterface, public MutableParamInterface |
---|
[138] | 15 | { |
---|
[792] | 16 | SList list; |
---|
| 17 | const char *objname; |
---|
| 18 | int getSubParam(int i, ParamInterface **sub_p, int *sub_i); |
---|
| 19 | int getSubGroup(int i, ParamInterface **sub_p, int *sub_i); |
---|
[138] | 20 | |
---|
[792] | 21 | ParamInfo* getParamInfo(int i); |
---|
| 22 | void addPI(int pos, ParamInfo *pi); |
---|
| 23 | int findPI(ParamInfo *pi); |
---|
| 24 | int findPI(ParamInterface *p); |
---|
| 25 | int findPI(MutableParamInterface *p); |
---|
| 26 | void adjustPI(int firstPI, int addprop, int addgroup); |
---|
| 27 | void removePI(int pi_index); |
---|
[138] | 28 | |
---|
| 29 | #define STATRICKCLASS MutableParamList |
---|
[792] | 30 | STCALLBACKDEF(onPropAdd); |
---|
| 31 | STCALLBACKDEF(onPropDelete); |
---|
| 32 | STCALLBACKDEF(onGroupAdd); |
---|
| 33 | STCALLBACKDEF(onGroupDelete); |
---|
| 34 | STCALLBACKDEF(onPropChange); |
---|
| 35 | STCALLBACKDEF(onGroupChange); |
---|
| 36 | STCALLBACKDEF(onPropActivate); |
---|
[138] | 37 | #undef STATRICKCLASS |
---|
| 38 | |
---|
| 39 | public: |
---|
| 40 | |
---|
[792] | 41 | void firePropChange(int i) { onchange.action(i); } |
---|
| 42 | void fireGroupChange(int i) { ongroupchange.action(i); } |
---|
[138] | 43 | |
---|
[792] | 44 | MutableParamList(const char* n = 0, const char* d = 0) :objname(n), description(d) {} |
---|
| 45 | ~MutableParamList(); |
---|
[138] | 46 | |
---|
[792] | 47 | void operator+=(ParamInterface *p); |
---|
| 48 | void operator-=(ParamInterface *p); |
---|
| 49 | void operator+=(MutableParamInterface *p); |
---|
| 50 | void operator-=(MutableParamInterface *p); |
---|
| 51 | void insert(int i, ParamInterface *p); |
---|
| 52 | void insert(int i, MutableParamInterface *p); |
---|
| 53 | void operator-=(int i); |
---|
[138] | 54 | |
---|
[792] | 55 | /** remove all sub params */ |
---|
| 56 | void clear(); |
---|
[138] | 57 | |
---|
[792] | 58 | const char* getName() { return objname; } |
---|
| 59 | const char* description; |
---|
| 60 | const char* getDescription() { return description; } |
---|
[138] | 61 | |
---|
[792] | 62 | int getGroupCount(); |
---|
| 63 | int getPropCount(); |
---|
[138] | 64 | |
---|
[792] | 65 | const char *id(int i); |
---|
| 66 | const char *name(int i); |
---|
| 67 | const char *type(int i); |
---|
| 68 | const char *help(int i); |
---|
| 69 | int flags(int i); |
---|
| 70 | int group(int i); |
---|
| 71 | void call(int i, ExtValue* args, ExtValue *ret); |
---|
| 72 | const char *grname(int i); |
---|
[138] | 73 | |
---|
[792] | 74 | int grmember(int gi, int n); |
---|
[138] | 75 | |
---|
[792] | 76 | SString getString(int); |
---|
| 77 | paInt getInt(int); |
---|
| 78 | double getDouble(int); |
---|
| 79 | ExtValue getExtValue(int); |
---|
| 80 | ExtObject getObject(int); |
---|
[138] | 81 | |
---|
[792] | 82 | int setInt(int, paInt); |
---|
| 83 | int setDouble(int, double); |
---|
| 84 | int setString(int, const SString &); |
---|
| 85 | int setObject(int, const ExtObject&); |
---|
| 86 | int setExtValue(int, const ExtValue&); |
---|
[138] | 87 | }; |
---|
| 88 | |
---|
| 89 | #endif |
---|