Changed how properties work
This commit is contained in:
@@ -11,7 +11,6 @@ ButtonListener* listener = NULL;
|
||||
BaseButtonInstance::BaseButtonInstance(void)
|
||||
{
|
||||
listener = NULL;
|
||||
initProperties();
|
||||
}
|
||||
|
||||
void BaseButtonInstance::render(RenderDevice* rd)
|
||||
|
||||
@@ -14,7 +14,6 @@ DataModelInstance::DataModelInstance(void)
|
||||
mousey = 0;
|
||||
mouseButton1Down = false;
|
||||
showMessage = false;
|
||||
initProperties();
|
||||
}
|
||||
|
||||
DataModelInstance::~DataModelInstance(void)
|
||||
|
||||
@@ -21,7 +21,6 @@ ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureR
|
||||
floatRight = false;
|
||||
disabled = false;
|
||||
className = "ImageButton";
|
||||
initProperties();
|
||||
}
|
||||
|
||||
ImageButtonInstance::~ImageButtonInstance(void)
|
||||
|
||||
23
Instance.cpp
23
Instance.cpp
@@ -15,7 +15,6 @@ Instance::Instance(const Instance &oinst)
|
||||
setParent(oinst.parent);
|
||||
name = oinst.name;
|
||||
className = oinst.className;
|
||||
initProperties();
|
||||
}
|
||||
|
||||
void Instance::render(RenderDevice* rd)
|
||||
@@ -26,22 +25,24 @@ void Instance::render(RenderDevice* rd)
|
||||
}
|
||||
}
|
||||
|
||||
void Update(PROPGRIDITEM)
|
||||
void Instance::PropUpdate(DWORD addr, PROPGRIDITEM pItem)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Instance::initProperties()
|
||||
std::vector<Property> Instance::getProperties()
|
||||
{
|
||||
PROPGRIDITEM * pItem = new PROPGRIDITEM();
|
||||
PropGrid_ItemInit((*pItem));
|
||||
pItem->lpszCatalog="Properties";
|
||||
pItem->lpszPropName="Name";
|
||||
pItem->lpszPropDesc="The name of the current instance";
|
||||
pItem->lpCurValue=(LPARAM)name.c_str();
|
||||
pItem->iItemType=PIT_EDIT;
|
||||
std::vector<Property> properties;
|
||||
PROPGRIDITEM pItem;
|
||||
PropGrid_ItemInit(pItem);
|
||||
pItem.lpszCatalog="Properties";
|
||||
pItem.lpszPropName="Name";
|
||||
pItem.lpszPropDesc="The name of the current instance";
|
||||
pItem.lpCurValue=(LPARAM)name.c_str();
|
||||
pItem.iItemType=PIT_EDIT;
|
||||
|
||||
properties.push_back(new Property(pItem, Update));
|
||||
properties.push_back(Property(pItem, (DWORD)&name));
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
class Instance
|
||||
{
|
||||
public:
|
||||
std::vector<Property *> properties;
|
||||
Instance(void);
|
||||
Instance(const Instance&);
|
||||
virtual ~Instance(void);
|
||||
@@ -21,8 +20,10 @@ public:
|
||||
void removeChild(Instance*);
|
||||
Instance* getParent();
|
||||
virtual Instance* clone() const { return new Instance(*this); }
|
||||
virtual std::vector<Property> getProperties();
|
||||
virtual void PropUpdate(DWORD addr, PROPGRIDITEM pItem);
|
||||
protected:
|
||||
std::string className;
|
||||
Instance* parent; // Another pointer.
|
||||
void initProperties();
|
||||
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@ PhysicalInstance::PhysicalInstance(void)
|
||||
back = Smooth;
|
||||
left = Smooth;
|
||||
bottom = Smooth;
|
||||
initProperties();
|
||||
}
|
||||
|
||||
PhysicalInstance::PhysicalInstance(const PhysicalInstance &oinst)
|
||||
|
||||
11
Property.cpp
11
Property.cpp
@@ -1,20 +1,15 @@
|
||||
#include "Property.h"
|
||||
|
||||
Property::Property(PROPGRIDITEM * item, void(*onPropUpdate)(PROPGRIDITEM))
|
||||
Property::Property(PROPGRIDITEM item, DWORD addr)
|
||||
{
|
||||
this->callbackFuncOnChange = onPropUpdate;
|
||||
this->addr = addr;
|
||||
this->item = item;
|
||||
}
|
||||
|
||||
Property::~Property(void)
|
||||
{
|
||||
delete item;
|
||||
}
|
||||
|
||||
void Property::updateProperty(PROPGRIDITEM item)
|
||||
{
|
||||
callbackFuncOnChange(item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
class Property
|
||||
{
|
||||
public:
|
||||
void(*callbackFuncOnChange)(PROPGRIDITEM);
|
||||
PROPGRIDITEM * item;
|
||||
Property(PROPGRIDITEM * item, void(*onPropUpdate)(PROPGRIDITEM));
|
||||
PROPGRIDITEM item;
|
||||
DWORD addr;
|
||||
Property(PROPGRIDITEM item, DWORD addr);
|
||||
~Property(void);
|
||||
void updateProperty(PROPGRIDITEM);
|
||||
};
|
||||
|
||||
@@ -112,11 +112,13 @@ void PropertyWindow::_redraw()
|
||||
void PropertyWindow::SetProperties(Instance * instance)
|
||||
{
|
||||
PropGrid_ResetContent(_propGrid);
|
||||
for(size_t i = 0; i < instance->properties.size(); i++)
|
||||
std::vector<Property> prop = instance->getProperties();
|
||||
for(size_t i = 0; i < prop.size(); i++)
|
||||
{
|
||||
::PROPGRIDITEM * item = instance->properties.at(i)->item;
|
||||
PropGrid_AddItem(_propGrid, item);
|
||||
::PROPGRIDITEM item = prop.at(i).item;
|
||||
PropGrid_AddItem(_propGrid, &item);
|
||||
}
|
||||
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
|
||||
_redraw();
|
||||
}
|
||||
@@ -20,7 +20,6 @@ TextButtonInstance::TextButtonInstance(void)
|
||||
visible = true;
|
||||
className = "TextButton";
|
||||
disabled = false;
|
||||
initProperties();
|
||||
}
|
||||
|
||||
bool TextButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
|
||||
|
||||
@@ -6,7 +6,6 @@ WorkspaceInstance::WorkspaceInstance(void)
|
||||
className = "Workspace";
|
||||
timer = 60.0F;
|
||||
score = 0;
|
||||
initProperties();
|
||||
}
|
||||
|
||||
WorkspaceInstance::~WorkspaceInstance(void)
|
||||
|
||||
Reference in New Issue
Block a user