3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Minitube. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef SEGMENTEDCONTROL_H
22 #define SEGMENTEDCONTROL_H
26 class SegmentedControl : public QWidget {
31 SegmentedControl(QWidget *parent = 0);
33 QAction *addAction(QAction *action);
34 bool setCheckedAction(int index);
35 bool setCheckedAction(QAction *action);
36 QSize minimumSizeHint(void) const;
39 void checkedActionChanged(QAction & action);
42 void paintEvent(QPaintEvent *event);
43 void mouseMoveEvent(QMouseEvent *event);
44 void mousePressEvent(QMouseEvent *event);
45 void mouseReleaseEvent(QMouseEvent *event);
46 void leaveEvent(QEvent *event);
49 void drawButton(QPainter *painter,
51 const QAction *action);
52 void drawUnselectedButton(QPainter *painter,
54 const QAction *action);
55 void drawSelectedButton(QPainter *painter,
57 const QAction *action);
58 void paintButton(QPainter *painter,
60 const QAction *action);
61 QAction *hoveredAction(const QPoint& pos) const;
62 int calculateButtonWidth(void) const;
69 #endif /* !SEGMENTEDCONTROL_H */