From b608a3ab9eec819067b68e4284bf90d7aac2f66c Mon Sep 17 00:00:00 2001 From: MusicalProgrammer <38636805+MusicalProgrammer@users.noreply.github.com> Date: Tue, 23 Oct 2018 21:43:29 -0400 Subject: [PATCH] PropertyGrid Selection Explorer Implemented --- Globals.cpp | 3 +-- Globals.h | 2 ++ PropertyWindow.cpp | 26 +++++++++++++++++++++----- PropertyWindow.h | 2 +- main.cpp | 1 - 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Globals.cpp b/Globals.cpp index dddef2f..cff0a91 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -10,8 +10,7 @@ bool Globals::showMouse = true; bool Globals::useMousePoint = false; const std::string Globals::PlaceholderName = "Dynamica"; - - +std::vector selectedInstances = std::vector(); G3D::TextureRef Globals::surface; POINT Globals::mousepoint; Globals::Globals(void){} diff --git a/Globals.h b/Globals.h index 07d4fd0..f7a98a5 100644 --- a/Globals.h +++ b/Globals.h @@ -19,3 +19,5 @@ public: static int surfaceId; static const std::string PlaceholderName; }; + +extern std::vector selectedInstances; \ No newline at end of file diff --git a/PropertyWindow.cpp b/PropertyWindow.cpp index 73b946a..541aeda 100644 --- a/PropertyWindow.cpp +++ b/PropertyWindow.cpp @@ -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;iname.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(); } diff --git a/PropertyWindow.h b/PropertyWindow.h index 7cc06e7..3479589 100644 --- a/PropertyWindow.h +++ b/PropertyWindow.h @@ -7,7 +7,7 @@ public: void SetProperties(Instance *); void ClearProperties(); void onResize(); - + void refreshExplorer(); HWND _hwndProp; private: HWND _propGrid; diff --git a/main.cpp b/main.cpp index 287512e..8ffd95f 100644 --- a/main.cpp +++ b/main.cpp @@ -78,7 +78,6 @@ static int mode = CURSOR; bool dragging = false; Vector2 oldMouse = Vector2(0,0); float moveRate = 0.5; -std::vector selectedInstances = std::vector(); static const std::string PlaceholderName = "HyperCube"; Demo *usableApp = NULL;