customwidgets.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * customwidgets.h: Custom widgets
00003  ****************************************************************************
00004  * Copyright (C) 2006 the VideoLAN team
00005  * Copyright (C) 2004 Daniel Molkentin <molkentin@kde.org>
00006  * $Id: 13e685f22063e95ba416a84490972f2d2597d7cf $
00007  *
00008  * Authors: Clément Stenac <zorglub@videolan.org>
00009  * The "ClickLineEdit" control is based on code by  Daniel Molkentin
00010  * <molkentin@kde.org> for libkdepim
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00025  *****************************************************************************/
00026 
00027 #ifndef _CUSTOMWIDGETS_H_
00028 #define _CUSTOMWIDGETS_H_
00029 
00030 #include <QLineEdit>
00031 #include <QPushButton>
00032 #include <QLabel>
00033 #include <QStackedWidget>
00034 
00035 /**
00036   This class provides a QLineEdit which contains a greyed-out hinting
00037   text as long as the user didn't enter any text
00038 
00039   @short LineEdit with customizable "Click here" text
00040   @author Daniel Molkentin
00041 */
00042 class ClickLineEdit : public QLineEdit
00043 {
00044     Q_OBJECT
00045     Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
00046 public:
00047     ClickLineEdit( const QString &msg, QWidget *parent );
00048     virtual ~ClickLineEdit() {};
00049     void setClickMessage( const QString &msg );
00050     QString clickMessage() const { return mClickMessage; }
00051     virtual void setText( const QString& txt );
00052 protected:
00053     virtual void paintEvent( QPaintEvent *e );
00054     virtual void dropEvent( QDropEvent *ev );
00055     virtual void focusInEvent( QFocusEvent *ev );
00056     virtual void focusOutEvent( QFocusEvent *ev );
00057 private:
00058     QString mClickMessage;
00059     bool mDrawClickMsg;
00060 };
00061 
00062 class QVLCFramelessButton : public QPushButton
00063 {
00064     Q_OBJECT
00065 public:
00066     QVLCFramelessButton( QWidget *parent = NULL );
00067     QSize sizeHint() const;
00068 protected:
00069     virtual void paintEvent( QPaintEvent * event );
00070 };
00071 
00072 class SearchLineEdit : public QLineEdit
00073 {
00074     Q_OBJECT
00075 public:
00076     SearchLineEdit( QWidget *parent = NULL );
00077 
00078 private:
00079     void resizeEvent ( QResizeEvent * event );
00080     void focusInEvent( QFocusEvent *event );
00081     void focusOutEvent( QFocusEvent *event );
00082     void paintEvent( QPaintEvent *event );
00083     void setMessageVisible( bool on );
00084     QVLCFramelessButton   *clearButton;
00085     bool message;
00086     QLabel *msg;
00087 
00088 public slots:
00089     void clear();
00090 
00091 private slots:
00092     void updateText( const QString& );
00093 };
00094 
00095 class QVLCElidingLabel : public QLabel
00096 {
00097 public:
00098     QVLCElidingLabel( const QString &s = QString(),
00099                       Qt::TextElideMode mode = Qt::ElideRight,
00100                       QWidget * parent = NULL );
00101     void setElideMode( Qt::TextElideMode );
00102 private:
00103     void paintEvent( QPaintEvent * event );
00104     Qt::TextElideMode elideMode;
00105 };
00106 
00107 class QVLCStackedWidget : public QStackedWidget
00108 {
00109 public:
00110     QVLCStackedWidget( QWidget *parent ) : QStackedWidget( parent ) { }
00111     QSize minimumSizeHint () const
00112     {
00113         return currentWidget() ? currentWidget()->minimumSizeHint() : QSize();
00114     }
00115 };
00116 
00117 /* VLC Key/Wheel hotkeys interactions */
00118 
00119 class QKeyEvent;
00120 class QWheelEvent;
00121 class QInputEvent;
00122 
00123 int qtKeyModifiersToVLC( QInputEvent* e );
00124 int qtEventToVLCKey( QKeyEvent *e );
00125 int qtWheelEventToVLCKey( QWheelEvent *e );
00126 QString VLCKeyToString( int val );
00127 
00128 #endif
00129 

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6