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