OpendTect-6_4  6.4
tablecommands.h
Go to the documentation of this file.
1 #ifndef tablecommands_h
2 #define tablecommands_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Jaap Glas
9  Date: February 2009
10  RCS: $Id$
11  ________________________________________________________________________
12 
13 -*/
14 
15 #include "uicmddrivermod.h"
16 #include "command.h"
17 #include "cmdcomposer.h"
18 #include "rowcol.h"
19 #include "uitable.h"
20 
21 
22 namespace CmdDrive
23 {
24 
26 protected:
27  enum TableTag { RowTag=0,RowHead,CellTag,ColHead,ColTag };
28 
29  bool parTableSelPre(const char* prefix,TableTag,
30  const uiTable*,const BufferString& itemstr,
31  int itemnr,TypeSet<RowCol>& itemrcs,
32  bool ambicheck);
33 
34  RowCol singleSelected(const uiTable*) const;
35  bool isSelected(const uiTable*,const RowCol&) const;
36 
38 
39 
40 mStartDeclCmdClass( uiCmdDriver, TableClick, TableCmd ) mEndDeclCmdClass
41 
42 mExpClass(uiCmdDriver) TableActivator: public Activator
43 {
44 public:
45  TableActivator(const uiTable&,const RowCol&,
46  const BufferStringSet& clicktags);
47  void actCB(CallBacker*);
48 protected:
51 
53 };
54 
55 
56 mStartDeclCmdClass( uiCmdDriver, TableFill, TableCmd ) mEndDeclCmdClass
57 
59 {
60 public:
61  TableFillActivator(const uiTable&,const RowCol&,
62  const char* txt);
63  void actCB(CallBacker*);
64 protected:
68 };
69 
70 
71 mStartDeclCmdClass( uiCmdDriver, TableSelect, TableCmd ) mEndDeclCmdClass
72 
74 {
75 public:
77  const TypeSet<RowCol>&);
78  void actCB(CallBacker*);
79 protected:
81 
82  const TypeSet<RowCol>& actselset_; // Only access before trigger!
83 };
84 
85 
86 mStartDeclCmdClassNoActNoEntry( uiCmdDriver,TableQuestion, TableCmd )
87  virtual bool isUiObjChangeCommand() const { return false; }
88  virtual bool isVisualCommand() const { return false; }
90 
91 
93 mStartDeclCmdClass( uiCmdDriver, TableMenu, TableCmd ) mEndDeclCmdClass
94 
95 
105 mStartDeclCmdClass( uiCmdDriver, NrTableMenuItems, TableQuestionCmd )
107 mStartDeclCmdClass( uiCmdDriver, IsTableMenuItemOn, TableQuestionCmd )
109 mStartDeclCmdClass( uiCmdDriver, GetTableMenuItem, TableQuestionCmd )
111 
112 
113 /* Ordered encoded set of table RowCols for which some boolean state
114  (selected, checked, etc.) is true. Order is ascending with column
115  as major and row as minor key. Two consecutive RowCols (row0,-step)
116  and (row1,col) encode a series of rows in column col from row0 to
117  row1 with a positive step step.
118 */
119 mExpClass(uiCmdDriver) TableState
120 {
121 public:
122  TableState(const uiTable* uitable=0)
123  : table_( uitable ) {};
124 
125  bool headInsert(const RowCol&);
126  int remove(const RowCol&,int startidx=0);
127  int indexOf(const RowCol&,int startidx=0) const;
128 
129  bool equalToCurItemSel() const;
130  bool equalToClickedItem(const RowCol&) const;
131 
132  bool storeCurItemSel();
133 
134  void setTable(const uiTable* uit) { table_ = uit; }
135  void clear() { set_.erase(); }
136  bool setAll();
137 
138  const TypeSet<RowCol>& getSet() const { return set_; }
139 
140 protected:
141  const uiTable* table_;
143 };
144 
145 
147 public:
148  virtual void updateInternalState();
149  static void getExecPrefix(CmdRecEvent&,const RowCol&);
150 
151 protected:
152  void reInit();
153  void storeTableState();
154  void labelStoredStateOld();
155  void labelStoredStateNew();
156 
157  void writeTableSelect();
158  int writeTableSelect(bool differential,
159  bool virtually=false);
160  void writeTableSelect(const RowCol& firstrc,
161  const RowCol& lastrc,
162  int blockstate,bool clear);
163  void writeTableFill();
164  void writeTableMenu(const CmdRecEvent&);
165  void writeTableClick();
166 
167  int stagenr_;
168  RowCol clickedrc_;
169  bool leftclicked_;
170  bool ctrlclicked_;
171  bool selchanged_;
172  bool tablecmdsflushed_;
173 
174  TableState selectedcells_;
175  TableState wasselectedcells_;
176  TableState isselectedcells_;
177 
179 
180 
181 }; // namespace CmdDrive
182 
183 #endif
#define mEndDeclCmdClass
Definition: command.h:152
#define mExpClass(module)
Definition: commondefs.h:160
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
#define mStartDeclCmdClass(mod, cmdkey, parentclass)
Definition: command.h:148
void setTable(const uiTable *uit)
Definition: tablecommands.h:134
Command Drive
Definition: canvascommands.h:22
RowCol actrc_
Definition: tablecommands.h:50
Definition: tablecommands.h:73
Definition: tablecommands.h:25
TypeSet< RowCol > set_
Definition: tablecommands.h:142
void clear()
Definition: tablecommands.h:135
Definition: tablecommands.h:119
Definition: command.h:186
void clear(std::ios &)
Definition: uitable.h:30
Set of BufferString objects.
Definition: bufstringset.h:28
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
const TypeSet< RowCol > & getSet() const
Definition: tablecommands.h:138
const TypeSet< RowCol > & actselset_
Definition: tablecommands.h:82
Definition: tablecommands.h:86
uiTable & acttable_
Definition: tablecommands.h:49
uiTable & acttable_
Definition: tablecommands.h:65
RowCol actrc_
Definition: tablecommands.h:66
#define mStartDeclComposerClassWithInit(mod, cmdkey, parentclass, callerclass)
Definition: cmdcomposer.h:145
Definition: geom2dascio.h:21
BufferString acttxt_
Definition: tablecommands.h:67
Definition: cmdrecorder.h:35
Definition: cmdcomposer.h:52
#define mStartDeclCmdClassNoActNoEntry(mod, cmdkey, parentclass)
Definition: command.h:122
#define mEndDeclComposerClass
Definition: cmdcomposer.h:149
IdxPair used for its row() and col().
Definition: rowcol.h:25
virtual bool isVisualCommand() const
Definition: tablecommands.h:88
Definition: command.h:156
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
const uiTable * table_
Definition: tablecommands.h:141
Definition: tablecommands.h:58
Definition: tablecommands.h:42
TableTag
Definition: tablecommands.h:27
TableState(const uiTable *uitable=0)
Definition: tablecommands.h:122
BufferStringSet actclicktags_
Definition: tablecommands.h:52
uiTable & acttable_
Definition: tablecommands.h:80

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019