Changed how properties work
This commit is contained in:
@@ -106,3 +106,6 @@ Instance* Instance::findFirstChild(std::string name)
|
|||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "Property.h"
|
#include "Property.h"
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class Instance
|
class Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Property *properties;
|
|
||||||
Instance(void);
|
Instance(void);
|
||||||
Instance(const Instance&);
|
Instance(const Instance&);
|
||||||
virtual ~Instance(void);
|
virtual ~Instance(void);
|
||||||
|
|||||||
20
Property.cpp
20
Property.cpp
@@ -1,25 +1,19 @@
|
|||||||
#include "Property.h"
|
#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->callbackFuncOnChange = onPropUpdate;
|
||||||
this->propName = propName;
|
this->item = item;
|
||||||
this->prop = prop;
|
|
||||||
this->getFunc = getFunc;
|
|
||||||
this->setFunc = setFunc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Property::~Property(void)
|
Property::~Property(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Property::updateProperty(PROPGRIDITEM item)
|
||||||
void Property::setProperty(void * newprop)
|
|
||||||
{
|
{
|
||||||
this->setFunc(newprop);
|
callbackFuncOnChange(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void * Property::getProperty()
|
|
||||||
{
|
|
||||||
return this->getFunc();
|
|
||||||
}
|
|
||||||
|
|||||||
15
Property.h
15
Property.h
@@ -1,15 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <G3DAll.h>
|
#include <windows.h>
|
||||||
|
#include "propertyGrid.h"
|
||||||
class Property
|
class Property
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string title;
|
void(*callbackFuncOnChange)(PROPGRIDITEM);
|
||||||
std::string propName;
|
PROPGRIDITEM item;
|
||||||
void * prop;
|
Property(PROPGRIDITEM item, void(*onPropUpdate)(PROPGRIDITEM));
|
||||||
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 *));
|
|
||||||
~Property(void);
|
~Property(void);
|
||||||
|
void updateProperty(PROPGRIDITEM);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#define _WINSOCKAPI_
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "WindowFunctions.h"
|
#include "WindowFunctions.h"
|
||||||
#include "propertyGrid.h"
|
#include "propertyGrid.h"
|
||||||
@@ -107,3 +108,7 @@ void PropertyWindow::_redraw()
|
|||||||
GetClientRect(_hwndProp,&rect);
|
GetClientRect(_hwndProp,&rect);
|
||||||
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::SetProperties(Instance * instance)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "Instance.h"
|
||||||
class PropertyWindow {
|
class PropertyWindow {
|
||||||
public:
|
public:
|
||||||
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
||||||
bool onCreate(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();
|
void onResize();
|
||||||
private:
|
private:
|
||||||
HWND _propGrid;
|
HWND _propGrid;
|
||||||
|
|||||||
Reference in New Issue
Block a user