-
Notifications
You must be signed in to change notification settings - Fork 3
/
GraphicItemBase.cpp
79 lines (69 loc) · 2.53 KB
/
GraphicItemBase.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
////////////////////////////////////////////////////////////////////////
// Copyright 2009-2018 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2018, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.
////////////////////////////////////////////////////////////////////////
#include "GraphicItemBase.h"
////////////////////////////////////////////////////////////
GraphicItemBase::GraphicItemBase(const ItemType itemType)
{
// Init Variables
m_ItemType = itemType;
m_Properties = NULL;
// Automatically Create a Properties Structure for this graphic object
CreatePropertiesStructure();
}
GraphicItemBase::~GraphicItemBase()
{
DeletePropertiesStructure();
}
void GraphicItemBase::DeletePropertiesStructure()
{
if (m_Properties != NULL) {
delete m_Properties;
}
m_Properties = NULL;
}
void GraphicItemBase::CreatePropertiesStructure()
{
// Create a Properties object when requested (but only one can be created)
if (m_Properties == NULL) {
m_Properties = new ItemProperties(this);
}
}
void GraphicItemBase::SetExistingPropertiesStructure(ItemProperties* ptrExistingProperties)
{
// Check to see if properties exist and the user is assigning a new set of properties
if ((m_Properties != NULL) && (ptrExistingProperties != NULL)) {
// NOTE: This may orphan some memory if not used correctly.
// However, This is the intended design
DeletePropertiesStructure();
}
m_Properties = ptrExistingProperties;
}
void GraphicItemBase::PropertyChanged(QString& PropName, QString& NewPropValue)
{
// This is a virtual function that the derived class should implement if
// it wants to receive notification of a property change. The function
// will be directly called by the ItemProperty class
Q_UNUSED(PropName)
Q_UNUSED(NewPropValue)
}
void GraphicItemBase::DynamicPropertiesChanged(ItemProperties* ptrExistingProperties)
{
// This is a virtual function that the derived class should implement if
// it wants to receive notification of a dynamic property change. The function
// will be directly called by the ItemProperty class
Q_UNUSED(ptrExistingProperties)
}