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