Added MeasureItem case

This commit is contained in:
andreja6
2018-10-24 13:02:31 -07:00
parent abe406990b
commit ebe7ad682e

View File

@@ -4,7 +4,6 @@
#include "resource.h" #include "resource.h"
#include "PropertyWindow.h" #include "PropertyWindow.h"
#include "Globals.h" #include "Globals.h"
/*typedef struct typPRGP { /*typedef struct typPRGP {
Instance* instance; // Declare member types Instance* instance; // Declare member types
Property ∝ Property ∝
@@ -14,7 +13,6 @@ std::vector<PROPGRIDITEM> prop;
std::vector<Instance*> children; std::vector<Instance*> children;
Instance* selectedInstance; Instance* selectedInstance;
PropertyWindow * thisCls;
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
@@ -30,6 +28,13 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
ShowWindow(hwnd, SW_HIDE); ShowWindow(hwnd, SW_HIDE);
} }
break; break;
case WM_MEASUREITEM:
{
LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam;
if (lpmis->itemHeight < 18)
lpmis->itemHeight = 18;
}
break;
case WM_SIZE: case WM_SIZE:
{ {
propWind->onResize(); propWind->onResize();
@@ -44,11 +49,11 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem); SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem);
if(ItemIndex != 0) if(ItemIndex != 0)
{ {
thisCls->ClearProperties(); propWind->ClearProperties();
while(g_selectedInstances.size() != 0) while(g_selectedInstances.size() != 0)
g_selectedInstances.erase(g_selectedInstances.begin()); g_selectedInstances.erase(g_selectedInstances.begin());
g_selectedInstances.push_back(children.at(ItemIndex-1)); g_selectedInstances.push_back(children.at(ItemIndex-1));
thisCls->SetProperties(children.at(ItemIndex-1)); propWind->SetProperties(children.at(ItemIndex-1));
} }
} }
} }
@@ -92,7 +97,6 @@ void PropertyWindow::refreshExplorer()
} }
bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance) { bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance) {
thisCls = this;
if (!createWindowClass("propHWND",PropProc,hThisInstance)) if (!createWindowClass("propHWND",PropProc,hThisInstance))
return false; return false;