• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

marklist.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* This file is part of the KDE project
00003    Copyright (C) 2004 Wilfried Huss <Wilfried.Huss@gmx.at>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef MARKLIST_H
00022 #define MARKLIST_H
00023 
00024 #include "pageNumber.h"
00025 
00026 #include <qpixmap.h>
00027 #include <qptrvector.h>
00028 #include <qscrollview.h>
00029 
00030 class QCheckBox;
00031 class QLabel;
00032 class KPopupMenu;
00033 
00034 class DocumentPageCache;
00035 
00036 class MarkList;
00037 class MarkListWidget;
00038 
00039 
00040 /****** ThumbnailWidget ******/
00041 
00042 
00043 class ThumbnailWidget : public QWidget
00044 {
00045   Q_OBJECT
00046 
00047 public:
00048   ThumbnailWidget(MarkListWidget* parent_, const PageNumber& _pageNumber, DocumentPageCache*);
00049 
00050 private:
00051   virtual void paintEvent(QPaintEvent*);
00052   virtual void resizeEvent(QResizeEvent*);
00053 
00054 private slots:
00055   void setThumbnail();
00056 
00057 private:
00058   PageNumber pageNumber;
00059 
00060   bool needsUpdating;
00061 
00062   DocumentPageCache* pageCache;
00063 
00064   MarkListWidget* parent;
00065 
00066   QPixmap thumbnail;
00067 };
00068 
00069 
00070 /****** MarkListWidget ******/
00071 
00072 
00073 class MarkListWidget : public QWidget
00074 {
00075   Q_OBJECT
00076 
00077 public:
00078   MarkListWidget(QWidget* _parent, MarkList*, const PageNumber& _pageNumber, DocumentPageCache*, bool _showThumbnail = true);
00079 
00080   bool isChecked() const;
00081 
00082   bool isVisible();
00083 
00084 public slots:
00085   void toggle();
00086   void setChecked( bool checked );
00087 
00088   void setSelected( bool selected );
00089 
00090   int setNewWidth(int width);
00091 
00092 signals:
00094   void selected(const PageNumber&);
00095 
00097   void showPopupMenu(const PageNumber& pageNumber, const QPoint& position);
00098 
00099 protected:
00100   virtual void mousePressEvent(QMouseEvent*);
00101 
00102 private:
00103 
00104   bool showThumbnail;
00105 
00106   ThumbnailWidget* thumbnailWidget;
00107   QCheckBox* checkBox;
00108   QLabel* pageLabel;
00109   QColor _backgroundColor;
00110 
00111   const PageNumber pageNumber;
00112 
00113   DocumentPageCache* pageCache;
00114 
00115   static const int margin = 5;
00116 
00117   MarkList* markList;
00118 };
00119 
00120 
00121 /****** MarkList ******/
00122 
00123 
00124 class MarkList: public QScrollView
00125 {
00126     Q_OBJECT
00127 
00128 public:
00129   MarkList(QWidget* parent = 0, const char* name = 0);
00130   virtual ~MarkList();
00131 
00132   void setPageCache(DocumentPageCache*);
00133 
00134   QValueList<int> selectedPages() const;
00135 
00136   PageNumber currentPageNumber() { return currentPage; }
00137 
00138   PageNumber numberOfPages() { return widgetList.count(); }
00139 
00140   virtual QSize sizeHint() const { return QSize(); }
00141 
00142 public slots:
00143   void setNumberOfPages(int numberOfPages, bool showThumbnails = true);
00144 
00145   void thumbnailSelected(const PageNumber& pageNumber);
00146   void setCurrentPageNumber(const PageNumber& pageNumber);
00147 
00148   void clear();
00149 
00150   void slotShowThumbnails(bool);
00151   void repaintThumbnails();
00152 
00153   void updateWidgetSize(const PageNumber&);
00154 
00155 protected:
00156   virtual void viewportResizeEvent(QResizeEvent*);
00157 
00158   virtual void mousePressEvent(QMouseEvent*);
00159 
00160 signals:
00161   void selected(const PageNumber&);
00162 
00163 private slots:
00164   void showPopupMenu(const PageNumber& pageNumber, const QPoint& position);
00165 
00166   void selectAll();
00167   void selectEven();
00168   void selectOdd();
00169   void toggleSelection();
00170   void removeSelection();
00171 
00172 private:
00173   QPtrVector<MarkListWidget> widgetList;
00174 
00175   PageNumber currentPage;
00176 
00177   PageNumber clickedThumbnail;
00178 
00179   DocumentPageCache* pageCache;
00180 
00181   bool showThumbnails;
00182 
00183   KPopupMenu* contextMenu;
00184 };
00185 
00186 #endif

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal