MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 //---------------------------------------------------------------------------------- 00010 00011 #ifndef __CSOGroupRules_H 00012 #define __CSOGroupRules_H 00013 00014 00015 #include "MLCSOIncludes.h" 00016 00017 00018 ML_START_NAMESPACE 00019 00020 class CSO; 00021 class CSOGroup; 00022 00024 00026 enum CSOGroupOverflowHandling { 00027 OVERFLOW_DELETE_FIRST = 0, 00028 OVERFLOW_DELETE_LAST = 1, 00029 OVERFLOW_DELETE_ALL = 2, 00030 OVERFLOW_IGNORE_NEW = 3, 00031 NUM_OVERFLOW_MODES = 4 00032 }; 00033 00035 enum CSORemoveHandling { 00036 REMOVE_ALWAYS = 0, 00037 REMOVE_NEVER = 1, 00038 REMOVE_IF_IN_NO_GROUP = 2, 00039 NUM_REMOVE_MODES = 3 00040 }; 00041 00043 00045 class MLCSO_EXPORT CSOGroupRules 00046 { 00047 00048 public: 00049 00051 CSOGroupRules(unsigned int numMaxCSOs = 0); 00053 ~CSOGroupRules(); 00054 00056 void reset(); 00057 00059 void setNumMaximumCSOs(unsigned int numMaxCSOs) { _numMaxCSOs = numMaxCSOs; } 00061 unsigned int getNumMaximumCSOs() const { return _numMaxCSOs; } 00063 void setOverflowHandling(CSOGroupOverflowHandling handling) { _overflowHandling = handling; } 00065 CSOGroupOverflowHandling getOverflowHandling() const { return _overflowHandling; } 00067 void setRemoveFromGroupHandling(CSORemoveHandling handling) { _removeFromGroupHandling = handling; } 00069 CSORemoveHandling getRemoveFromGroupHandling() const { return _removeFromGroupHandling; } 00071 void setDeleteGroupCSOHandling(CSORemoveHandling handling) { _deleteGroupCSOHandling = handling; } 00073 CSORemoveHandling getDeleteGroupCSOHandling() const { return _deleteGroupCSOHandling; } 00075 bool mayAddCSO(CSOGroup& csoGroup) const; 00076 00078 void applyTo(CSOGroup& csoGroup); 00080 CSO* addCSO(CSOGroup& csoGroup, bool useUndoRedo=true); 00083 bool addCSO(CSO& cso, CSOGroup& csoGroup, bool useUndoRedo=true); 00085 void applyDeletionRule(CSOGroup& csoGroup); 00086 00087 00089 static unsigned int getDefaultNumMaximumCSOs() { return 0; } 00091 static CSOGroupOverflowHandling getDefaultOverflowHandling () { return OVERFLOW_DELETE_FIRST; } 00093 static CSORemoveHandling getDefaultRemoveFromGroupHandling () { return REMOVE_IF_IN_NO_GROUP; } 00095 static CSORemoveHandling getDefaultDeleteGroupCSOHandling () { return REMOVE_IF_IN_NO_GROUP; } 00096 00098 static const char* sOverflowHandlingStrings[NUM_OVERFLOW_MODES]; 00100 static const char* sRemoveHandlingStrings[NUM_REMOVE_MODES]; 00101 00102 protected: 00103 00105 void _removeCSO(CSO& cso, CSOGroup& csoGroup, bool useUndoRedo=true); 00107 void _removeAllCSO(CSOGroup& csoGroup, bool useUndoRedo=true); 00108 00109 private: 00110 00111 00114 unsigned int _numMaxCSOs; 00115 00117 CSOGroupOverflowHandling _overflowHandling; 00118 00120 CSORemoveHandling _removeFromGroupHandling; 00121 00123 CSORemoveHandling _deleteGroupCSOHandling; 00124 00125 }; 00126 00128 00129 00130 ML_END_NAMESPACE 00131 00132 00133 #endif // __CSOGroupRules_H 00134