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>
35 This class provides a QLineEdit which contains a greyed-out hinting
36 text as long as the user didn't enter any text
38 @short LineEdit with customizable "Click here" text
39 @author Daniel Molkentin
41 class ClickLineEdit : public QLineEdit
44 Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
46 ClickLineEdit( const QString &msg, QWidget *parent );
47 virtual ~ClickLineEdit() {};
48 void setClickMessage( const QString &msg );
49 QString clickMessage() const { return mClickMessage; }
50 virtual void setText( const QString& txt );
52 virtual void paintEvent( QPaintEvent *e );
53 virtual void dropEvent( QDropEvent *ev );
54 virtual void focusInEvent( QFocusEvent *ev );
55 virtual void focusOutEvent( QFocusEvent *ev );
57 QString mClickMessage;
61 class QVLCFramelessButton : public QPushButton
65 QVLCFramelessButton( QWidget *parent = NULL );
66 QSize sizeHint() const;
68 virtual void paintEvent( QPaintEvent * event );
71 class SearchLineEdit : public QLineEdit
75 SearchLineEdit( QWidget *parent = NULL );
78 void resizeEvent ( QResizeEvent * event );
79 void focusInEvent( QFocusEvent *event );
80 void focusOutEvent( QFocusEvent *event );
81 void paintEvent( QPaintEvent *event );
82 void setMessageVisible( bool on );
83 QVLCFramelessButton *clearButton;
91 void updateText( const QString& );
94 class QVLCElidingLabel : public QLabel
97 QVLCElidingLabel( const QString &s = QString(),
98 Qt::TextElideMode mode = Qt::ElideRight,
99 QWidget * parent = NULL );
100 void setElideMode( Qt::TextElideMode );
102 void paintEvent( QPaintEvent * event );
103 Qt::TextElideMode elideMode;
106 /* VLC Key/Wheel hotkeys interactions */
112 int qtKeyModifiersToVLC( QInputEvent* e );
113 int qtEventToVLCKey( QKeyEvent *e );
114 int qtWheelEventToVLCKey( QWheelEvent *e );
115 QString VLCKeyToString( int val );