ibus-qt  1.3.1
/builddir/build/BUILD/ibus-qt-1.3.1-Source/src/qibusattribute.h
00001 #ifndef __Q_IBUS_ATTRIBUTE_H_
00002 #define __Q_IBUS_ATTRIBUTE_H_
00003 
00004 #include "qibusserializable.h"
00005 
00006 namespace IBus {
00007 
00008 class Attribute;
00009 typedef Pointer<Attribute> AttributePointer;
00010 
00011 
00012 class Attribute : public Serializable
00013 {
00014     Q_OBJECT
00015 
00016 public:
00017     /*
00018      * Type enumeration of IBusText attribute.
00019      */
00020     typedef enum {
00021         TypeUnderline  = 1,
00022         TypeForeground = 2,
00023         TypeBackground = 3,
00024     } Type;
00025     
00026     /*
00027      * Type of IBusText attribute.
00028      */
00029     typedef enum {
00030         UnderlineNone   = 0,
00031         UnderlineSingle = 1,
00032         UnderlineDouble = 2,
00033         UnderlineLow    = 3,
00034         UnderlineError  = 4,
00035     } Underline;
00036 
00037 public:
00038     Attribute (uint type = 0, uint value = 0, uint start = 0, uint end = 0) :
00039     m_type (type), m_value (value),m_start (start), m_end (end) {}
00040 
00041 public:
00042     virtual bool serialize (QDBusArgument &argument);
00043     virtual bool deserialize (const QDBusArgument &argument);
00044 
00045     uint type (void) const { return m_type; }
00046     uint value (void) const { return m_value; }
00047     uint start (void) const { return m_start; }
00048     uint end (void) const { return m_end; }
00049     uint length (void) const { return (m_end - m_start); }
00050 
00051 protected:
00052     uint    m_type;
00053     uint    m_value;
00054     uint    m_start;
00055     uint    m_end;
00056 
00057     IBUS_SERIALIZABLE
00058 };
00059 
00060 class AttributeUnderline : public Attribute
00061 {
00062 public:
00063     AttributeUnderline (uint underlineType = 0, uint start = 0, uint end = 0)
00064         : Attribute (TypeUnderline, underlineType, start, end) {}
00065 };
00066 
00067 class AttributeForeground: public Attribute
00068 {
00069 public:
00070     AttributeForeground (uint color = 0, uint start = 0, uint end = 0)
00071         : Attribute (TypeForeground, color, start, end) {}
00072 };
00073 
00074 class AttributeBackground: public Attribute
00075 {
00076 public:
00077     AttributeBackground (uint color = 0, uint start = 0, uint end = 0)
00078         : Attribute (TypeBackground, color, start, end) {}
00079 };
00080 
00081 };
00082 
00083 #endif
 All Classes Namespaces Functions Enumerations Enumerator