ibus-qt 1.3.4
Loading...
Searching...
No Matches
qibusattribute.h
1#ifndef __Q_IBUS_ATTRIBUTE_H_
2#define __Q_IBUS_ATTRIBUTE_H_
3
4#include "qibusserializable.h"
5
6namespace IBus {
7
8class Attribute;
9typedef Pointer<Attribute> AttributePointer;
10
11
12class Attribute : public Serializable
13{
14 Q_OBJECT
15
16public:
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
37public:
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
41public:
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
51protected:
52 uint m_type;
53 uint m_value;
54 uint m_start;
55 uint m_end;
56
57 IBUS_SERIALIZABLE
58};
59
61{
62public:
63 AttributeUnderline (uint underlineType = 0, uint start = 0, uint end = 0)
64 : Attribute (TypeUnderline, underlineType, start, end) {}
65};
66
68{
69public:
70 AttributeForeground (uint color = 0, uint start = 0, uint end = 0)
71 : Attribute (TypeForeground, color, start, end) {}
72};
73
75{
76public:
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:75
Definition qibusattribute.h:68
Definition qibusattribute.h:13
Definition qibusattribute.h:61
Definition qibusserializable.h:41
Definition qibusattribute.cpp:3