summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/orkey.h
blob: 8258ef24ea3cc0a79705af0676aac60f8d34d5ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef __ORKEY_H
#define __ORKEY_H

const uint KEYMAPVERSION = 0;

enum ActionTypes
{
    cesOpenFile = 0,
    cesAutoScroll,
    cesActionMark,
    cesActionAnno,
    cesFullScreen,
    cesZoomIn,
    cesZoomOut,
    cesBack,
    cesForward,
    cesHome,
    cesPageUp,
    cesPageDown,
    cesLineUp,
    cesLineDown,
    cesStartDoc,
    cesEndDoc,
    cesRotate,
    cesScrollMore,
    cesScrollLess,
    cesInvertColours,
    cesToggleBars,
    cesToggleScrollBar,
    cesToggleStatusBar,
    cesNextLink,
    cesGotoLink
};

class orKey
{
  friend bool operator<(const orKey& lhs, const orKey& rhs);
  Qt::ButtonState m_st;
  int m_ky;
  bool m_scroll;
 public:
  orKey(Qt::ButtonState _s = Qt::NoButton, int _k = 0, bool _sc = false) : m_st(_s), m_ky(_k), m_scroll(_sc) {}
  QString text() const;
  bool isScroll() const { return m_scroll; }
  void toggleScroll() { m_scroll = !m_scroll; }
};

inline bool operator<(const orKey& lhs, const orKey& rhs)
{
  if (lhs.m_ky < rhs.m_ky)
    {
      return true;
    }
  if (lhs.m_ky > rhs.m_ky)
    {
      return false;
    }
  if (lhs.m_st < rhs.m_st)
    {
      return true;
    }
  if (lhs.m_st > rhs.m_st)
    {
      return false;
    }
  return (lhs.m_scroll < rhs.m_scroll);
}
#endif