NamedObjs.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. Integer __fastcall CompareName(UnicodeString aName, Boolean CaseSensitive = False);
  15. __fastcall TNamedObject(UnicodeString aName);
  16. void __fastcall MakeUniqueIn(TNamedObjectList * List);
  17. private:
  18. UnicodeString FName;
  19. bool FHidden;
  20. void __fastcall SetName(UnicodeString value);
  21. };
  22. //---------------------------------------------------------------------------
  23. class TNamedObjectList : public TObjectList
  24. {
  25. private:
  26. int FHiddenCount;
  27. int __fastcall GetCount();
  28. virtual void __fastcall Notify(void *Ptr, TListNotification Action);
  29. void __fastcall SetCount(int value);
  30. protected:
  31. void __fastcall Recount();
  32. public:
  33. static const UnicodeString HiddenPrefix;
  34. bool AutoSort;
  35. __fastcall TNamedObjectList();
  36. void __fastcall AlphaSort();
  37. virtual TNamedObject * __fastcall AtObject(Integer Index);
  38. TNamedObject * __fastcall FindByName(UnicodeString Name, Boolean CaseSensitive = False);
  39. __property int Count = { read = GetCount, write = SetCount };
  40. __property int HiddenCount = { read = FHiddenCount, write = FHiddenCount };
  41. };
  42. //---------------------------------------------------------------------------
  43. int __fastcall NamedObjectSortProc(void * Item1, void * Item2);
  44. //---------------------------------------------------------------------------
  45. #endif