Made properties explorer "work" and added bitmaps

This commit is contained in:
andreja6
2018-10-24 12:54:12 -07:00
parent 78c6dec932
commit abe406990b
7 changed files with 27 additions and 7 deletions

Binary file not shown.

View File

@@ -67,6 +67,13 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "icon1.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP1 BITMAP "C:\\Users\\Andreja\\Desktop\\Parts.bmp"
#endif // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////

View File

@@ -444,6 +444,10 @@
RelativePath=".\icon1.ico"
>
</File>
<File
RelativePath="..\..\Desktop\Parts.bmp"
>
</File>
</Filter>
</Files>
<Globals>

View File

@@ -8,6 +8,7 @@ Instance::Instance(void)
parent = NULL;
name = "Default Game Instance";
className = "BaseInstance";
listicon = 0;
}
Instance::Instance(const Instance &oinst)

View File

@@ -22,6 +22,7 @@ public:
virtual Instance* clone() const { return new Instance(*this); }
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
int listicon;
protected:
std::string className;
Instance* parent; // Another pointer.

View File

@@ -13,6 +13,9 @@
std::vector<PROPGRIDITEM> prop;
std::vector<Instance*> children;
Instance* selectedInstance;
PropertyWindow * thisCls;
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA);
@@ -38,11 +41,14 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int ItemIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
CHAR ListItem[256];
SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem);
MessageBox(hwnd, ListItem, "Item Selected", MB_OK);
SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem);
if(ItemIndex != 0)
{
//SetProperties(children.at(ItemIndex-1));
thisCls->ClearProperties();
while(g_selectedInstances.size() != 0)
g_selectedInstances.erase(g_selectedInstances.begin());
g_selectedInstances.push_back(children.at(ItemIndex-1));
thisCls->SetProperties(children.at(ItemIndex-1));
}
}
}
@@ -79,14 +85,14 @@ void PropertyWindow::refreshExplorer()
children = g_selectedInstances[i]->getChildren();
for(size_t z = 0; z < children.size(); z++)
{
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)children.at(i)->name.c_str());
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)children.at(z)->name.c_str());
}
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);
}
}
bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance) {
thisCls = this;
if (!createWindowClass("propHWND",PropProc,hThisInstance))
return false;

View File

@@ -3,13 +3,14 @@
// Used by Dialogs.rc
//
#define IDI_ICON1 102
#define IDC_PROPERTYGRID 2000
#define IDB_BITMAP1 103
#define IDC_PROPERTYGRID 2000
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101