ibus-qt 1.3.0
|
00001 #ifndef __Q_IBUS_PROPERTY_H_ 00002 #define __Q_IBUS_PROPERTY_H_ 00003 00004 #include "qibusserializable.h" 00005 #include "qibusproplist.h" 00006 #include "qibustext.h" 00007 00008 namespace IBus { 00009 00010 /* type of QIBusProperty */ 00011 typedef enum 00012 { 00013 TypeNormal = 0, 00014 TypeToggle = 1, 00015 TypeRadio = 2, 00016 TypeMenu = 3, 00017 TypeSeparator = 4, 00018 }PropType; 00019 00020 /* 00021 * State of QIBusProperty. The actual effect 00022 * depends on #QIBusPropType of the QIBusProperty. 00023 */ 00024 typedef enum 00025 { 00026 StateUnchecked = 0, 00027 StateChecked = 1, 00028 StateInconsistent = 2, 00029 } PropState; 00030 00031 class Property; 00032 class PropList; 00033 typedef Pointer<PropList> PropListPointer; 00034 typedef Pointer<Property> PropertyPointer; 00035 00036 class Property : public Serializable 00037 { 00038 Q_OBJECT; 00039 00040 00041 public: 00042 Property () {} 00043 Property (const QString key, 00044 const QString icon, 00045 const TextPointer &label, 00046 const TextPointer &tooltip, 00047 bool sensitive, 00048 bool visible, 00049 uint type, 00050 uint state, 00051 const PropListPointer &subProps): 00052 m_key(key), 00053 m_icon(icon), 00054 m_label(label), 00055 m_tooltip(tooltip), 00056 m_sensitive(sensitive), 00057 m_visible(visible), 00058 m_type(type), 00059 m_state(state), 00060 m_subProps(subProps) {} 00061 00062 ~Property () {} 00063 00064 public: 00065 virtual bool serialize (QDBusArgument &argument); 00066 virtual bool deserialize (const QDBusArgument &argument); 00067 00068 public: 00069 void setLabel (const TextPointer & lable); 00070 void setVisible (bool visible); 00071 void setSubProps (const PropListPointer & props); 00072 bool update (const PropertyPointer prop); 00073 00074 private: 00075 00076 QString m_key; 00077 QString m_icon; 00078 TextPointer m_label; 00079 TextPointer m_tooltip; 00080 bool m_sensitive; 00081 bool m_visible; 00082 uint m_type; 00083 uint m_state; 00084 PropListPointer m_subProps; 00085 00086 IBUS_SERIALIZABLE 00087 }; 00088 00089 }; 00090 #endif