File indexing completed on 2024-11-15 09:57:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TQCommand
0013 #define ROOT_TQCommand
0014
0015
0016
0017
0018
0019
0020
0021 #include "TList.h"
0022
0023 #include "TQObject.h"
0024
0025 class TQConnection;
0026
0027 class TQCommand : public TList, public TQObject {
0028
0029 friend class TQUndoManager;
0030
0031 protected:
0032 TQConnection *fRedo;
0033 TQConnection *fUndo;
0034 Long_t *fRedoArgs;
0035 Long_t *fUndoArgs;
0036 Int_t fNRargs;
0037 Int_t fNUargs;
0038 Int_t fState;
0039 Int_t fStatus;
0040 Bool_t fNewDelete;
0041 TString fName;
0042 TString fTitle;
0043 void *fObject;
0044
0045 virtual void Init(const char *cl, void *object,
0046 const char *redo, const char *undo);
0047 void PrintCollectionHeader(Option_t* option) const override;
0048
0049 private:
0050 TQCommand &operator=(const TQCommand &);
0051
0052 public:
0053 TQCommand(const char *cl = nullptr, void *object = nullptr,
0054 const char *redo = nullptr, const char *undo = nullptr);
0055 TQCommand(TObject *obj, const char *redo = nullptr, const char *undo = nullptr);
0056 TQCommand(const TQCommand &com);
0057 virtual ~TQCommand();
0058
0059 virtual void Redo(Option_t *option="");
0060 virtual void Undo(Option_t *option="");
0061 virtual void SetArgs(Int_t nargs, ...);
0062 virtual void SetUndoArgs(Int_t nargs, ...);
0063 virtual void SetRedoArgs(Int_t nargs, ...);
0064 virtual Bool_t CanMerge(TQCommand *c) const;
0065 virtual void Merge(TQCommand *c);
0066 virtual Long64_t Merge(TCollection*,TFileMergeInfo*);
0067 virtual Bool_t CanCompress(TQCommand *c) const;
0068 virtual void Compress(TQCommand *c);
0069 Bool_t IsEqual(const TObject* obj) const override;
0070 virtual Bool_t IsSetter() const;
0071 virtual Bool_t CanRedo() const;
0072 virtual Bool_t CanUndo() const;
0073 const char *GetRedoName() const;
0074 const char *GetUndoName() const;
0075 TQConnection *GetRedo() const { return fRedo; }
0076 TQConnection *GetUndo() const { return fUndo; }
0077 Long_t *GetRedoArgs() const;
0078 Long_t *GetUndoArgs() const;
0079 Int_t GetNRargs() const;
0080 Int_t GetNUargs() const;
0081 void *GetObject() const;
0082 Int_t GetStatus() const;
0083 Bool_t IsMacro() const;
0084 Bool_t IsUndoing() const;
0085 Bool_t IsRedoing() const;
0086 Bool_t IsExecuting() const;
0087 virtual void SetName(const char *name);
0088 virtual void SetTitle(const char *title);
0089 void ls(Option_t *option="") const override;
0090 void Add(TObject *obj, Option_t *opt) override;
0091 void Add(TObject *obj) override { Add(obj, nullptr); }
0092 void Delete(Option_t *option="") override;
0093 const char *GetName() const override;
0094 const char *GetTitle() const override;
0095
0096 static TQCommand *GetCommand();
0097
0098 ClassDefOverride(TQCommand,0)
0099 };
0100
0101
0102
0103 class TQUndoManager : public TQCommand {
0104
0105 protected:
0106 TObjLink *fCursor;
0107 TQCommand *fCurrent;
0108 UInt_t fLimit;
0109 TList *fLogBook;
0110 Bool_t fLogging;
0111
0112 void PrintCollectionEntry(TObject* entry, Option_t* option, Int_t recurse) const override;
0113
0114 public:
0115 TQUndoManager();
0116 virtual ~TQUndoManager();
0117
0118 void Add(TObject *obj, Option_t *opt) override;
0119 void Add(TObject *obj) override { Add(obj, nullptr); }
0120 void Redo(Option_t *option="") override;
0121 void Undo(Option_t *option="") override;
0122 Bool_t CanRedo() const override;
0123 Bool_t CanUndo() const override;
0124 virtual void SetLogging(Bool_t on = kTRUE);
0125 Bool_t IsLogging() const;
0126 TQCommand *GetCurrent() const;
0127 TQCommand *GetCursor() const;
0128 UInt_t GetLimit() const;
0129 virtual void SetLimit(UInt_t limit);
0130 virtual void CurrentChanged(TQCommand *c);
0131 void ls(Option_t *option="") const override;
0132
0133 ClassDefOverride(TQUndoManager,0)
0134 };
0135
0136 #endif