Rights.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //---------------------------------------------------------------------------
  2. #ifndef RightsH
  3. #define RightsH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Controls.hpp>
  7. #include <StdCtrls.hpp>
  8. #include <Forms.hpp>
  9. #include <Buttons.hpp>
  10. #include <ActnList.hpp>
  11. #include <ImgList.hpp>
  12. #include <Menus.hpp>
  13. #include "GrayedCheckBox.hpp"
  14. #include "PngImageList.hpp"
  15. #include <System.Actions.hpp>
  16. //---------------------------------------------------------------------------
  17. #include <RemoteFiles.h>
  18. #include <GUITools.h>
  19. //---------------------------------------------------------------------------
  20. class TRightsFrame : public TFrame
  21. {
  22. __published:
  23. TLabel *GroupLabel;
  24. TLabel *OthersLabel;
  25. TLabel *OwnerLabel;
  26. TGrayedCheckBox *OwnerReadCheck;
  27. TGrayedCheckBox *OwnerWriteCheck;
  28. TGrayedCheckBox *OwnerExecuteCheck;
  29. TGrayedCheckBox *GroupReadCheck;
  30. TGrayedCheckBox *GroupWriteCheck;
  31. TGrayedCheckBox *GroupExecuteCheck;
  32. TGrayedCheckBox *OthersReadCheck;
  33. TGrayedCheckBox *OthersWriteCheck;
  34. TGrayedCheckBox *OthersExecuteCheck;
  35. TCheckBox *DirectoriesXCheck;
  36. TSpeedButton *OwnerButton;
  37. TSpeedButton *GroupButton;
  38. TSpeedButton *OthersButton;
  39. TPopupMenu *RightsPopup;
  40. TMenuItem *Norights1;
  41. TMenuItem *Defaultrights1;
  42. TMenuItem *Allrights1;
  43. TMenuItem *Leaveasis1;
  44. TActionList *RightsActions;
  45. TAction *NoRightsAction;
  46. TAction *DefaultRightsAction;
  47. TAction *AllRightsAction;
  48. TAction *LeaveRightsAsIsAction;
  49. TPngImageList *RightsImages;
  50. TMenuItem *N1;
  51. TAction *CopyTextAction;
  52. TAction *CopyOctalAction;
  53. TAction *PasteAction;
  54. TMenuItem *CopyAsText1;
  55. TMenuItem *CopyAsOctal1;
  56. TMenuItem *Paste1;
  57. TPngImageList *RightsImages120;
  58. TPngImageList *RightsImages144;
  59. TPngImageList *RightsImages192;
  60. TLabel *OctalLabel;
  61. TEdit *OctalEdit;
  62. TGrayedCheckBox *SetUidCheck;
  63. TGrayedCheckBox *SetGIDCheck;
  64. TGrayedCheckBox *StickyBitCheck;
  65. TButton *CloseButton;
  66. void __fastcall ControlChange(TObject *Sender);
  67. void __fastcall RightsButtonsClick(TObject *Sender);
  68. void __fastcall RightsActionsExecute(TBasicAction *Action,
  69. bool &Handled);
  70. void __fastcall RightsActionsUpdate(TBasicAction *Action, bool &Handled);
  71. void __fastcall RightsPopupPopup(TObject *Sender);
  72. void __fastcall FrameContextPopup(TObject *Sender, TPoint &MousePos,
  73. bool &Handled);
  74. void __fastcall OctalEditChange(TObject * Sender);
  75. void __fastcall OctalEditExit(TObject * Sender);
  76. void __fastcall CloseButtonClick(TObject * Sender);
  77. private:
  78. bool FAllowAddXToDirectories;
  79. TNotifyEvent FOnChange;
  80. bool FPopup;
  81. TWinControl * FPopupParent;
  82. TButton * FDefaultButton;
  83. TButton * FCancelButton;
  84. bool FPopingContextMenu;
  85. UnicodeString FAddXToDirectoriesSuffix;
  86. bool FInitialized;
  87. bool FAcl;
  88. void CycleRights(TRights::TRightGroup RightGroup);
  89. bool __fastcall GetAddXToDirectories();
  90. bool __fastcall GetAllowUndef();
  91. TCheckBox * __fastcall GetChecks(TRights::TRight Right);
  92. TRights __fastcall GetRights();
  93. TRights::TState __fastcall GetStates(TRights::TRight Right);
  94. void __fastcall SetAddXToDirectories(bool value);
  95. void __fastcall SetAllowAddXToDirectories(bool value);
  96. void __fastcall SetAllowUndef(bool value);
  97. void __fastcall SetRights(const TRights & value);
  98. void __fastcall SetStates(TRights::TRight Right, TRights::TState value);
  99. UnicodeString __fastcall GetText();
  100. void __fastcall SetText(UnicodeString value);
  101. public:
  102. virtual __fastcall ~TRightsFrame();
  103. __fastcall TRightsFrame(TComponent* Owner);
  104. void __fastcall DropDown();
  105. void __fastcall CloseUp();
  106. void DisplayAsAcl();
  107. __property bool AddXToDirectories = { read = GetAddXToDirectories, write = SetAddXToDirectories };
  108. __property bool AllowAddXToDirectories = { read = FAllowAddXToDirectories, write = SetAllowAddXToDirectories };
  109. __property bool AllowUndef = { read = GetAllowUndef, write = SetAllowUndef };
  110. __property TCheckBox * Checks[TRights::TRight Right] = { read = GetChecks };
  111. __property TNotifyEvent OnChange = { read = FOnChange, write = FOnChange };
  112. __property TRights Rights = { read = GetRights, write = SetRights };
  113. __property UnicodeString Text = { read = GetText, write = SetText };
  114. __property bool Popup = { read = FPopup, write = SetPopup };
  115. __property TWinControl * PopupParent = { read = FPopupParent, write = FPopupParent };
  116. protected:
  117. void __fastcall DoChange();
  118. void __fastcall UpdateControls();
  119. virtual void __fastcall SetEnabled(bool Value);
  120. void __fastcall ForceUpdate();
  121. virtual void __fastcall CreateParams(TCreateParams & Params);
  122. virtual void __fastcall CreateWnd();
  123. virtual void __fastcall Dispatch(void * Message);
  124. void __fastcall CMCancelMode(TCMCancelMode & Message);
  125. void __fastcall CMDialogKey(TCMDialogKey & Message);
  126. void __fastcall WMContextMenu(TWMContextMenu & Message);
  127. bool __fastcall IsAncestor(TControl * Control, TControl * Ancestor);
  128. DYNAMIC void __fastcall DoExit();
  129. void __fastcall SetPopup(bool value);
  130. void __fastcall DoCloseUp();
  131. bool __fastcall HasFocus();
  132. bool __fastcall DirectoriesXEffective();
  133. void __fastcall UpdateOctalEdit();
  134. void __fastcall UpdateByOctal();
  135. void DisplayAsAcl(TRights::TRight ReadRight, TRights::TRight WriteRight, TRights::TRight ExecRight, TRights::TRight SpecialRight);
  136. INTERFACE_HOOK_CUSTOM(TFrame);
  137. __property TRights::TState States[TRights::TRight Right] = { read = GetStates, write = SetStates };
  138. };
  139. //---------------------------------------------------------------------------
  140. #endif