1 /*****************************************************************************
2 * customwidgets.h: Custom widgets
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
5 * Copyright (C) 2004 Daniel Molkentin <molkentin@kde.org>
8 * Authors: Clément Stenac <zorglub@videolan.org>
9 * The "ClickLineEdit" control is based on code by Daniel Molkentin
10 * <molkentin@kde.org> for libkdepim
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
27 #ifndef _CUSTOMWIDGETS_H_
28 #define _CUSTOMWIDGETS_H_
31 #include <QPushButton>
33 #include <QStackedWidget>
36 class QVLCFramelessButton : public QPushButton
40 QVLCFramelessButton( QWidget *parent = NULL );
41 virtual QSize sizeHint() const { return iconSize(); }
43 virtual void paintEvent( QPaintEvent * event );
47 class QVLCElidingLabel : public QLabel
50 QVLCElidingLabel( const QString &s = QString(),
51 Qt::TextElideMode mode = Qt::ElideRight,
52 QWidget * parent = NULL );
53 void setElideMode( Qt::TextElideMode );
55 virtual void paintEvent( QPaintEvent * event );
57 Qt::TextElideMode elideMode;
61 class QVLCStackedWidget : public QStackedWidget
64 QVLCStackedWidget( QWidget *parent ) : QStackedWidget( parent ) { }
65 QSize minimumSizeHint () const
67 return currentWidget() ? currentWidget()->minimumSizeHint() : QSize();
71 class DebugLevelSpinBox : public QSpinBox
75 DebugLevelSpinBox( QWidget *parent ) : QSpinBox( parent ) { };
77 virtual QString textFromValue( int ) const;
78 /* DebugLevelSpinBox is read-only */
79 virtual int valueFromText( const QString& ) const { return -1; }
82 /* VLC Key/Wheel hotkeys interactions */
88 int qtKeyModifiersToVLC( QInputEvent* e );
89 int qtEventToVLCKey( QKeyEvent *e );
90 int qtWheelEventToVLCKey( QWheelEvent *e );
91 QString VLCKeyToString( int val );