kviewshell
history.h
Go to the documentation of this file.00001 // -*- C++ -*- 00002 #ifndef history_h 00003 #define history_h 00004 00005 // history.h 00006 // 00007 // (C) 2001 Stefan Kebekus 00008 // Distributed under the GPL 00009 00010 #include <qobject.h> 00011 #include <qvaluelist.h> 00012 00013 #define HISTORYLENGTH 10 00014 00015 class HistoryItem 00016 { 00017 public: 00018 HistoryItem(Q_UINT32, Q_UINT32); 00019 HistoryItem() {} 00020 00021 bool operator== (const HistoryItem& item) const; 00022 00023 Q_UINT32 page; 00024 Q_UINT32 ypos; 00025 }; 00026 00027 inline 00028 bool operator!=(const HistoryItem& lhs, const HistoryItem& rhs) 00029 { 00030 return !(lhs == rhs); 00031 } 00032 00033 00034 class History : public QObject 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 History(); 00040 00041 void add(Q_UINT32 page, Q_UINT32 ypos); 00042 void clear(); 00043 00044 HistoryItem* forward(); 00045 HistoryItem* back(); 00046 00047 signals: 00048 void backItem(bool); 00049 void forwardItem(bool); 00050 00051 private: 00052 // List of history items. First item is the oldest. 00053 QValueList<HistoryItem> historyList; 00054 00055 QValueList<HistoryItem>::iterator currentItem; 00056 }; 00057 00058 #endif