00001 #ifndef __Q_IBUS_LOOKUP_TABLE_H_ 00002 #define __Q_IBUS_LOOKUP_TABLE_H_ 00003 00004 #include "qibusserializable.h" 00005 #include "qibustext.h" 00006 #include "qibustypes.h" 00007 00008 namespace IBus { 00009 00010 class LookupTable; 00011 typedef Pointer<LookupTable> LookupTablePointer; 00012 00013 class LookupTable: public Serializable 00014 { 00015 Q_OBJECT; 00016 00017 public: 00018 LookupTable (uint pageSize = 5, 00019 uint cursorPos = 0, 00020 bool cursorVisible = true, 00021 bool round = true, 00022 int orientation = OrientationSystem 00023 ): 00024 m_pageSize (pageSize), 00025 m_cursorPos (cursorPos), 00026 m_cursorVisible (cursorVisible), 00027 m_round (round), 00028 m_orientation (orientation) {} 00029 00030 ~LookupTable() {} 00031 00032 public: 00033 virtual bool serialize (QDBusArgument & argument); 00034 virtual bool deserialize (const QDBusArgument & argument); 00035 void appendCandidate (const TextPointer & e); 00036 void appendLabel (const TextPointer & e); 00037 00038 TextPointer candidate (uint index) const; 00039 TextPointer label (const uint index) const; 00040 const QVector<TextPointer> & candidates () const { return m_candidates; } 00041 const QVector<TextPointer> & labels () const { return m_labels; } 00042 uint cursorPos () const { return m_cursorPos; } 00043 uint pageSize () const {return m_pageSize; } 00044 bool isCursorVisible () const { return m_cursorVisible; } 00045 bool isRound () const { return m_round; } 00046 int orientation () const { return m_orientation; } 00047 00048 void setCursorPos (const uint cursorPos); 00049 void setCursorVisible (bool visible); 00050 void setPageSize (uint pageSize); 00051 void setOrientation (int orientation); 00052 uint cursorPosInPage () const; 00053 void clean (void); 00054 00055 bool pageUp(); 00056 bool pageDown(); 00057 bool cursorUp(); 00058 bool cursorDown(); 00059 00060 private: 00061 uint m_pageSize; 00062 uint m_cursorPos; 00063 bool m_cursorVisible; 00064 bool m_round; 00065 int m_orientation; 00066 00067 QVector<TextPointer> m_candidates; 00068 QVector<TextPointer> m_labels; 00069 00070 IBUS_SERIALIZABLE 00071 }; 00072 00073 }; 00074 00075 #endif