SVN_SILENT
[kdenetwork.git] / krdc / floatingtoolbar.h
blob547b140c42a6c6d3a2d23c09b34cf9fa2e226524
1 /****************************************************************************
2 **
3 ** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
4 ** Parts of this file have been take from okular:
5 ** Copyright (C) 2004-2005 Enrico Ros <eros.kde@email.it>
6 **
7 ** This file is part of KDE.
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
19 ** You should have received a copy of the GNU General Public License
20 ** along with this program; see the file COPYING. If not, write to
21 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ** Boston, MA 02110-1301, USA.
24 ****************************************************************************/
26 #ifndef FLOATINGTOOLBAR
27 #define FLOATINGTOOLBAR
29 #include <QWidget>
31 /**
32 * @short A widget containing buttons, that slides in from a side.
34 * This is a shaped widget that slides in from a side of the 'anchor widget'
35 * it's attached to. It can be dragged and docked on {left,top,right,bottom}
36 * sides and contains buttons.
38 class FloatingToolBar : public QWidget
40 Q_OBJECT
41 public:
42 FloatingToolBar(QWidget *parent, QWidget *anchorWidget);
43 ~FloatingToolBar();
45 Q_ENUMS(Side)
46 enum Side { Left = 0, Top = 1, Right = 2, Bottom = 3 };
48 void addAction(QAction *action);
49 void setSide(Side side);
51 void showAndAnimate();
52 void hideAndDestroy();
54 signals:
55 void orientationChanged(int side);
57 public slots:
58 void setSticky(bool sticky);
60 protected:
61 bool eventFilter(QObject *o, QEvent *e);
62 void paintEvent(QPaintEvent *);
63 void mousePressEvent(QMouseEvent *e);
64 void mouseMoveEvent(QMouseEvent *e);
65 void mouseReleaseEvent(QMouseEvent *e);
66 void wheelEvent(QWheelEvent *e);
68 private:
69 class FloatingToolBarPrivate *d;
71 private slots:
72 void slotAnimate();
73 void hide();
76 #endif