Changed how properties work

This commit is contained in:
andreja6
2018-10-22 20:35:23 -07:00
parent a70cc31d28
commit b986815fcb
6 changed files with 25 additions and 26 deletions

View File

@@ -106,3 +106,6 @@ Instance* Instance::findFirstChild(std::string name)
}
return child;
}

View File

@@ -1,11 +1,10 @@
#pragma once
#include <G3DAll.h>
#include "Property.h"
#pragma once
class Instance
{
public:
Property *properties;
Instance(void);
Instance(const Instance&);
virtual ~Instance(void);

View File

@@ -1,25 +1,19 @@
#include "Property.h"
Property::Property(std::string title, std::string propName, void * prop, void *(*getFunc)(void), void(*setFunc)(void *))
Property::Property(PROPGRIDITEM item, void(*onPropUpdate)(PROPGRIDITEM))
{
this->title = title;
this->propName = propName;
this->prop = prop;
this->getFunc = getFunc;
this->setFunc = setFunc;
this->callbackFuncOnChange = onPropUpdate;
this->item = item;
}
Property::~Property(void)
{
}
void Property::setProperty(void * newprop)
void Property::updateProperty(PROPGRIDITEM item)
{
this->setFunc(newprop);
callbackFuncOnChange(item);
}
void * Property::getProperty()
{
return this->getFunc();
}

View File

@@ -1,15 +1,12 @@
#pragma once
#include <G3DAll.h>
#include <windows.h>
#include "propertyGrid.h"
class Property
{
public:
std::string title;
std::string propName;
void * prop;
void *(*getFunc)(void);
void(*setFunc)(void *);
void setProperty(void*);
void * getProperty();
Property(std::string title, std::string propName, void * prop, void *(*getFunc)(void), void(*setFunc)(void *));
void(*callbackFuncOnChange)(PROPGRIDITEM);
PROPGRIDITEM item;
Property(PROPGRIDITEM item, void(*onPropUpdate)(PROPGRIDITEM));
~Property(void);
void updateProperty(PROPGRIDITEM);
};

View File

@@ -1,3 +1,4 @@
#define _WINSOCKAPI_
#include <windows.h>
#include "WindowFunctions.h"
#include "propertyGrid.h"
@@ -107,3 +108,7 @@ void PropertyWindow::_redraw()
GetClientRect(_hwndProp,&rect);
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
}
void PropertyWindow::SetProperties(Instance * instance)
{
}

View File

@@ -1,9 +1,10 @@
#pragma once
#include "Instance.h"
class PropertyWindow {
public:
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
void SetProperties(Instance *);
void onResize();
private:
HWND _propGrid;