Changeset View
Changeset View
Standalone View
Standalone View
ui/pageviewutils.h
Show All 11 Lines | |||||
12 | 12 | | |||
13 | #ifndef _PAGEVIEW_UTILS_H_ | 13 | #ifndef _PAGEVIEW_UTILS_H_ | ||
14 | #define _PAGEVIEW_UTILS_H_ | 14 | #define _PAGEVIEW_UTILS_H_ | ||
15 | 15 | | |||
16 | #include <qwidget.h> | 16 | #include <qwidget.h> | ||
17 | #include <qpixmap.h> | 17 | #include <qpixmap.h> | ||
18 | #include <qrect.h> | 18 | #include <qrect.h> | ||
19 | #include <qhash.h> | 19 | #include <qhash.h> | ||
20 | #include <qtoolbutton.h> | | |||
21 | | ||||
22 | 20 | | |||
23 | #include "core/area.h" | 21 | #include "core/area.h" | ||
24 | 22 | | |||
23 | class KActionCollection; | ||||
25 | class QAction; | 24 | class QAction; | ||
26 | class QLabel; | 25 | class QLabel; | ||
26 | class QMenu; | ||||
27 | class QTimer; | 27 | class QTimer; | ||
28 | class FormWidgetIface; | 28 | class FormWidgetIface; | ||
29 | class PageView; | 29 | class PageView; | ||
30 | class VideoWidget; | 30 | class VideoWidget; | ||
31 | 31 | | |||
32 | namespace Okular { | 32 | namespace Okular { | ||
33 | class Movie; | 33 | class Movie; | ||
34 | class Page; | 34 | class Page; | ||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 134 | { | |||
139 | 139 | | |||
140 | int id; | 140 | int id; | ||
141 | QString text; | 141 | QString text; | ||
142 | QPixmap pixmap; | 142 | QPixmap pixmap; | ||
143 | QString shortcut; | 143 | QString shortcut; | ||
144 | bool isText; | 144 | bool isText; | ||
145 | }; | 145 | }; | ||
146 | 146 | | |||
147 | class ToolBarButton : public QToolButton | | |||
148 | { | | |||
149 | Q_OBJECT | | |||
150 | public: | | |||
151 | static const int iconSize = 32; | | |||
152 | static const int buttonSize = 40; | | |||
153 | | ||||
154 | ToolBarButton( QWidget * parent, const AnnotationToolItem &item ); | | |||
155 | int buttonID() const { return m_id; } | | |||
156 | bool isText() const { return m_isText; } | | |||
157 | | ||||
158 | Q_SIGNALS: | | |||
159 | void buttonDoubleClicked( int buttonID ); | | |||
160 | | ||||
161 | protected: | | |||
162 | void mouseDoubleClickEvent( QMouseEvent * event ) override; | | |||
163 | | ||||
164 | private: | | |||
165 | int m_id; | | |||
166 | bool m_isText; | | |||
167 | }; | | |||
168 | | ||||
169 | /** | | |||
170 | * @short A widget containing exclusive buttons, that slides in from a side. | | |||
171 | * | | |||
172 | * This is a shaped widget that slides in from a side of the 'anchor widget' | | |||
173 | * it's attached to. It can be dragged and docked on {left,top,right,bottom} | | |||
174 | * sides and contains toggable exclusive buttons. | | |||
175 | * When a 'tool' of this 'toolBar' is selected, a signal is emitted. | | |||
176 | */ | | |||
177 | class PageViewToolBar : public QWidget | | |||
178 | { | | |||
179 | Q_OBJECT | | |||
180 | public: | | |||
181 | PageViewToolBar( PageView * parent, QWidget * anchorWidget ); | | |||
182 | ~PageViewToolBar(); | | |||
183 | | ||||
184 | // animated widget controls | | |||
185 | enum Side { Left = 0, Top = 1, Right = 2, Bottom = 3 }; | | |||
186 | | ||||
187 | void setItems( const QLinkedList<AnnotationToolItem> &items ); | | |||
188 | void setSide( Side side ); | | |||
189 | | ||||
190 | void showAndAnimate(); | | |||
191 | void hideAndDestroy(); | | |||
192 | | ||||
193 | void selectButton( int id ); | | |||
194 | | ||||
195 | void setToolsEnabled( bool on ); | | |||
196 | void setTextToolsEnabled( bool on ); | | |||
197 | | ||||
198 | // query properties | | |||
199 | | ||||
200 | Q_SIGNALS: | | |||
201 | // the tool 'toolID' has been selected | | |||
202 | void toolSelected( int toolID ); | | |||
203 | // orientation has been changed | | |||
204 | void orientationChanged( int side ); | | |||
205 | // a tool button of this toolbar has been double clicked | | |||
206 | void buttonDoubleClicked( int buttonID ); | | |||
207 | | ||||
208 | protected: | | |||
209 | // handle widget events { anchor_resize, paint, animation, drag } | | |||
210 | bool eventFilter( QObject * o, QEvent * e ) override; | | |||
211 | void paintEvent( QPaintEvent * ) override; | | |||
212 | void mousePressEvent( QMouseEvent * e ) override; | | |||
213 | void mouseMoveEvent( QMouseEvent * e ) override; | | |||
214 | void mouseReleaseEvent( QMouseEvent * e ) override; | | |||
215 | | ||||
216 | private: | | |||
217 | // private variables | | |||
218 | friend class ToolBarPrivate; | | |||
219 | class ToolBarPrivate * d; | | |||
220 | | ||||
221 | private Q_SLOTS: | | |||
222 | void slotAnimate(); | | |||
223 | void slotButtonClicked(); | | |||
224 | }; | | |||
225 | | ||||
226 | #endif | 147 | #endif |