forked from Heeks/heekscad-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PropertyDouble.cpp
45 lines (36 loc) · 1.32 KB
/
PropertyDouble.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
// PropertyDouble.cpp
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#include "stdafx.h"
#include "PropertyDouble.h"
PropertyDouble::PropertyDouble(const wxChar* t, double initial_value, HeeksObj* object, void(*callbackfunc)(double, HeeksObj*), void(*selectcallback)(HeeksObj*)):Property(object, selectcallback){
m_initial_value = initial_value;
m_callbackfunc = callbackfunc;
m_callbackfuncidx = 0;
title = wxString(t);
has_index = false;
}
PropertyDouble::PropertyDouble(const wxChar* t, double initial_value, HeeksObj* object, void(*callbackfunc)(double, HeeksObj*, int), int index, void(*selectcallback)(HeeksObj*)):Property(object, selectcallback)
{
m_initial_value = initial_value;
m_callbackfuncidx = callbackfunc;
m_callbackfunc = 0;
m_object = object;
title = wxString(t);
has_index = true;
m_index = index;
}
PropertyDouble::~PropertyDouble(){
}
const wxChar* PropertyDouble::GetShortString(void)const{
return title.c_str();
}
Property *PropertyDouble::MakeACopy(void)const{
PropertyDouble* new_object = new PropertyDouble(*this);
return new_object;
}
void PropertyDouble::CallSetFunction() const
{
if(m_callbackfunc)(*m_callbackfunc)(m_initial_value, m_object);
if(m_callbackfuncidx)(*m_callbackfuncidx)(m_initial_value, m_object,m_index);
}