ibus-qt  1.3.3
qibusattribute.h
1 #ifndef __Q_IBUS_ATTRIBUTE_H_
2 #define __Q_IBUS_ATTRIBUTE_H_
3 
4 #include "qibusserializable.h"
5 
6 namespace IBus {
7 
8 class Attribute;
9 typedef Pointer<Attribute> AttributePointer;
10 
11 
12 class Attribute : public Serializable
13 {
14  Q_OBJECT
15 
16 public:
17  /*
18  * Type enumeration of IBusText attribute.
19  */
20  typedef enum {
21  TypeUnderline = 1,
22  TypeForeground = 2,
23  TypeBackground = 3,
24  } Type;
25 
26  /*
27  * Type of IBusText attribute.
28  */
29  typedef enum {
30  UnderlineNone = 0,
31  UnderlineSingle = 1,
32  UnderlineDouble = 2,
33  UnderlineLow = 3,
34  UnderlineError = 4,
35  } Underline;
36 
37 public:
38  Attribute (uint type = 0, uint value = 0, uint start = 0, uint end = 0) :
39  m_type (type), m_value (value),m_start (start), m_end (end) {}
40 
41 public:
42  virtual bool serialize (QDBusArgument &argument);
43  virtual bool deserialize (const QDBusArgument &argument);
44 
45  uint type (void) const { return m_type; }
46  uint value (void) const { return m_value; }
47  uint start (void) const { return m_start; }
48  uint end (void) const { return m_end; }
49  uint length (void) const { return (m_end - m_start); }
50 
51 protected:
52  uint m_type;
53  uint m_value;
54  uint m_start;
55  uint m_end;
56 
57  IBUS_SERIALIZABLE
58 };
59 
61 {
62 public:
63  AttributeUnderline (uint underlineType = 0, uint start = 0, uint end = 0)
64  : Attribute (TypeUnderline, underlineType, start, end) {}
65 };
66 
68 {
69 public:
70  AttributeForeground (uint color = 0, uint start = 0, uint end = 0)
71  : Attribute (TypeForeground, color, start, end) {}
72 };
73 
75 {
76 public:
77  AttributeBackground (uint color = 0, uint start = 0, uint end = 0)
78  : Attribute (TypeBackground, color, start, end) {}
79 };
80 
81 };
82 
83 #endif
Definition: qibusattribute.h:60
Definition: qibusattribute.h:74
Definition: qibusattribute.h:12
Definition: qibusattribute.cpp:3
Definition: qibusattribute.h:67
Definition: qibusserializable.h:40