Debian Codegraph @

src/qdjviewsidebar.h

raw
1 //C- -*- C++ -*-
2 //C- -------------------------------------------------------------------
3 //C- DjView4
4 //C- Copyright (c) 2006- Leon Bottou
5 //C-
6 //C- This software is subject to, and may be distributed under, the
7 //C- GNU General Public License, either version 2 of the license,
8 //C- or (at your option) any later version. The license should have
9 //C- accompanied the software or you may obtain a copy of the license
10 //C- from the Free Software Foundation at http://www.fsf.org .
11 //C-
12 //C- This program is distributed in the hope that it will be useful,
13 //C- but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 //C- GNU General Public License for more details.
16 //C- ------------------------------------------------------------------
17
18 #ifndef QDJVIEWSIDEBAR_H
19 #define QDJVIEWSIDEBAR_H
20
21 #if AUTOCONF
22 # include "config.h"
23 #endif
24
25 #include <Qt>
26 #include <QObject>
27 #include <QModelIndex>
28 #include <QString>
29 #include <QUrl>
30 #include <QWidget>
31
32 #include <libdjvu/miniexp.h>
33 #include <libdjvu/ddjvuapi.h>
34
35 #include "qdjvu.h"
36 #include "qdjvuwidget.h"
37 #include "qdjview.h"
38
39 class QAction;
40 class QComboBox;
41 class QContextMenuEvent;
42 class QItemSelectionModel;
43 class QLabel;
44 class QLineEdit;
45 class QListView;
46 class QMenu;
47 class QPushButton;
48 class QStackedLayout;
49 class QToolButton;
50 class QTreeWidget;
51 class QTreeWidgetItem;
52
53 // ----------------------------------------
54 // OUTLINE
55
56
57 class QDjViewOutline : public QWidget
58 {
59 Q_OBJECT
60 public:
61 QDjViewOutline(QDjView *djview);
62 public slots:
63 void clear();
64 void refresh();
65 protected slots:
66 void pageChanged(int pageno);
67 void itemActivated(QTreeWidgetItem *item);
68 private:
69 QDjView *djview;
70 QTreeWidget *tree;
71 bool loaded;
72 int pageNumber(const char *link);
73 void fillItems(QTreeWidgetItem *item, miniexp_t expr);
74 void searchItem(QTreeWidgetItem *item, int pageno,
75 QTreeWidgetItem *&fi, int &fp);
76 };
77
78
79
80 // ----------------------------------------
81 // THUMBNAILS
82
83
84 class QDjViewThumbnails : public QWidget
85 {
86 Q_OBJECT
87 Q_PROPERTY(int size READ size WRITE setSize)
88 Q_PROPERTY(bool smart READ smart WRITE setSmart)
89 public:
90 QDjViewThumbnails(QDjView *djview);
91 int size();
92 bool smart();
93 public slots:
94 void setSize(int);
95 void setSmart(bool);
96 protected slots:
97 void setSize();
98 void pageChanged(int pageno);
99 void activated(const QModelIndex &index);
100 protected:
101 void contextMenuEvent(QContextMenuEvent *event);
102 void updateActions();
103 private:
104 class Model;
105 class View;
106 QDjView *djview;
107 Model *model;
108 View *view;
109 QItemSelectionModel *selection;
110 QMenu *menu;
111 };
112
113
114
115
116 // ----------------------------------------
117 // THUMBNAILS
118
119
120 class QDjViewFind : public QWidget
121 {
122 Q_OBJECT
123 Q_PROPERTY(QString text READ text WRITE setText)
124 Q_PROPERTY(bool caseSensitive READ caseSensitive WRITE setCaseSensitive)
125 Q_PROPERTY(bool wordOnly READ wordOnly WRITE setWordOnly)
126 public:
127 QDjViewFind(QDjView *djview);
128 void takeFocus(Qt::FocusReason);
129 QString text();
130 bool caseSensitive();
131 bool wordOnly();
132 bool regExpMode();
133 public slots:
134 void selectAll();
135 void eraseText();
136 void setText(QString s);
137 void setCaseSensitive(bool);
138 void setWordOnly(bool);
139 void setRegExpMode(bool);
140 void findNext();
141 void findPrev();
142 void findAgain();
143 protected slots:
144 void pageChanged(int);
145 protected:
146 void contextMenuEvent(QContextMenuEvent *event);
147 private:
148 class Model;
149 QDjView *djview;
150 Model *model;
151 QListView *view;
152 QMenu *menu;
153 QComboBox *combo;
154 QToolButton *upButton;
155 QToolButton *downButton;
156 QToolButton *resetButton;
157 QStackedLayout *stack;
158 QLabel *label;
159 QAction *caseSensitiveAction;
160 QAction *wordOnlyAction;
161 QAction *regExpModeAction;
162 };
163
164
165
166 #endif
167 /* -------------------------------------------------------------
168 Local Variables:
169 c++-font-lock-extra-types: ( "\\sw+_t" "[A-Z]\\sw*[a-z]\\sw*" )
170 End:
171 ------------------------------------------------------------- */