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

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