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 This class provides a QLineEdit which contains a greyed-out hinting
37 text as long as the user didn't enter any text
39 @short LineEdit with customizable "Click here" text
40 @author Daniel Molkentin
42 class ClickLineEdit : public QLineEdit
45 Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
47 ClickLineEdit( const QString &msg, QWidget *parent );
48 virtual ~ClickLineEdit() {};
49 void setClickMessage( const QString &msg );
50 QString clickMessage() const { return mClickMessage; }
51 virtual void setText( const QString& txt );
53 virtual void paintEvent( QPaintEvent *e );
54 virtual void dropEvent( QDropEvent *ev );
55 virtual void focusInEvent( QFocusEvent *ev );
56 virtual void focusOutEvent( QFocusEvent *ev );
58 QString mClickMessage;
62 class QVLCFramelessButton : public QPushButton
66 QVLCFramelessButton( QWidget *parent = NULL );
67 QSize sizeHint() const;
69 virtual void paintEvent( QPaintEvent * event );
72 class SearchLineEdit : public QLineEdit
76 SearchLineEdit( QWidget *parent = NULL );
79 void resizeEvent ( QResizeEvent * event );
80 void focusInEvent( QFocusEvent *event );
81 void focusOutEvent( QFocusEvent *event );
82 void paintEvent( QPaintEvent *event );
83 void setMessageVisible( bool on );
84 QVLCFramelessButton *clearButton;
92 void updateText( const QString& );
95 class QVLCElidingLabel : public QLabel
98 QVLCElidingLabel( const QString &s = QString(),
99 Qt::TextElideMode mode = Qt::ElideRight,
100 QWidget * parent = NULL );
101 void setElideMode( Qt::TextElideMode );
103 void paintEvent( QPaintEvent * event );
104 Qt::TextElideMode elideMode;
107 class QVLCStackedWidget : public QStackedWidget
110 QVLCStackedWidget( QWidget *parent ) : QStackedWidget( parent ) { }
111 QSize minimumSizeHint () const
113 return currentWidget() ? currentWidget()->minimumSizeHint() : QSize();
117 /* VLC Key/Wheel hotkeys interactions */
123 int qtKeyModifiersToVLC( QInputEvent* e );
124 int qtEventToVLCKey( QKeyEvent *e );
125 int qtWheelEventToVLCKey( QWheelEvent *e );
126 QString VLCKeyToString( int val );