~ubuntu-branches/ubuntu/oneiric/partitionmanager/oneiric

« back to all changes in this revision

Viewing changes to src/gui/partwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2009-01-23 17:57:36 UTC
  • Revision ID: james.westby@ubuntu.com-20090123175736-2ltrhgg3m55dokbm
Tags: upstream-1.0.0~beta1a
ImportĀ upstreamĀ versionĀ 1.0.0~beta1a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2008 by Volker Lanz <vl@fidra.de>                       *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU General Public License     *
 
15
 *   along with this program; if not, write to the                         *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
 
18
 ***************************************************************************/
 
19
 
 
20
#if !defined(PARTWIDGET__H)
 
21
 
 
22
#define PARTWIDGET__H
 
23
 
 
24
#include "gui/partwidgetbase.h"
 
25
#include "gui/parttablewidget.h"
 
26
 
 
27
#include "core/partition.h"
 
28
 
 
29
#include <QWidget>
 
30
#include <QPointer>
 
31
 
 
32
class QPaintEvent;
 
33
class QResizeEvent;
 
34
 
 
35
/** @brief Widget that represents a Partition.
 
36
 
 
37
        Represents a single Partition (possibly with its children, in case of an extended Partition) in the GUI.
 
38
 
 
39
        @author vl@fidra.de
 
40
*/
 
41
class PartWidget : public QWidget, public PartWidgetBase
 
42
{
 
43
        Q_OBJECT
 
44
 
 
45
        public:
 
46
                PartWidget(QWidget* parent, const PartTableWidget* ptWidget, const Partition* p, bool showChildren = true);
 
47
 
 
48
        public:
 
49
                bool active() const;
 
50
                void updateChildren();
 
51
                
 
52
                const Partition* partition() const { return m_Partition.isNull() ? NULL : m_Partition; } /**< @return the widget's Partition or NULL if none set */
 
53
 
 
54
        protected:
 
55
                void paintEvent(QPaintEvent* event);
 
56
                void resizeEvent(QResizeEvent* event);
 
57
                
 
58
                PartTableWidget* partTableWidget() { return m_PartTableWidget.isNull() ? NULL : m_PartTableWidget; }
 
59
                const PartTableWidget* partTableWidget() const { return m_PartTableWidget.isNull() ? NULL : m_PartTableWidget; }
 
60
                
 
61
                QList<PartWidget*>& widgets() { return m_Widgets; }
 
62
                const QList<PartWidget*>& widgets() const { return m_Widgets; }
 
63
                
 
64
                void drawPartition(QWidget* destWidget);
 
65
                bool showChildren() const { return m_ShowChildren; }
 
66
 
 
67
        private:
 
68
                QPointer<PartTableWidget> m_PartTableWidget;
 
69
                QPointer<Partition> m_Partition;
 
70
                QList<PartWidget*> m_Widgets;
 
71
                bool m_ShowChildren;
 
72
};
 
73
 
 
74
#endif
 
75