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