]> git.sesse.net Git - vlc/blob - modules/gui/qt4/util/customwidgets.hpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / qt4 / util / customwidgets.hpp
1 /*****************************************************************************
2  * customwidgets.h: Custom widgets
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * Copyright (C) 2004 Daniel Molkentin <molkentin@kde.org>
6  * $Id: qvlcframe.hpp 16283 2006-08-17 18:16:09Z zorglub $
7  *
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
11  *
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.
16  *
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.
21  *
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  *****************************************************************************/
26
27 #ifndef _CUSTOMWIDGETS_H_
28 #define _CUSTOMWIDGETS_H_
29
30 #include <QLineEdit>
31
32 /**
33   This class provides a QLineEdit which contains a greyed-out hinting
34   text as long as the user didn't enter any text
35
36   @short LineEdit with customizable "Click here" text
37   @author Daniel Molkentin
38 */
39 class ClickLineEdit : public QLineEdit
40 {
41     Q_OBJECT
42     Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
43 public:
44     ClickLineEdit( const QString &msg, QWidget *parent );
45     virtual ~ClickLineEdit() {};
46     void setClickMessage( const QString &msg );
47     QString clickMessage() const { return mClickMessage; }
48     virtual void setText( const QString& txt );
49 protected:
50     virtual void paintEvent( QPaintEvent *e );
51     virtual void dropEvent( QDropEvent *ev );
52     virtual void focusInEvent( QFocusEvent *ev );
53     virtual void focusOutEvent( QFocusEvent *ev );
54 private:
55     QString mClickMessage;
56     bool mDrawClickMsg;
57 };
58
59 /*****************************************************************
60  * Custom views
61  *****************************************************************/
62 #include <QMouseEvent>
63 #include <QTreeView>
64 #include <QCursor>
65 #include <QPoint>
66 #include <QModelIndex>
67
68 class QVLCTreeView : public QTreeView
69 {
70     Q_OBJECT;
71 public:
72     QVLCTreeView( QWidget * parent ) : QTreeView( parent )
73     {
74     };
75     virtual ~QVLCTreeView()   {};
76
77     void mouseReleaseEvent(QMouseEvent* e )
78     {
79         if( e->button() & Qt::RightButton )
80         {
81             emit rightClicked( indexAt( QPoint( e->x(), e->y() ) ),
82                                QCursor::pos() );
83         }
84     }
85 signals:
86     void rightClicked( QModelIndex, QPoint  );
87 };
88
89 class QKeyEvent;
90 class QWheelEvent;
91 int qtKeyModifiersToVLC( QInputEvent* e );
92 int qtEventToVLCKey( QKeyEvent *e );
93 int qtWheelEventToVLCKey( QWheelEvent *e );
94 QString VLCKeyToString( int val );
95
96 #include "qt4.hpp"
97 #include <vlc/vlc.h>
98 class QComboBox;
99 void setfillVLCConfigCombo(const char *configname, intf_thread_t *p_intf,
100                         QComboBox *combo, QWidget *parent = 0 );
101
102 #endif