2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2006-2007 Bartlomiej Swiecki
5
* wxSmith is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* wxSmith 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 General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
19
* $Id: wxslongproperty.cpp 4850 2008-01-29 21:45:49Z byo $
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/properties/wxslongproperty.cpp $
23
#include "wxslongproperty.h"
26
// Helper macro for fetching variable
27
#define VALUE wxsVARIABLE(Object,Offset,long)
29
wxsLongProperty::wxsLongProperty(const wxString& PGName, const wxString& DataName,long _Offset,long _Default,int Priority):
30
wxsProperty(PGName,DataName,Priority),
36
void wxsLongProperty::PGCreate(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Parent)
38
PGRegister(Object,Grid,Grid->AppendIn(Parent,wxIntProperty(GetPGName(),wxPG_LABEL,VALUE)));
41
bool wxsLongProperty::PGRead(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Id,long Index)
43
VALUE = Grid->GetPropertyValue(Id).GetLong();
47
bool wxsLongProperty::PGWrite(wxsPropertyContainer* Object,wxPropertyGridManager* Grid,wxPGId Id,long Index)
49
Grid->SetPropertyValue(Id,VALUE);
53
bool wxsLongProperty::XmlRead(wxsPropertyContainer* Object,TiXmlElement* Element)
60
const char* Text = Element->GetText();
70
bool wxsLongProperty::XmlWrite(wxsPropertyContainer* Object,TiXmlElement* Element)
72
if ( VALUE != Default )
74
Element->InsertEndChild(TiXmlText(cbU2C(wxString::Format(_T("%d"),VALUE))));
80
bool wxsLongProperty::PropStreamRead(wxsPropertyContainer* Object,wxsPropertyStream* Stream)
82
return Stream->GetLong(GetDataName(),VALUE,Default);
85
bool wxsLongProperty::PropStreamWrite(wxsPropertyContainer* Object,wxsPropertyStream* Stream)
87
return Stream->PutLong(GetDataName(),VALUE,Default);