Import fmit upstream version 0.97.6
[fmit.git] / src / modules / View.h
1 // Copyright 2005 "Gilles Degottex"
2
3 // This file is part of "Music"
4
5 // "Music" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 2.1 of the License, or
8 // (at your option) any later version.
9 //
10 // "Music" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19
20 #ifndef _View_h_
21 #define _View_h_
22
23 #include <list>
24 using namespace std;
25 #include <qframe.h>
26 #include <qpopupmenu.h>
27 #include <qsettings.h>
28 #include <qaction.h>
29 #include <qlabel.h>
30
31 class View
32 {
33         static list<View*> s_views;
34
35   protected:
36         struct Title : QLabel
37         {
38                 Title(const QString& text, QWidget* parent)     : QLabel(text, parent)
39                 {setAlignment(QLabel::AlignCenter);}
40         };
41
42         const QString m_name;
43         QWidget* m_parent;
44         QPopupMenu m_popup_menu;
45
46         View(const QString& name, QWidget* parent);
47         virtual void mouseReleaseEvent(QMouseEvent* e);
48
49         virtual ~View() {}
50
51   public:
52         static QSettings* s_settings;
53         const QString& getName()        {return m_name;}
54
55         int getNbView() const           {return s_views.size();}
56
57         // settings
58         QAction* setting_show;
59         virtual void save(){}
60         virtual void load(){}
61         virtual void clearSettings(){}
62
63         static void saveAll();
64         static void loadAll();
65         static void clearAllSettings();
66 };
67
68 //class LabeledSpinBox : QWidget
69 //{
70 //  public:
71 //      LabeledSpinBox(int min, int max, int step, QWidget* parent);
72 //};
73
74 #endif // _View_h_
75