kviewshell
tableOfContents.h
Go to the documentation of this file.00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * Copyright (C) 2005 by Wilfried Huss * 00004 * Wilfried.Huss@gmx.at * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * This program is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this program; if not, write to the * 00018 * Free Software Foundation, Inc., * 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00020 ***************************************************************************/ 00021 00022 #ifndef TABLEOFCONTENTS_H 00023 #define TABLEOFCONTENTS_H 00024 00025 #include "anchor.h" 00026 00027 #include <klistview.h> 00028 00029 class Bookmark; 00030 00031 00032 class TocItem : public KListViewItem 00033 { 00034 public: 00035 TocItem(TocItem* parent); 00036 TocItem(QListView* parent); 00037 00038 void setAnchor(const Anchor & _anchor) { anchor = _anchor; } 00039 Anchor getAnchor() { return anchor; } 00040 00041 private: 00042 Anchor anchor; 00043 }; 00044 00045 00046 class TableOfContents : public KListView 00047 { 00048 Q_OBJECT 00049 00050 public: 00051 TableOfContents(QWidget* parent); 00052 virtual ~TableOfContents(); 00053 00054 void setContents(const QPtrList<Bookmark>& bookmarks); 00055 00056 void writeSettings(); 00057 void readSettings(); 00058 00059 signals: 00060 void gotoPage(const Anchor&); 00061 00062 private: 00063 void addItems(const QPtrList<Bookmark>& bookmarks, TocItem* parent = 0); 00064 00065 private slots: 00066 void itemClicked(QListViewItem*); 00067 }; 00068 00069 #endif