00001
00033 #ifndef INC_MGUI_DLGGETOBJECTFILTER_H
00034 #define INC_MGUI_DLGGETOBJECTFILTER_H
00035
00036 #ifndef INC_MI32_DELEGATEFILTER_H
00037 #include <mi32/delegatefilter.h>
00038 #endif
00039
00040 #ifndef INC_MI32_MISTRING_H
00041 #include <mi32/mistring.h>
00042 #endif
00043
00044 #ifndef INC_MI32_MILIST_H
00045 #include <mi32/milist.h>
00046 #endif
00047
00048 #ifndef INC_RVC_OBJTYPESET_H
00049 #include <rvc/otypeset.h>
00050 #endif
00051
00052 #ifndef GENERATING_DOXYGEN_OUTPUT
00053 class FILEPATH;
00054 class FILETYPE;
00055 class FILETYPESET;
00056 namespace RVC {
00057 class OBJITEM;
00058 class OBJITEMLIST;
00059 }
00060 #endif
00061
00062 namespace MGUI {
00063
00064
00065
00067 class DLG_GETOBJECT_FILTER {
00068 public:
00069
00071 DLG_GETOBJECT_FILTER (
00072 );
00073
00075 DLG_GETOBJECT_FILTER (
00076 const char *extns
00077 );
00078
00080 DLG_GETOBJECT_FILTER (
00081 const MISTRING& extns
00082 );
00083
00085 DLG_GETOBJECT_FILTER (
00086 const RVC::OBJTYPESET& ObjTypeSetSelectable
00087 );
00088
00091 DLG_GETOBJECT_FILTER (
00092 const RVC::OBJTYPESET& ObjTypeSetSelectable,
00093 const RVC::OBJTYPESET& ObjTypeSetValidParent
00094 );
00095
00096
00097 virtual ~DLG_GETOBJECT_FILTER ();
00098
00101 void AddDelegateIsFileSelectable (
00102 DELEGATE_FILTER_FILEPATH delegate
00103 );
00104
00107 void AddDelegateIsFolderBrowsable (
00108 DELEGATE_FILTER_FILEPATH delegate
00109 );
00110
00113 void AddDelegateIsFolderSelectable (
00114 DELEGATE_FILTER_FILEPATH delegate
00115 );
00116
00119 void AddDelegateIsFolderValidParent (
00120 DELEGATE_FILTER_FILEPATH delegate
00121 );
00122
00125 void AddDelegateIsListValid (
00126 DELEGATE_FILTER_OBJITEMLIST delegate
00127 );
00128
00131 void AddDelegateIsObjectBrowsable (
00132 DELEGATE_FILTER_OBJITEM delegate
00133 );
00134
00138 void AddDelegateIsObjectSelectable (
00139 DELEGATE_FILTER_OBJITEM delegate,
00140 bool inclusive = true
00141 );
00142
00145 void AddDelegateIsObjectValidParent (
00146 DELEGATE_FILTER_OBJITEM delegate
00147 );
00148
00150 void AddFileType (
00151 const FILETYPE& filetype
00152 );
00153
00156 void AddFileTypes (
00157 const char *extn
00158 );
00159
00162 void AddFileTypes (
00163 const MISTRING& extn
00164 );
00165
00167 void AddObjTypeSelectable (
00168 RVC::OBJTYPE ObjTypeSelectable
00169 );
00170
00172 void AddObjTypeSetSelectable (
00173 const RVC::OBJTYPESET& ObjTypeSetSelectable
00174 );
00175
00177 void Clear (
00178 ) const { m_Message.Clear(); m_ErrValue = 0; }
00179
00181 bool GetAllowAllFileExtns (
00182 ) const { return (m_AllowAllFileExtns); }
00183
00185 bool GetAllowAllObjTypes (
00186 ) const { return (m_AllowAllObjTypes); }
00187
00189 ERRVALUE GetErrValue (
00190 ) const { return (m_ErrValue); }
00191
00193 const FILETYPESET& GetFileTypeSet (
00194 ) const { return (*m_pFileTypeSet); }
00195
00198 MISTRING GetMessage (
00199 TEXTID TextID = TEXTID__None
00200 ) const;
00201
00203 const RVC::OBJTYPESET& GetObjTypeSetSelectable (
00204 ) const { return (m_ObjTypeSetSelectable); }
00205
00207 const RVC::OBJTYPESET& GetObjTypeSetValidParent (
00208 ) const { return (m_ObjTypeSetValidParent); }
00209
00215 bool IsFileSelectable (
00216 const FILEPATH& filepath,
00217 int position = -1,
00218 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0
00219 ) const;
00220
00226 bool IsFolderBrowsable (
00227 const FILEPATH& filepath,
00228 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0
00229 ) const;
00230
00236 bool IsFolderSelectable (
00237 const FILEPATH& filepath,
00238 int position = -1,
00239 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0
00240 ) const;
00241
00247 bool IsFolderValidParent (
00248 const FILEPATH& filepath,
00249 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0
00250 ) const;
00251
00257 bool IsListValid (
00258 const RVC::OBJITEMLIST& objlist,
00259 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0
00260 ) const;
00261
00266 bool IsObjectBrowsable (
00267 const RVC::OBJITEM& objitem,
00268 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0
00269 ) const;
00270
00276 bool IsObjectSelectable (
00277 const RVC::OBJITEM& objitem,
00278 int position = -1,
00279 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0,
00280 bool bIgnoreDelegates = false
00281 ) const;
00282
00290 bool IsObjectValidParent (
00291 const RVC::OBJITEM& parent,
00292 DLG_GETOBJECT_FILTER *pFilterProxyFor = 0
00293 ) const;
00294
00296 void SetAllowAllFileExtns (
00297 bool allow = true
00298 ) { m_AllowAllFileExtns = allow; }
00299
00301 void SetAllowBrowseIfHasSelectableChild (
00302 bool allow = true
00303 ) const { m_AllowBrowseIfHasSelectableChild = allow; }
00304
00306 void SetErrValue (
00307 ERRVALUE err
00308 ) const { m_ErrValue = err; }
00309
00311 void SetMessage (
00312 const MISTRING& message
00313 ) const { m_Message = message; }
00314
00315 private:
00316 #ifndef GENERATING_DOXYGEN_OUTPUT
00317
00318 typedef MILIST<DELEGATE_FILTER_FILEPATH> DELEGATELIST_FILE;
00319 typedef MILIST<DELEGATE_FILTER_OBJITEMLIST> DELEGATELIST_LIST;
00320 typedef MILIST<DELEGATE_FILTER_OBJITEM> DELEGATELIST_OBJECT;
00321
00322 RVC::OBJTYPESET m_ObjTypeSetSelectable;
00323 mutable RVC::OBJTYPESET m_ObjTypeSetValidParent;
00324 DELEGATELIST_FILE m_DelegateListIsFileSelectable;
00325 DELEGATELIST_FILE m_DelegateListIsFolderBrowsable;
00326 DELEGATELIST_FILE m_DelegateListIsFolderSelectable;
00327 DELEGATELIST_FILE m_DelegateListIsFolderValidParent;
00328 DELEGATELIST_OBJECT m_DelegateListIsObjectBrowsable;
00329 DELEGATELIST_OBJECT m_DelegateListIsObjectSelectableExclusive;
00330 DELEGATELIST_OBJECT m_DelegateListIsObjectSelectableInclusive;
00331 DELEGATELIST_OBJECT m_DelegateListIsObjectValidParent;
00332 DELEGATELIST_LIST m_DelegateListIsListValid;
00333 FILETYPESET *m_pFileTypeSet;
00334 bool m_AllowAllFileExtns;
00335 bool m_AllowAllObjTypes;
00336 mutable bool m_AllowBrowseIfHasSelectableChild;
00337 bool m_AllowBrowseIfIsValidParent;
00338 mutable bool m_NeedUpdateValidParentSet;
00339 mutable MISTRING m_Message;
00340 mutable ERRVALUE m_ErrValue;
00341
00342 void AddFileExtn (const MISTRING& extn);
00343 void UpdateValidParentSet () const;
00344 #endif // GENERATING_DOXYGEN_OUTPUT
00345
00349 virtual bool v_IsFileSelectable (
00350 const FILEPATH& filepath,
00351 int position
00352 ) const;
00353
00357 virtual bool v_IsFolderBrowsable (
00358 const FILEPATH& filepath
00359 ) const;
00360
00364 virtual bool v_IsFolderSelectable (
00365 const FILEPATH& filepath,
00366 int position
00367 ) const;
00368
00372 virtual bool v_IsFolderValidParent (
00373 const FILEPATH& filepath
00374 ) const;
00375
00379 virtual bool v_IsListValid (
00380 const RVC::OBJITEMLIST& objlist
00381 ) const;
00382
00385 virtual bool v_IsObjectBrowsable (
00386 const RVC::OBJITEM& objitem
00387 ) const;
00388
00392 virtual bool v_IsObjectSelectable (
00393 const RVC::OBJITEM& objitem,
00394 int position
00395 ) const;
00396
00400 virtual bool v_IsObjectValidParent (
00401 const RVC::OBJITEM& parent
00402 ) const;
00403
00404 };
00405
00406
00407
00408 }
00409
00410 #endif // INC_MGUI_DLGGETOBJECTFILTER_H
00411