]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/toolbar.hpp
[Qt] Edition of both lines.
[vlc] / modules / gui / qt4 / dialogs / toolbar.hpp
1 /*****************************************************************************
2  * ToolbarEdit.hpp : ToolbarEdit dialogs
3  ****************************************************************************
4  * Copyright (C) 2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _TOOLBAREDIT_DIALOG_H_
25 #define _TOOLBAREDIT_DIALOG_H_
26
27 #include "util/qvlcframe.hpp"
28 #include "components/controller.hpp"
29
30 #include <QRubberBand>
31 #include <QListWidget>
32
33 class ToolbarEditDialog;
34
35 class WidgetListing : public QListWidget
36 {
37     Q_OBJECT;
38 public:
39     WidgetListing( intf_thread_t *, QWidget *_parent = 0 );
40 protected:
41     virtual void startDrag( Qt::DropActions /*supportedActions*/ );
42 private:
43     ToolbarEditDialog *parent;
44 };
45
46 class ToolbarEditDialog : public QVLCFrame
47 {
48     Q_OBJECT;
49 public:
50     static ToolbarEditDialog * getInstance( intf_thread_t *p_intf )
51     {
52         if( !instance)
53             instance = new ToolbarEditDialog( p_intf );
54         return instance;
55     }
56     virtual ~ToolbarEditDialog();
57     int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
58                         bigBox->isChecked() * WIDGET_BIG +
59                         shinyBox->isChecked() * WIDGET_SHINY; }
60 private:
61     ToolbarEditDialog( intf_thread_t * );
62     static ToolbarEditDialog *instance;
63
64     QCheckBox *flatBox, *bigBox, *shinyBox;
65
66     WidgetListing *widgetListing;
67 };
68
69 class DroppingController: public AbstractController
70 {
71     Q_OBJECT;
72 public:
73     DroppingController( intf_thread_t *, QString line, QWidget *parent = 0 );
74
75 protected:
76     virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
77             buttonType_e i_type, int i_option );
78     virtual void dragEnterEvent ( QDragEnterEvent * event );
79     virtual void dragMoveEvent(QDragMoveEvent *event);
80     virtual void dropEvent ( QDropEvent * event );
81     virtual void dragLeaveEvent ( QDragLeaveEvent * event );
82
83     virtual void doAction( int );
84 private:
85     QRubberBand *rubberband;
86
87     int getParentPosInLayout( QPoint point);
88
89 };
90
91 #endif
92