Rights.h 6.0 KB

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