Tried something, it kinda works

This commit is contained in:
andreja6
2018-10-22 21:04:21 -07:00
parent b986815fcb
commit 24306c04ec
10 changed files with 36 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ ButtonListener* listener = NULL;
BaseButtonInstance::BaseButtonInstance(void) BaseButtonInstance::BaseButtonInstance(void)
{ {
listener = NULL; listener = NULL;
initProperties();
} }
void BaseButtonInstance::render(RenderDevice* rd) void BaseButtonInstance::render(RenderDevice* rd)

View File

@@ -14,6 +14,7 @@ DataModelInstance::DataModelInstance(void)
mousey = 0; mousey = 0;
mouseButton1Down = false; mouseButton1Down = false;
showMessage = false; showMessage = false;
initProperties();
} }
DataModelInstance::~DataModelInstance(void) DataModelInstance::~DataModelInstance(void)

View File

@@ -21,6 +21,7 @@ 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)

View File

@@ -15,6 +15,7 @@ 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)
@@ -25,6 +26,24 @@ void Instance::render(RenderDevice* rd)
} }
} }
void Update(PROPGRIDITEM)
{
}
void Instance::initProperties()
{
::PROPGRIDITEM pItem;
pItem.lpszCatalog="Test";
pItem.lpszPropName="Offset";
pItem.lpszzCmbItems="What";
pItem.lpszPropDesc="Description";
pItem.lpCurValue=(LPARAM)"0, 0, 0";
properties.push_back(Property(pItem, Update));
}
Instance::~Instance(void) Instance::~Instance(void)
{ {
for(size_t i = 0; i < children.size(); i++) for(size_t i = 0; i < children.size(); i++)

View File

@@ -5,6 +5,7 @@
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);
@@ -23,4 +24,5 @@ public:
protected: protected:
std::string className; std::string className;
Instance* parent; // Another pointer. Instance* parent; // Another pointer.
void initProperties();
}; };

View File

@@ -19,6 +19,7 @@ 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)

View File

@@ -1,7 +1,7 @@
#define _WINSOCKAPI_ #define _WINSOCKAPI_
#include <windows.h> #include <windows.h>
#include "WindowFunctions.h" #include "WindowFunctions.h"
#include "propertyGrid.h" #include "Property.h"
#include "resource.h" #include "resource.h"
#include "PropertyWindow.h" #include "PropertyWindow.h"
@@ -111,4 +111,11 @@ void PropertyWindow::_redraw()
void PropertyWindow::SetProperties(Instance * instance) void PropertyWindow::SetProperties(Instance * instance)
{ {
PropGrid_ResetContent(_propGrid);
for(size_t i = 0; i < instance->properties.size(); i++)
{
PropGrid_AddItem(_propGrid, &instance->properties.at(i));
}
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
_redraw();
} }

View File

@@ -20,6 +20,7 @@ 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)

View File

@@ -6,6 +6,7 @@ WorkspaceInstance::WorkspaceInstance(void)
className = "Workspace"; className = "Workspace";
timer = 60.0F; timer = 60.0F;
score = 0; score = 0;
initProperties();
} }
WorkspaceInstance::~WorkspaceInstance(void) WorkspaceInstance::~WorkspaceInstance(void)

View File

@@ -1269,6 +1269,7 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
while(selectedInstances.size() > 0) while(selectedInstances.size() > 0)
selectedInstances.erase(selectedInstances.begin()); selectedInstances.erase(selectedInstances.begin());
selectedInstances.push_back(test); selectedInstances.push_back(test);
_propWindow->SetProperties(test);
//message = "Dragging = true."; //message = "Dragging = true.";
//messageTime = System::time(); //messageTime = System::time();
//dragging = true; //dragging = true;