OpendTect  6.6
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  RCS: $Id$
10  ________________________________________________________________________
11 
12 -*/
13 
14 #include "uicmddrivermod.h"
15 #include "command.h"
16 #include "cmdcomposer.h"
17 #include "rowcol.h"
18 #include "uitable.h"
19 
20 
21 namespace CmdDrive
22 {
23 
25 protected:
26  enum TableTag { RowTag=0,RowHead,CellTag,ColHead,ColTag };
27 
28  bool parTableSelPre(const char* prefix,TableTag,
29  const uiTable*,const BufferString& itemstr,
30  int itemnr,TypeSet<RowCol>& itemrcs,
31  bool ambicheck);
32 
33  RowCol singleSelected(const uiTable*) const;
34  bool isSelected(const uiTable*,const RowCol&) const;
35 
37 
38 
39 mStartDeclCmdClass( uiCmdDriver, TableClick, TableCmd ) mEndDeclCmdClass
40 
41 mExpClass(uiCmdDriver) TableActivator: public Activator
42 {
43 public:
44  TableActivator(const uiTable&,const RowCol&,
45  const BufferStringSet& clicktags);
46  void actCB(CallBacker*);
47 protected:
50 
52 };
53 
54 
55 mStartDeclCmdClass( uiCmdDriver, TableFill, TableCmd ) mEndDeclCmdClass
56 
58 {
59 public:
61  const char* txt);
62  void actCB(CallBacker*);
63 protected:
67 };
68 
69 
70 mStartDeclCmdClass( uiCmdDriver, TableSelect, TableCmd ) mEndDeclCmdClass
71 
73 {
74 public:
76  const TypeSet<RowCol>&);
77  void actCB(CallBacker*);
78 protected:
80 
81  const TypeSet<RowCol>& actselset_; // Only access before trigger!
82 };
83 
84 
85 mStartDeclCmdClassNoActNoEntry( uiCmdDriver,TableQuestion, TableCmd )
86  virtual bool isUiObjChangeCommand() const { return false; }
87  virtual bool isVisualCommand() const { return false; }
89 
90 
92 mStartDeclCmdClass( uiCmdDriver, TableMenu, TableCmd ) mEndDeclCmdClass
93 
94 
104 mStartDeclCmdClass( uiCmdDriver, NrTableMenuItems, TableQuestionCmd )
106 mStartDeclCmdClass( uiCmdDriver, IsTableMenuItemOn, TableQuestionCmd )
108 mStartDeclCmdClass( uiCmdDriver, GetTableMenuItem, TableQuestionCmd )
110 
111 
112 /* Ordered encoded set of table RowCols for which some boolean state
113  (selected, checked, etc.) is true. Order is ascending with column
114  as major and row as minor key. Two consecutive RowCols (row0,-step)
115  and (row1,col) encode a series of rows in column col from row0 to
116  row1 with a positive step step.
117 */
118 mExpClass(uiCmdDriver) TableState
119 {
120 public:
121  TableState(const uiTable* uitable=0)
122  : table_( uitable ) {};
123 
124  bool headInsert(const RowCol&);
125  int remove(const RowCol&,int startidx=0);
126  int indexOf(const RowCol&,int startidx=0) const;
127 
128  bool equalToCurItemSel() const;
129  bool equalToClickedItem(const RowCol&) const;
130 
132 
133  void setTable(const uiTable* uit) { table_ = uit; }
134  void clear() { set_.erase(); }
135  bool setAll();
136 
137  const TypeSet<RowCol>& getSet() const { return set_; }
138 
139 protected:
140  const uiTable* table_;
142 };
143 
144 
146 public:
147  virtual void updateInternalState();
148  static void getExecPrefix(CmdRecEvent&,const RowCol&);
149 
150 protected:
151  void reInit();
155 
157  int writeTableSelect(bool differential,
158  bool virtually=false);
159  void writeTableSelect(const RowCol& firstrc,
160  const RowCol& lastrc,
161  int blockstate,bool clear);
165 
166  int stagenr_;
172 
176 
178 
179 
180 }; // namespace CmdDrive
181 
CmdDrive::TableState::setTable
void setTable(const uiTable *uit)
Definition: tablecommands.h:133
CmdDrive::TableCmd::TableTag
TableTag
Definition: tablecommands.h:26
CmdDrive::TableCmd::parTableSelPre
bool parTableSelPre(const char *prefix, TableTag, const uiTable *, const BufferString &itemstr, int itemnr, TypeSet< RowCol > &itemrcs, bool ambicheck)
CmdDrive::TableActivator::actclicktags_
BufferStringSet actclicktags_
Definition: tablecommands.h:51
CmdDrive::TableActivator::actCB
void actCB(CallBacker *)
cmdcomposer.h
CmdDrive::TableCmdComposer::reInit
void reInit()
CmdDrive::TableActivator
Definition: tablecommands.h:42
CmdDrive::TableState::indexOf
int indexOf(const RowCol &, int startidx=0) const
CmdDrive::TableCmdComposer::writeTableClick
void writeTableClick()
CmdDrive::TableCmdComposer::labelStoredStateNew
void labelStoredStateNew()
CmdDrive::UiObjectCmd
Definition: command.h:155
BufferStringSet
Set of BufferString objects.
Definition: bufstringset.h:26
mEndDeclCmdClass
#define mEndDeclCmdClass
Definition: command.h:151
CmdDrive::TableFillActivator::TableFillActivator
TableFillActivator(const uiTable &, const RowCol &, const char *txt)
CmdDrive::TableState::headInsert
bool headInsert(const RowCol &)
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
CmdDrive::TableState::equalToClickedItem
bool equalToClickedItem(const RowCol &) const
CmdDrive::TableSelectActivator::TableSelectActivator
TableSelectActivator(const uiTable &, const TypeSet< RowCol > &)
CmdDrive::TableSelectActivator
Definition: tablecommands.h:73
CmdDrive::TableCmdComposer::writeTableSelect
void writeTableSelect(const RowCol &firstrc, const RowCol &lastrc, int blockstate, bool clear)
CmdDrive::TableCmdComposer::labelStoredStateOld
void labelStoredStateOld()
CmdDrive::TableSelectActivator::actselset_
const TypeSet< RowCol > & actselset_
Definition: tablecommands.h:81
CmdDrive::TableCmdComposer::selectedcells_
TableState selectedcells_
Definition: tablecommands.h:173
CmdDrive::TableCmdComposer::selchanged_
bool selchanged_
Definition: tablecommands.h:170
Table
Definition: geom2dascio.h:20
CallBacker
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
CmdDrive::TableFillActivator::acttxt_
BufferString acttxt_
Definition: tablecommands.h:66
CmdDrive::TableCmd::singleSelected
RowCol singleSelected(const uiTable *) const
CmdDrive::TableState::remove
int remove(const RowCol &, int startidx=0)
CmdDrive::TableCmdComposer::getExecPrefix
static void getExecPrefix(CmdRecEvent &, const RowCol &)
mStartDeclCmdClassNoActNoEntry
#define mStartDeclCmdClassNoActNoEntry(mod, cmdkey, parentclass)
Definition: command.h:121
CmdDrive::TableCmd::isSelected
bool isSelected(const uiTable *, const RowCol &) const
CmdDrive::mStartDeclCmdClass
mStartDeclCmdClass(CmdDriver, Wheel, UiObjectCmd) mEndDeclCmdClass class WheelActivator mStartDeclCmdClass(CmdDriver, GetWheel, UiObjQuestionCmd) mEndDeclCmdClass mStartDeclComposerClassWithInit(CmdDriver
CmdDrive::TableCmdComposer::writeTableSelect
void writeTableSelect()
CmdDrive::TableCmdComposer::writeTableSelect
int writeTableSelect(bool differential, bool virtually=false)
command.h
CmdDrive::TableActivator::actrc_
RowCol actrc_
Definition: tablecommands.h:49
CmdDrive::CmdComposer
Definition: cmdcomposer.h:52
CmdDrive::TableCmdComposer::clickedrc_
RowCol clickedrc_
Definition: tablecommands.h:167
CmdDrive::TableState::clear
void clear()
Definition: tablecommands.h:134
CmdDrive::TableState::table_
const uiTable * table_
Definition: tablecommands.h:140
CmdDrive::TableActivator::TableActivator
TableActivator(const uiTable &, const RowCol &, const BufferStringSet &clicktags)
mEndDeclComposerClass
#define mEndDeclComposerClass
Definition: cmdcomposer.h:148
CmdDrive::TableState::setAll
bool setAll()
CmdDrive::TableCmdComposer::isselectedcells_
TableState isselectedcells_
Definition: tablecommands.h:175
CmdDrive::TableFillActivator
Definition: tablecommands.h:58
CmdDrive::TableState::set_
TypeSet< RowCol > set_
Definition: tablecommands.h:141
CmdDrive::TableState::getSet
const TypeSet< RowCol > & getSet() const
Definition: tablecommands.h:137
CmdDrive::TableState
Definition: tablecommands.h:119
CmdDrive::TableState::equalToCurItemSel
bool equalToCurItemSel() const
CmdDrive::TableQuestionCmd
Definition: tablecommands.h:85
CmdDrive::TableFillActivator::actCB
void actCB(CallBacker *)
CmdDrive::TableFillActivator::actrc_
RowCol actrc_
Definition: tablecommands.h:65
CmdDrive::TableActivator::acttable_
uiTable & acttable_
Definition: tablecommands.h:48
mStartDeclComposerClassWithInit
#define mStartDeclComposerClassWithInit(mod, cmdkey, parentclass, callerclass)
Definition: cmdcomposer.h:144
CmdDrive::TableState::TableState
TableState(const uiTable *uitable=0)
Definition: tablecommands.h:121
CmdDrive::TableQuestionCmd::isVisualCommand
virtual bool isVisualCommand() const
Definition: tablecommands.h:87
CmdDrive::TableCmdComposer::updateInternalState
virtual void updateInternalState()
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
uitable.h
CmdDrive::TableState::storeCurItemSel
bool storeCurItemSel()
uiTable
Definition: uitable.h:31
CmdDrive::TableCmdComposer::writeTableMenu
void writeTableMenu(const CmdRecEvent &)
CmdDrive
Command Drive
Definition: canvascommands.h:22
CmdDrive::TableCmdComposer::writeTableFill
void writeTableFill()
CmdDrive::TableCmdComposer::leftclicked_
bool leftclicked_
Definition: tablecommands.h:168
CmdDrive::CmdRecEvent
Definition: cmdrecorder.h:35
CmdDrive::TableCmdComposer::stagenr_
int stagenr_
Definition: tablecommands.h:166
CmdDrive::TableFillActivator::acttable_
uiTable & acttable_
Definition: tablecommands.h:64
RowCol
IdxPair used for its row() and col().
Definition: rowcol.h:25
CmdDrive::TableCmdComposer::tablecmdsflushed_
bool tablecmdsflushed_
Definition: tablecommands.h:171
CmdDrive::TableCmdComposer::storeTableState
void storeTableState()
CmdDrive::TableCmd
Definition: tablecommands.h:24
CmdDrive::TableCmdComposer::wasselectedcells_
TableState wasselectedcells_
Definition: tablecommands.h:174
CmdDrive::TableSelectActivator::acttable_
uiTable & acttable_
Definition: tablecommands.h:79
rowcol.h
CmdDrive::TableCmdComposer::ctrlclicked_
bool ctrlclicked_
Definition: tablecommands.h:169
StrmOper::clear
void clear(std::ios &)
CmdDrive::TableSelectActivator::actCB
void actCB(CallBacker *)
CmdDrive::Activator
Definition: command.h:186
TypeSet< RowCol >

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