OpendTect-6_4  6.4
uishortcutsmgr.h
Go to the documentation of this file.
1 #ifndef uishortcutsmgr_h
2 #define uishortcutsmgr_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: H. Payraudeau
9  Date: 20/01/2006
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "iopar.h"
17 #include "enums.h"
18 #include "keyenum.h"
19 #include "bufstringset.h"
20 #include "uistring.h"
21 
22 mFDQtclass(QKeyEvent)
23 
24 
25 class uiShortcutsMgr;
26 mGlobal(uiBase) uiShortcutsMgr& SCMgr();
28 
29 
31 {
32 public:
33  uiKeyDesc(const char* statestr=0,const char* keystr=0);
34  virtual ~uiKeyDesc() {}
35 
36  bool operator==(const uiKeyDesc& ev) const
37  { return key_==ev.key_ && state_==ev.state_; }
38 
39  bool set(const char* statestr,const char* keystr);
40  BufferString getKeySequenceStr() const;
41 
42  OD::ButtonState state() const { return state_; }
43  void setState( OD::ButtonState bs ) { state_ = bs; }
44 
45  //virtual: just to have the base class be polymorphic, allows dynamic cast
46  virtual int key() const { return key_; }
47  void setKey( int k ) { key_ = k; }
48  char asciiChar() const;
49  bool isSimpleAscii() const;
50 
51  static const char** sKeyKeyStrs();
52  const char* stateStr() const;
53  const char* keyStr() const;
54 
55  uiKeyDesc(mQtclass(QKeyEvent*));
56 
57 protected:
58 
59  int key_;
61 
62  void handleSpecialKey(const char*);
63 
64 };
65 
66 
68 {
69 public:
70 
71  uiShortcutsList( const uiShortcutsList& scl )
72  { *this = scl; }
73  ~uiShortcutsList() { empty(); }
74  uiShortcutsList& operator =(const uiShortcutsList&);
75  bool write(bool usr=true) const;
76 
77  void fillPar(IOPar&) const;
78 
79  ObjectSet<uiKeyDesc>& keyDescs() { return keydescs_; }
80  const ObjectSet<uiKeyDesc>& keyDescs() const { return keydescs_; }
81  BufferStringSet& names() { return names_; }
82  const BufferStringSet& names() const { return names_; }
83  const uiKeyDesc* keyDescOf(const char*) const;
84  const char* nameOf(const uiKeyDesc&) const;
85  int valueOf(const uiKeyDesc&) const;
86 
87  void empty();
88 
89 protected:
90 
91  friend class uiShortcutsMgr;
92  uiShortcutsList(const char* selkey);
93 
97 
98  bool getKeyValues(const IOPar&,int,
99  BufferString&,BufferString&) const;
100  bool getSCNames(const IOPar&,int,BufferString&) const;
101  bool getSCProperties(const IOPar&,int,
102  uiString&,int&) const;
103 };
104 
105 
107 {
108 public:
109  uiShortcutsMgr();
110 
111  const uiShortcutsList& getList(const char* key) const;
112  bool setList(const uiShortcutsList&,bool usr=true);
113 
115 
116 protected:
117 
120 
121  friend class uiShortcutsList;
122  IOPar* getStored(const char*);
123  bool putStored(const char*,const IOPar&);
124 
125 };
126 
127 
129 {
130 public:
131  uiExtraIntKeyDesc(const char* statestr=0,
132  const char* keystr=0,
133  int val=1);
135 
136  bool operator==(const uiExtraIntKeyDesc& ev) const
137  { return key_==ev.key_ && state_==ev.state_ &&
138  val_==ev.val_; }
139 
140  bool set(const char* statestr,const char* keystr,int val);
141  void setIntLabel( const uiString& lbl ) { extralbl_ = lbl; }
142 
143  int getIntValue() const { return val_; }
144  const uiString& getLabel() const { return extralbl_; }
145 
146 protected:
147 
148  int val_;
150 };
151 
152 #endif
#define mExpClass(module)
Definition: commondefs.h:160
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
BufferStringSet names_
Definition: uishortcutsmgr.h:96
OD::ButtonState state() const
Definition: uishortcutsmgr.h:42
Definition: uishortcutsmgr.h:30
#define mQtclass(cls)
Definition: commondefs.h:229
Notifier< uiShortcutsMgr > shortcutsChanged
Definition: uishortcutsmgr.h:114
#define mGlobal(module)
Definition: commondefs.h:163
uiString extralbl_
Definition: uishortcutsmgr.h:149
void setIntLabel(const uiString &lbl)
Definition: uishortcutsmgr.h:141
Definition: uistring.h:89
Definition: uishortcutsmgr.h:106
Set of BufferString objects.
Definition: bufstringset.h:28
friend class uiShortcutsList
Definition: uishortcutsmgr.h:121
Definition: uishortcutsmgr.h:67
Definition: uishortcutsmgr.h:128
uiShortcutsList(const uiShortcutsList &scl)
Definition: uishortcutsmgr.h:71
bool operator==(const uiKeyDesc &ev) const
Definition: uishortcutsmgr.h:36
ButtonState
Definition: keyenum.h:20
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
const ObjectSet< uiKeyDesc > & keyDescs() const
Definition: uishortcutsmgr.h:80
bool operator==(const uiExtraIntKeyDesc &ev) const
Definition: uishortcutsmgr.h:136
ObjectSet< uiKeyDesc > keydescs_
Definition: uishortcutsmgr.h:95
BufferString selkey_
Definition: uishortcutsmgr.h:94
virtual ~uiKeyDesc()
Definition: uishortcutsmgr.h:34
BufferStringSet & names()
Definition: uishortcutsmgr.h:81
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
bool setList(const uiShortcutsList &, bool usr=true)
int getIntValue() const
Definition: uishortcutsmgr.h:143
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
virtual int key() const
Definition: uishortcutsmgr.h:46
OD::ButtonState state_
Definition: uishortcutsmgr.h:60
const uiString & getLabel() const
Definition: uishortcutsmgr.h:144
void setKey(int k)
Definition: uishortcutsmgr.h:47
mFDQtclass(QKeyEvent) class uiShortcutsMgr
ObjectSet< uiShortcutsList > lists_
Definition: uishortcutsmgr.h:119
uiShortcutsMgr & SCMgr()
This is where you get your shortcuts.
int key_
Definition: uishortcutsmgr.h:59
const BufferStringSet & names() const
Definition: uishortcutsmgr.h:82
const char * nameOf(ButtonState)
void setState(OD::ButtonState bs)
Definition: uishortcutsmgr.h:43
int val_
Definition: uishortcutsmgr.h:148
~uiShortcutsList()
Definition: uishortcutsmgr.h:73
const uiShortcutsList & getList(const char *key) const
BufferStringSet keys_
Definition: uishortcutsmgr.h:118
ObjectSet< uiKeyDesc > & keyDescs()
Definition: uishortcutsmgr.h:79

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