Qt Virtual Chart Table (QVCT)
COverlayObject.hpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 #ifndef QVCT_COVERLAYOBJECT_HPP
20 #define QVCT_COVERLAYOBJECT_HPP
21 
22 // QT
23 #include <QDataStream>
24 #include <QTreeWidgetItem>
25 
26 // QVCT
27 class CChart;
28 class COverlay;
29 
30 
32 
38 class COverlayObject: public QObject, public QTreeWidgetItem
39 {
40  Q_OBJECT
41 
42  //------------------------------------------------------------------------------
43  // CONSTANTS / STATIC
44  //------------------------------------------------------------------------------
45 
46 public:
48  enum EType {
49  OVERLAY = 1001,
50  CONTAINER = 1010,
51  SUBCONTAINER = 1011,
52  ITEM = 1100,
53  SUBITEM1 = 1101,
54  SUBITEM2 = 1102
55  };
56 
57 
58  //------------------------------------------------------------------------------
59  // FIELDS
60  //------------------------------------------------------------------------------
61 
62 protected:
64 
65  QString qsName;
66 
67 
68  //------------------------------------------------------------------------------
69  // CONSTRUCTORS / DESTRUCTOR
70  //------------------------------------------------------------------------------
71 
72 protected:
73  COverlayObject( EType _eType, const QString& _rqsName );
74  virtual ~COverlayObject() {};
75 
76 
77  //------------------------------------------------------------------------------
78  // METHODS
79  //------------------------------------------------------------------------------
80 
81  // SETTERS
82 public:
84  void setName( const QString& _rqsName ) { qsName = _rqsName; };
85 
86  // GETTERS
87 public:
89  QString getName() const { return qsName; };
90 
91  // USERS
92 public:
94  virtual COverlay* useOverlay() = 0;
95 
96  // OTHER
97 public:
99  virtual void serialize( QDataStream& _rqDataStream ) const;
101  virtual void unserialize( QDataStream& _rqDataStream );
102 
103 public:
105  virtual void draw( const CChart* _poChart, QPainter* _pqPainter ) = 0;
107  virtual void showDetail() = 0;
109  virtual void showEdit() = 0;
110 
111 public:
113 
117  QString newChildName( const QString& _rqsName, int _iZeroPrefix = 0, bool _bForceSuffix = false ) const;
119 
122  QString newChildName( const QString& _rqsName, int _iZeroPrefix, int _iSuffix ) const;
123 
124 };
125 
126 #endif // QVCT_COVERLAYOBJECT_HPP
[UI] Chart (view)
Definition: CChart.hpp:44
Generic overlay object.
virtual COverlay * useOverlay()=0
Returns this object's (base) overlay.
virtual void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
EType
Overlay object type.
@ SUBITEM1
Sub-item (type 1)
@ CONTAINER
Container.
@ SUBITEM2
Sub-item (type 2)
@ SUBCONTAINER
Sub-container.
@ OVERLAY
(Base) overlay
QString getName() const
Returns this object's name.
void setName(const QString &_rqsName)
Sets this object's name.
virtual ~COverlayObject()
virtual void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
virtual void draw(const CChart *_poChart, QPainter *_pqPainter)=0
Draws this object (itself or its content)
QString newChildName(const QString &_rqsName, int _iZeroPrefix=0, bool _bForceSuffix=false) const
Returns a valid (non-duplicate) name for a new sibling of this object.
virtual void showDetail()=0
Displays this object's details (in the appropriate widget/view)
QString qsName
Object name.
virtual void showEdit()=0
Displays this object's edit widget/view.
COverlayObject(EType _eType, const QString &_rqsName)
Generic overlay.
Definition: COverlay.hpp:45