Now has icons

This commit is contained in:
andreja6
2019-11-02 12:26:01 -07:00
parent 08d8dc4df0
commit bc8742b5f5
5 changed files with 90 additions and 29 deletions

View File

@@ -27,6 +27,7 @@ DataModelInstance::DataModelInstance(void)
workspace->setParent(this);
level->setParent(this);
_loadedFileName="..//skooter.rbxm";
listicon = 1;
}

View File

@@ -266,18 +266,10 @@
RelativePath=".\IEBrowser.cpp"
>
</File>
<File
RelativePath=".\IEBrowser.h"
>
</File>
<File
RelativePath=".\IEDispatcher.cpp"
>
</File>
<File
RelativePath=".\LevelInstance.cpp"
>
</File>
<File
RelativePath="main.cpp"
>
@@ -298,10 +290,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\PartInstance.cpp"
>
</File>
<File
RelativePath=".\propertyGrid.cpp"
>
@@ -310,10 +298,6 @@
RelativePath=".\PropertyWindow.cpp"
>
</File>
<File
RelativePath=".\PVInstance.cpp"
>
</File>
<File
RelativePath=".\WindowFunctions.cpp"
>
@@ -337,6 +321,18 @@
RelativePath=".\Instance.cpp"
>
</File>
<File
RelativePath=".\LevelInstance.cpp"
>
</File>
<File
RelativePath=".\PartInstance.cpp"
>
</File>
<File
RelativePath=".\PVInstance.cpp"
>
</File>
<File
RelativePath=".\TextButtonInstance.cpp"
>
@@ -388,7 +384,7 @@
>
</File>
<File
RelativePath=".\GroupInstance.h"
RelativePath=".\IEBrowser.h"
>
</File>
<File
@@ -399,10 +395,6 @@
RelativePath=".\LevelInstance.h"
>
</File>
<File
RelativePath=".\PartInstance.h"
>
</File>
<File
RelativePath=".\propertyGrid.h"
>
@@ -411,10 +403,6 @@
RelativePath=".\PropertyWindow.h"
>
</File>
<File
RelativePath=".\PVInstance.h"
>
</File>
<File
RelativePath=".\rapidxml\rapidxml.hpp"
>
@@ -454,6 +442,10 @@
RelativePath=".\DataModelInstance.h"
>
</File>
<File
RelativePath=".\GroupInstance.h"
>
</File>
<File
RelativePath=".\ImageButtonInstance.h"
>
@@ -462,6 +454,14 @@
RelativePath=".\Instance.h"
>
</File>
<File
RelativePath=".\PartInstance.h"
>
</File>
<File
RelativePath=".\PVInstance.h"
>
</File>
<File
RelativePath=".\TextButtonInstance.h"
>

View File

@@ -18,6 +18,7 @@ Instance::Instance(const Instance &oinst)
name = oinst.name;
className = oinst.className;
canDelete = oinst.canDelete;
listicon = oinst.listicon;
//setParent(oinst.parent);
}

View File

@@ -5,6 +5,7 @@
#include "PropertyWindow.h"
#include "Globals.h"
#include "strsafe.h"
/*typedef struct typPRGP {
Instance* instance; // Declare member types
Property &prop;
@@ -17,6 +18,49 @@ Instance * parent = NULL;
const int CX_BITMAP = 16;
const int CY_BITMAP = 16;
HBITMAP CreateBitmapMask(HBITMAP hbmColour, COLORREF crTransparent)
{
HDC hdcMem, hdcMem2;
HBITMAP hbmMask;
BITMAP bm;
// Create monochrome (1 bit) mask bitmap.
GetObject(hbmColour, sizeof(BITMAP), &bm);
hbmMask = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, NULL);
// Get some HDCs that are compatible with the display driver
hdcMem = CreateCompatibleDC(0);
hdcMem2 = CreateCompatibleDC(0);
SelectObject(hdcMem, hbmColour);
SelectObject(hdcMem2, hbmMask);
// Set the background colour of the colour image to the colour
// you want to be transparent.
SetBkColor(hdcMem, crTransparent);
// Copy the bits from the colour image to the B+W mask... everything
// with the background colour ends up white while everythig else ends up
// black...Just what we wanted.
BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
// Take our new mask and use it to turn the transparent colour in our
// original colour image to black so the transparency effect will
// work right.
BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem2, 0, 0, SRCINVERT);
// Clean up.
DeleteDC(hdcMem);
DeleteDC(hdcMem2);
return hbmMask;
}
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
TCHAR achTemp[256];
@@ -50,7 +94,7 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
// Get the food icon from the item data.
HBITMAP hbmIcon = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1));
HBITMAP hbmMask = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1));
HBITMAP hbmMask = CreateBitmapMask(hbmIcon, RGB(255, 0, 220));
// The colors depend on whether the item is selected.
clrForeground = SetTextColor(lpdis->hDC,
GetSysColor(lpdis->itemState & ODS_SELECTED ?
@@ -66,7 +110,21 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
x = LOWORD(GetDialogBaseUnits()) / 4;
// Get and display the text for the list item.
int mul = 0;
SendMessage(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, (LPARAM) achTemp);
if(lpdis->itemID == 0)
{
mul = selectedInstance->listicon;
}
else if(lpdis->itemID == 1 && parent != NULL)
{
mul = parent->listicon;
}
else if(parent != NULL)
{
mul = children[lpdis->itemID-2]->listicon;
}
else mul = children[lpdis->itemID-1]->listicon;
hr = StringCchLength(achTemp, 256, &cch);
if (FAILED(hr))
@@ -89,11 +147,11 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SelectObject(hdc, hbmMask);
BitBlt(lpdis->hDC, x, lpdis->rcItem.top + 1,
CX_BITMAP, CY_BITMAP, hdc, 0, 0, SRCAND);
CX_BITMAP, CY_BITMAP, hdc, mul*16, 0, SRCAND);
SelectObject(hdc, hbmIcon);
BitBlt(lpdis->hDC, x, lpdis->rcItem.top + 1,
CX_BITMAP, CY_BITMAP, hdc, 0, 0, SRCPAINT);
CX_BITMAP, CY_BITMAP, hdc, mul*16, 0, SRCPAINT);
DeleteDC(hdc);
@@ -225,7 +283,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
NULL,
"COMBOBOX",
"Combo",
WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST,
WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS ,
0,
0,
0,

View File

@@ -7,6 +7,7 @@ WorkspaceInstance::WorkspaceInstance(void)
name = "Workspace";
className = "Workspace";
canDelete = false;
listicon = 8;
}
WorkspaceInstance::~WorkspaceInstance(void)