PropertyGrid Selection Explorer Implemented

This commit is contained in:
MusicalProgrammer
2018-10-23 21:43:29 -04:00
parent ccf3ade099
commit b608a3ab9e
5 changed files with 25 additions and 9 deletions

View File

@@ -10,8 +10,7 @@ bool Globals::showMouse = true;
bool Globals::useMousePoint = false;
const std::string Globals::PlaceholderName = "Dynamica";
std::vector<Instance*> selectedInstances = std::vector<Instance*>();
G3D::TextureRef Globals::surface;
POINT Globals::mousepoint;
Globals::Globals(void){}

View File

@@ -19,3 +19,5 @@ public:
static int surfaceId;
static const std::string PlaceholderName;
};
extern std::vector<Instance*> selectedInstances;

View File

@@ -3,6 +3,7 @@
#include "WindowFunctions.h"
#include "resource.h"
#include "PropertyWindow.h"
#include "Globals.h"
/*typedef struct typPRGP {
Instance* instance; // Declare member types
@@ -54,6 +55,15 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
void PropertyWindow::refreshExplorer()
{
SendMessage(_explorerComboBox,CB_RESETCONTENT,0,0);
for (unsigned int i=0;i<selectedInstances.size();i++) {
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)selectedInstances[i]->name.c_str());
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);
}
}
bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance) {
if (!createWindowClass("propHWND",PropProc,hThisInstance))
@@ -81,13 +91,14 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST,
0,
0,
280,
20,
0,
0,
_hwndProp, // parent
NULL, // menu
hThisInstance,
NULL
);
SendMessage(_explorerComboBox, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
@@ -131,8 +142,11 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
PropGrid_ShowToolTips(_propGrid,TRUE);
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
PropGrid_ExpandAllCatalogs(_propGrid);
SetWindowLongPtr(_hwndProp,GWL_USERDATA,(LONG)this);
refreshExplorer();
_resize();
return true;
@@ -152,7 +166,7 @@ void PropertyWindow::_resize()
RECT rect;
GetClientRect(_hwndProp,&rect);
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos(_explorerComboBox, NULL, 0, 0, rect.right, 20, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos(_explorerComboBox, NULL, 0, 0, rect.right, 400, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
void PropertyWindow::SetProperties(Instance * instance)
@@ -169,7 +183,9 @@ void PropertyWindow::SetProperties(Instance * instance)
//propgp.prop = prop.at(i);
}
PropGrid_ExpandAllCatalogs(_propGrid);
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
//SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
refreshExplorer();
_resize();
}

View File

@@ -7,7 +7,7 @@ public:
void SetProperties(Instance *);
void ClearProperties();
void onResize();
void refreshExplorer();
HWND _hwndProp;
private:
HWND _propGrid;

View File

@@ -78,7 +78,6 @@ static int mode = CURSOR;
bool dragging = false;
Vector2 oldMouse = Vector2(0,0);
float moveRate = 0.5;
std::vector<Instance*> selectedInstances = std::vector<Instance*>();
static const std::string PlaceholderName = "HyperCube";
Demo *usableApp = NULL;