NamedObjs.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //---------------------------------------------------------------------------
  2. #ifndef NamedObjsH
  3. #define NamedObjsH
  4. #include <system.hpp>
  5. #include <contnrs.hpp>
  6. //---------------------------------------------------------------------------
  7. class TNamedObjectList;
  8. class TNamedObject : public TPersistent
  9. {
  10. public:
  11. __property UnicodeString Name = { read = FName, write = SetName };
  12. __property bool Hidden = { read = FHidden };
  13. __fastcall TNamedObject() {};
  14. bool __fastcall IsSameName(const UnicodeString & Name);
  15. virtual int __fastcall Compare(TNamedObject * Other);
  16. __fastcall TNamedObject(UnicodeString aName);
  17. void __fastcall MakeUniqueIn(TNamedObjectList * List);
  18. private:
  19. UnicodeString FName;
  20. bool FHidden;
  21. void __fastcall SetName(UnicodeString value);
  22. };
  23. //---------------------------------------------------------------------------
  24. class TNamedObjectList : public TObjectList
  25. {
  26. private:
  27. int __fastcall GetCount();
  28. int __fastcall GetCountIncludingHidden();
  29. virtual void __fastcall Notify(void *Ptr, TListNotification Action);
  30. protected:
  31. int FHiddenCount;
  32. bool FControlledAdd;
  33. void __fastcall Recount();
  34. public:
  35. static const UnicodeString HiddenPrefix;
  36. bool AutoSort;
  37. __fastcall TNamedObjectList();
  38. void __fastcall AlphaSort();
  39. int __fastcall Add(TObject * AObject);
  40. virtual TNamedObject * __fastcall AtObject(Integer Index);
  41. TNamedObject * __fastcall FindByName(const UnicodeString & Name);
  42. __property int Count = { read = GetCount };
  43. __property int CountIncludingHidden = { read = GetCountIncludingHidden };
  44. };
  45. //---------------------------------------------------------------------------
  46. int __fastcall NamedObjectSortProc(void * Item1, void * Item2);
  47. //---------------------------------------------------------------------------
  48. #endif