~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to library/canvas/src/mdc_events.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _MDC_EVENTS_H_
 
2
#define _MDC_EVENTS_H_
 
3
 
 
4
//#include "mdc_common.h"
 
5
 
 
6
namespace mdc {
 
7
 
 
8
 
 
9
enum EventState {
 
10
  SNone=             0,
 
11
  SLeftButtonMask=   (1<<0),
 
12
  SMiddleButtonMask= (1<<1),
 
13
  SRightButtonMask=  (1<<2),
 
14
  
 
15
  SButtonMask=  0x0f,
 
16
 
 
17
  SShiftMask=        (1<<8),
 
18
  SControlMask=      (1<<9),
 
19
  SAltMask=          (1<<10),
 
20
  SOptionMask=       SAltMask,
 
21
  SCommandMask=      (1<<11),
 
22
  
 
23
  SModifierMask=   (SShiftMask|SControlMask|SAltMask|SOptionMask|SCommandMask),
 
24
  
 
25
  SLeaveMask=        (1<<16),
 
26
  SEnterMask=        (1<<17)
 
27
};
 
28
 
 
29
 
 
30
enum KeyCode {
 
31
  KNone= 0,
 
32
 
 
33
  KEscape,
 
34
  KTab = '\t',
 
35
  KEnter = '\n',
 
36
  KSpace = ' ',
 
37
  KPeriod = '.',
 
38
  KComma = ',',
 
39
  KSemicolon = ';',
 
40
  KPlus = '+',
 
41
  KMinus = '-',
 
42
 
 
43
  KShift = 0xff00,
 
44
  KAlt,
 
45
  KControl,
 
46
  KOption,
 
47
  KCommand,
 
48
 
 
49
  KF1,
 
50
  KF2,
 
51
  KF3,
 
52
  KF4,
 
53
  KF5,
 
54
  KF6,
 
55
  KF7,
 
56
  KF8,
 
57
  KF9,
 
58
  KF10,
 
59
  KF11,
 
60
  KF12,
 
61
 
 
62
  KLeft,
 
63
  KRight,
 
64
  KUp,
 
65
  KDown,
 
66
  KHome,
 
67
  KEnd,
 
68
  KPageUp,
 
69
  KPageDown,
 
70
 
 
71
  KInsert,
 
72
  KDelete,
 
73
  KBackspace
 
74
 
 
75
};
 
76
 
 
77
 
 
78
struct KeyInfo {
 
79
  KeyCode keycode;
 
80
  std::string string;
 
81
 
 
82
  bool operator==(const KeyInfo &other) const
 
83
  {
 
84
    if (keycode != 0 && keycode == other.keycode)
 
85
      return true;
 
86
    return string == other.string;
 
87
  }
 
88
};
 
89
 
 
90
 
 
91
inline EventState operator& (EventState s1, EventState s2)
 
92
{
 
93
  return (EventState)((int)s1&(int)s2);
 
94
}
 
95
 
 
96
inline EventState operator| (EventState s1, EventState s2)
 
97
{
 
98
  return (EventState)((int)s1|(int)s2);
 
99
}
 
100
 
 
101
 
 
102
 
 
103
enum MouseButton {
 
104
  ButtonLeft= 0,
 
105
  ButtonMiddle= 1,
 
106
  ButtonRight= 2
 
107
};
 
108
 
 
109
 
 
110
inline EventState operator - (EventState s, MouseButton b)
 
111
{
 
112
  return (EventState)((int)s & ~(1<<(int)b));
 
113
}
 
114
 
 
115
inline EventState operator + (EventState s, MouseButton b)
 
116
{
 
117
  return (EventState)((int)s | (1<<(int)b));
 
118
}
 
119
 
 
120
 
 
121
 
 
122
};
 
123
 
 
124
#endif
 
125