diff --git a/Test/Test.rc b/Demo/Demo.rc
similarity index 100%
rename from Test/Test.rc
rename to Demo/Demo.rc
diff --git a/Test/Test.vcxproj b/Demo/Demo.vcxproj
similarity index 98%
rename from Test/Test.vcxproj
rename to Demo/Demo.vcxproj
index f28a8d9..8919249 100644
--- a/Test/Test.vcxproj
+++ b/Demo/Demo.vcxproj
@@ -24,7 +24,7 @@
{e0afc75e-90ec-4eeb-b3f7-29605a1ef545}
Test
10.0
- Test
+ Demo
@@ -143,7 +143,7 @@
-
+
diff --git a/Test/icon1.ico b/Demo/icon1.ico
similarity index 100%
rename from Test/icon1.ico
rename to Demo/icon1.ico
diff --git a/Test/main.cpp b/Demo/main.cpp
similarity index 70%
rename from Test/main.cpp
rename to Demo/main.cpp
index 2f7374b..ec882c2 100644
--- a/Test/main.cpp
+++ b/Demo/main.cpp
@@ -6,6 +6,8 @@ void CheckBoxClick();
void ButtonClick();
void RadioGroupChanged();
void WindowClose();
+void OpenGridExample();
+void InitializeGridDemoWindow();
TextBox box(L"Test-TextBox", FALSE, 0, 0, 100, 100);
Button button(L"Input-Box text",FALSE, 0, 100, 100, 20);
CheckBox chkbox(L"CheckBox", 100, 300, 70, 15);
@@ -16,13 +18,14 @@ RadioButton button1(L"Fullscreen", 130, 90, 90, 15);
RadioButton button2(L"Windowed Fullscreen", 130, 110, 140, 15);
RadioButton button3(L"Windowed", 130, 130, 140, 15);
ListView lstView(10, 10, 200, 200);
+HINSTANCE m_hInstance;
Grid grid;
-INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow) {
+Window* gridWindow;
+INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow) {
(void)hPrevInstance;
(void)lpCmdLine;
-
- Window window(hInstance);
- window.SubscribeToOnClose(WindowClose);
+ m_hInstance = hInstance;
+
button.SubscribeToOnClick(ButtonClick);
chkbox.SubscribeToOnClick(CheckBoxClick);
group.SubscribeToOnChange(RadioGroupChanged);
@@ -30,21 +33,58 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine,
group.AddRadioButton(&button2);
group.AddRadioButton(&button3);
/*
- * Add vertical scroll bar.
- * If before window creation it shows correctly, if after, only scroll wheel works(could be a bug ? )
- */
+ * Add vertical scroll bar.
+ * If before window creation it shows correctly, if after, only scroll wheel works(could be a bug ? )
+ */
box.SetStyle(box.GetStyle() | WS_VSCROLL);
+ chkbox.SetChecked(1);
+ grid.AddColumn(0, L"Auto");
+ grid.AddColumn(0, L"*");
+ grid.AddColumn(0, L"Auto");
+ lstView.SetHorizontalAligment(Stretch);
+ lstView.SetVerticalAligment(Stretch);
+ block.SetVerticalAligment(Center);
+ chkbox.SetVerticalAligment(Center);
+ grid.AddItem(&lstView, 0, 1);
+ grid.AddItem(&chkbox, 0, 2);
+ grid.AddItem(&block, 0, 0);
+
/* window.SetBackroundColor(Color::PURPLE);
window.m_StaticBacgkround = Color::PURPLE;
window.m_StaticTextColor = Color::LIGHT_PURPLE;
window.m_EditBacgkround = Color::LIGHT_PURPLE;
window.m_ButtonBacgkround = Color::WHITE;
window.m_ButtonTextColor = Color::DARK_PURPLE;*/
- if (!window.Create(L"MUI Demo",(DWORD)IDI_ICON1)) {
- return 0;
+
+ Window mainWindow(hInstance);
+ mainWindow.Create(L"MUI Demo", (DWORD)IDI_ICON1);
+ mainWindow.Show();
+ Button btn(L"Open grid demo", FALSE, 0, 0, 0, 0);
+ btn.SetHorizontalAligment(Stretch);
+ btn.SetVerticalAligment(Stretch);
+ mainWindow.AddComponent(&btn);
+ btn.SubscribeToOnClick(OpenGridExample);
+
+ /* window.MinSize.x = 500;
+ window.MinSize.y = 500;
+ window.MaxSize = window.MinSize;*/
+
+ MSG msg = {};
+
+ while (GetMessage(&msg, nullptr, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
}
- chkbox.SetChecked(1);
+ return static_cast(msg.wParam);
+}
+void InitializeGridDemoWindow()
+{
+ gridWindow = new Window(m_hInstance);
+ gridWindow->SubscribeToOnClose(WindowClose);
+ if (!gridWindow->Create(L"MUI Grid Demo", (DWORD)IDI_ICON1)) {
+ return;
+ }
std::vector comps =
{
&button,
@@ -63,41 +103,28 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine,
chkbox.SetVerticalAligment(Top);
chkbox.SetChecked(TRUE);
window.AddComponent(&lstView);*/
- grid.AddColumn(100, L"*");
- grid.AddColumn(150, L"Auto");
- grid.AddRow(100, L"*");
- grid.AddRow(150, L"Auto");
- lstView.SetHorizontalAligment(Stretch);
- lstView.SetVerticalAligment(Stretch);
- block.SetVerticalAligment(Center);
- chkbox.SetVerticalAligment(Center);
- grid.AddItem(&lstView, 1,1);
- grid.AddItem(&chkbox, 1, 2);
- grid.AddItem(&block, 1, 0);
- window.SetGrid(&grid);
- window.Show(SW_SHOW);
- //lstView.Hide();
- HICON ico = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
- lstView.AddIcon(ico);
+
+ gridWindow->SetGrid(&grid);
+
+ lstView.Clear();
+ HICON ico = LoadIcon(m_hInstance, MAKEINTRESOURCE(IDI_ICON1));
+ BOOL suc = lstView.AddIcon(ico);
lstView.AddColumn(L"Test", 100);
lstView.AddColumn(L"Test2", 100);
ListItem itm(0, std::vector {L"TEST1", L"TEST2"});
lstView.AddItem(&itm);
ListItem itm2(0, std::vector {L"TEST3", L"TEST4"});
lstView.AddItem(&itm2);
-
- /* window.MinSize.x = 500;
- window.MinSize.y = 500;
- window.MaxSize = window.MinSize;*/
-
- MSG msg = {};
-
- while (GetMessage(&msg, nullptr, 0, 0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
+}
+void OpenGridExample()
+{
+ if (!gridWindow || gridWindow->IsHidden())
+ {
+ InitializeGridDemoWindow();
+ gridWindow->Show();
}
-
- return static_cast(msg.wParam);
+ else
+ gridWindow->Activate();
}
void ButtonClick()
{
diff --git a/Test/main.h b/Demo/main.h
similarity index 100%
rename from Test/main.h
rename to Demo/main.h
diff --git a/Test/resource.h b/Demo/resource.h
similarity index 100%
rename from Test/resource.h
rename to Demo/resource.h
diff --git a/MUI.sln b/MUI.sln
index 8cea239..43ab81b 100644
--- a/MUI.sln
+++ b/MUI.sln
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.7.34221.43
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MUI", "MUI\MUI.vcxproj", "{4372496E-37CE-4388-B06E-855EE89FCCDA}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test\Test.vcxproj", "{E0AFC75E-90EC-4EEB-B3F7-29605A1EF545}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo\Demo.vcxproj", "{E0AFC75E-90EC-4EEB-B3F7-29605A1EF545}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/MUI/Grid.cpp b/MUI/Grid.cpp
index 0bb6e67..6aba7e1 100644
--- a/MUI/Grid.cpp
+++ b/MUI/Grid.cpp
@@ -3,8 +3,8 @@ namespace MUI
{
Grid::Grid()
{
- this->AddColumn(0, L"Auto");
- this->AddRow(0, L"Auto");
+ this->AddColumn(0, L"*");
+ this->AddRow(0, L"*");
}
std::vector Grid::GetComponents()
{
@@ -16,6 +16,12 @@ namespace MUI
}
void Grid::AddColumn(int x, const wchar_t* width)
{
+ if (!m_AddedCustomColumn && this->m_columns.size() > 0)
+ {
+ delete this->m_columns[0];
+ this->m_columns.erase(this->m_columns.begin());
+ m_AddedCustomColumn = TRUE;
+ }
GridColumn* col = new GridColumn();
col->x = x;
col->width = 0;
@@ -24,6 +30,12 @@ namespace MUI
}
void Grid::AddRow(int y, const wchar_t* height)
{
+ if (!m_AddedCustomRow && this->m_rows.size() > 0)
+ {
+ delete this->m_rows[0];
+ this->m_rows.erase(this->m_rows.begin());
+ m_AddedCustomRow = TRUE;
+ }
GridRow* row = new GridRow();
row->y = y;
row->height = 0;
@@ -34,7 +46,7 @@ namespace MUI
{
if (row == this->m_rows.size() || column == this->m_columns.size())
{
- OutputDebugString(L"Row index or column index is out of range");
+ OutputDebugString(L"Row index or column index is out of range\n");
return;
}
GridItem* itm = new GridItem();
@@ -58,56 +70,92 @@ namespace MUI
if (GetClientRect(windowHandle, &rect))
{
std::vector> starColumns;
- for (int i = 0; i < this->m_columns.size(); i++) {
+ std::vector> starRows;
+ int width = rect.right - rect.left;
+ int height = rect.bottom - rect.top;
+ int freeWidth = width;
+ int freeHeight = height;
+ for (int i = 0; i < this->m_columns.size(); i++)
+ {
GridColumn* o_column = this->m_columns[i];
-
if (o_column->text_width == L"Auto")
{
o_column->width = o_column->GetBiggestWidth();
- for (int j = i + 1; j < this->m_columns.size(); j++)
- this->m_columns[j]->x += o_column->width - clip((this->m_columns[j]->x - o_column->x),0);
+ if (i + 1 < this->m_columns.size())
+ this->m_columns[i + 1]->x = o_column->width + o_column->x;
+ freeWidth -= o_column->width;
}
- if (o_column->text_width == L"*") {
+ else if (o_column->text_width == L"*") {
starColumns.push_back(std::make_tuple(o_column, i));
- o_column->width = o_column->GetBiggestWidth();
+ }
+ else
+ {
+ if (std::wstring(o_column->text_width).find_first_not_of(L"0123456789") == std::string::npos) {
+ size_t widthLen = wcslen(o_column->text_width) * sizeof(wchar_t);
+ wchar_t* s = (wchar_t*)malloc(widthLen + 1);
+ wcscpy_s(s, widthLen , o_column->text_width);
+ s[widthLen + 1] = 0;
+ int lenInt = _wtoi(s);
+ o_column->width = lenInt;
+ if (i + 1 < this->m_columns.size())
+ this->m_columns[i + 1]->x = o_column->width + o_column->x;
+ freeWidth -= lenInt;
+ }
}
}
- for(std::tuple star : starColumns)
+ if (starColumns.size() > 0)
{
- GridColumn* o_column = std::get<0>(star);
- int othersWidth = 0;
- for (int j = std::get<1>(star) + 1; j < this->m_columns.size(); j++)
- othersWidth += this->m_columns[j]->width;
- o_column->width = rect.right - rect.left - o_column->x - othersWidth;
- for (int j = std::get<1>(star) + 1; j < this->m_columns.size(); j++)
- this->m_columns[j]->x += o_column->width;
+ int eachStarWidth = freeWidth / (int)starColumns.size();
+ for (int i = 0; i < starColumns.size(); i++)
+ {
+ std::tuple column = starColumns[i];
+ GridColumn* o_column = std::get<0>(column);
+ o_column->width = eachStarWidth;
+ size_t index = std::get<1>(column);
+ if (index + 1 < this->m_columns.size())
+ this->m_columns[index + 1]->x = o_column->width + o_column->x;
+ }
}
- std::vector> starRows;
for (int i = 0; i < this->m_rows.size(); i++) {
GridRow* o_row = this->m_rows[i];
if (o_row->text_height == L"Auto")
{
o_row->height = o_row->GetBiggestHeight();
- for (int j = i + 1; j < this->m_rows.size(); j++)
- this->m_rows[j]->y += o_row->height - clip((this->m_rows[j]->y - o_row->y),0);
+ if (i + 1 < this->m_rows.size())
+ this->m_rows[i + 1]->y = o_row->height + o_row->y;
+ freeHeight -= o_row->height;
}
if (o_row->text_height == L"*") {
starRows.push_back(std::make_tuple(o_row, i));
- o_row->height = o_row->GetBiggestHeight();
+ }
+ else
+ {
+ if (std::wstring(o_row->text_height).find_first_not_of(L"0123456789") == std::string::npos) {
+ size_t heightLen = wcslen(o_row->text_height) * sizeof(wchar_t);
+ wchar_t* s = (wchar_t*)malloc(heightLen + 1);
+ wcscpy_s(s, heightLen, o_row->text_height);
+ s[heightLen + 1] = 0;
+ int lenInt = _wtoi(s);
+ o_row->height = lenInt;
+ if (i + 1 < this->m_rows.size())
+ this->m_rows[i + 1]->y = o_row->height + o_row->y;
+ freeHeight -= lenInt;
+ }
}
}
- for (std::tuple star : starRows)
+ if (starRows.size() > 0)
{
- GridRow* o_row = std::get<0>(star);
- int othersHeight = 0;
- for (int j = std::get<1>(star) + 1; j < this->m_rows.size(); j++)
- othersHeight += this->m_rows[j]->height;
- o_row->height = rect.bottom - rect.top - o_row->y - othersHeight;
- for (int j = std::get<1>(star) + 1; j < this->m_rows.size(); j++)
- this->m_rows[j]->y += o_row->height;
+ int eachStarHeight = freeHeight / (int)starRows.size();
+ for (int i = 0; i < starRows.size(); i++)
+ {
+ std::tuple column = starRows[i];
+ GridRow* o_row = std::get<0>(column);
+ o_row->height = eachStarHeight;
+ size_t index = std::get<1>(column);
+ if (index + 1 < this->m_rows.size())
+ this->m_rows[index + 1]->y = o_row->height + o_row->y;
+ }
}
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
GridRow* row = this->m_rows[m_rows.size() - 1];
GridColumn* col = this->m_columns[m_columns.size() - 1];
if (row->text_height == L"*")
@@ -126,9 +174,9 @@ namespace MUI
UIComponent* comp = itm->component;
int width = max(o_column->width, 0);
int height = max(o_row->height, 0);
- for (size_t i = 0; i < itm->component->columnSpan && i < this->m_columns.size(); i++)
+ for (size_t i = 1; i < itm->component->columnSpan && i < this->m_columns.size(); i++)
width += this->m_columns[itm->column + i]->width;
- for (size_t i = 0; i < itm->component->rowSpan && i < this->m_rows.size(); i++)
+ for (size_t i = 1; i < itm->component->rowSpan && i < this->m_rows.size(); i++)
height += this->m_rows[itm->row + i]->height;
comp->x = o_column->x;
comp->y = o_row->y;
diff --git a/MUI/ListView.cpp b/MUI/ListView.cpp
index 53db5e3..789265f 100644
--- a/MUI/ListView.cpp
+++ b/MUI/ListView.cpp
@@ -26,6 +26,12 @@ namespace MUI
{
ImageList_RemoveAll(this->hLarge);
ImageList_RemoveAll(this->hSmall);
+ this->hLarge = ImageList_Create(32,
+ 32,
+ ILC_COLOR32, 3, 0);
+ this->hSmall = ImageList_Create(32,
+ 32,
+ ILC_COLOR32, 3, 0);
}
void ListView::DeleteIconAt(int i)
{
@@ -44,6 +50,18 @@ namespace MUI
this->m_Items.erase(this->m_Items.begin(), this->m_Items.end());
this->itemIndex = 0;
}
+ void ListView::ClearColumns()
+ {
+ for (size_t i = 0; i < this->columnIndex; i++)
+ ListView_DeleteColumn(this->handle, i);
+ this->columnIndex = 0;
+ }
+ void ListView::Clear()
+ {
+ this->ClearColumns();
+ this->ClearIcons();
+ this->ClearItems();
+ }
int ListView::GetSelectedIndex()
{
return ListView_GetNextItem(this->handle, -1, LVNI_SELECTED);
diff --git a/MUI/MUI.h b/MUI/MUI.h
index 9978019..143646c 100644
--- a/MUI/MUI.h
+++ b/MUI/MUI.h
@@ -15,6 +15,7 @@
#pragma region CONFIG
#define NEW_STYLE 1
#define HIDE_ON_CLOSE 0
+#define USE_MULTIPLE_WINDOW_ICONS 0
#pragma endregion
#pragma region INTERNAL
#if NEW_STYLE
@@ -209,6 +210,8 @@ namespace MUI {
std::vector m_rows;
std::vector m_columns;
std::vector m_items;
+ BOOL m_AddedCustomRow = FALSE;
+ BOOL m_AddedCustomColumn = FALSE;
};
/*
Class declarations of each UIComponent
@@ -247,8 +250,10 @@ namespace MUI {
int FreeItemIndex() { return this->itemIndex; }
void DeleteIconAt(int i);
void ClearIcons();
+ void ClearColumns();
void DeleteItemAt(int i);
void ClearItems();
+ void Clear();
private:
std::vector m_Items;
UINT columnIndex;
@@ -327,7 +332,6 @@ namespace MUI {
void SetGrid(Grid* grid);
void ToggleGrid() { this->b_useGrid = !this->b_useGrid; }
void AddComponents(std::vector comps);
- void Show(int cmdShow);
void SubscribeToOnClose(void* func) { this->onClose = func; }
COLORREF m_StaticBacgkround = NULL;
COLORREF m_StaticTextColor = NULL;
@@ -339,6 +343,8 @@ namespace MUI {
COLORREF m_ButtonTextColor = NULL;
void SetBackroundColor(COLORREF color);
BOOL Activate();
+ void HideAll();
+ void ShowAll();
void Show();
void Hide();
BOOL IsHidden() { return !IsWindowVisible(m_hWnd); }
@@ -350,9 +356,12 @@ namespace MUI {
void RepositionComponents();
void* onClose = NULL;
BOOL b_useGrid = FALSE;
+ const wchar_t* m_title;
+ int m_width, m_height;
+ DWORD m_iconId;
Grid* m_grid = NULL;
std::unordered_map m_Assets;
- UINT m_Index = 0;
+ UINT m_Index = 1;
std::vector m_UnusedIndexes;
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND m_hWnd = NULL;
@@ -368,5 +377,7 @@ namespace MUI {
LRESULT OnColorButton(WPARAM wParam);
LRESULT OnDraw(WPARAM wParam, LPARAM lParam);
void OnCreate();
+ BOOL m_Destroyed = FALSE;
+ static int m_Windows;
};
}
\ No newline at end of file
diff --git a/MUI/RadioGroup.cpp b/MUI/RadioGroup.cpp
index b1f1888..051dca3 100644
--- a/MUI/RadioGroup.cpp
+++ b/MUI/RadioGroup.cpp
@@ -24,7 +24,7 @@ namespace MUI
}
int RadioGroup::CurrentRadioButton()
{
- for (size_t i = 0; i < this->m_Buttons.size(); i++)
+ for (int i = 0; i < this->m_Buttons.size(); i++)
{
if (IsDlgButtonChecked(this->windowHandle, this->m_Buttons[i]->id))
return i;
diff --git a/MUI/Window.cpp b/MUI/Window.cpp
index e2852dd..6d91da0 100644
--- a/MUI/Window.cpp
+++ b/MUI/Window.cpp
@@ -4,6 +4,7 @@ typedef void (*func_type)(void);
namespace MUI
{
+ int Window::m_Windows = 0;
Window::Window(HINSTANCE hInstance) : m_hWnd(NULL), m_hInstance(hInstance) {}
Window::~Window()
{
@@ -18,10 +19,6 @@ namespace MUI
{
this->m_hBrushBackground = CreateSolidBrush(color);
}
- void Window::Show(int cmdShow) {
- ShowWindow(this->m_hWnd, cmdShow);
- UpdateWindow(this->m_hWnd);
- }
BOOL Window::Activate()
{
SetForegroundWindow(this->m_hWnd);
@@ -35,23 +32,47 @@ namespace MUI
}
BOOL Window::Create(const wchar_t* title, int width, int height,DWORD iconId)
{
- this->v_RegisterClass(WINDOW_CLASS,iconId);
+ m_title = title;
+ m_height = height;
+ m_width = width;
+ m_iconId = iconId;
+#if USE_MULTIPLE_WINDOW_ICONS
+ std::wstring className = std::wstring(WINDOW_CLASS).append(std::to_wstring(m_Windows));
+#else
+ std::wstring className = std::wstring(WINDOW_CLASS);
+#endif
+ this->v_RegisterClass(className.c_str(), m_iconId);
this->m_hWnd = CreateWindowEx
(
0,
- WINDOW_CLASS,
- title,
+ className.c_str(),
+ m_title,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
- width,
- height,
+ m_width,
+ m_height,
NULL,
NULL,
this->m_hInstance,
this
);
+ m_Windows += 1;
+ m_Destroyed = FALSE;
+ /*
+ * Menu bar creation example
+ HMENU hMenubar = CreateMenu();
+ HMENU hMenu = CreateMenu();
+
+ AppendMenuW(hMenu, MF_STRING, 2222, L"&New");
+ AppendMenuW(hMenu, MF_STRING, 222222, L"&Open");
+ AppendMenuW(hMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenuW(hMenu, MF_STRING, 222222, L"&Quit");
+ AppendMenuW(hMenubar, MF_POPUP, (UINT_PTR)hMenu, L"&File");
+ SetMenu(m_hWnd, hMenubar);
+ DrawMenuBar(m_hWnd);
+ */
#ifdef DEBUG
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
#endif // DEBUG
@@ -63,12 +84,26 @@ namespace MUI
}
void Window::Show()
{
+ if (m_Destroyed) {
+ OutputDebugString(L"Window was destroyed\n");
+ return;
+ }
ShowWindow(this->m_hWnd, SW_SHOW);
}
void Window::Hide()
{
ShowWindow(this->m_hWnd, SW_HIDE);
}
+ void Window::HideAll()
+ {
+ for (size_t i = 1; i < m_Index; i++)
+ m_Assets[i]->Hide();
+ }
+ void Window::ShowAll()
+ {
+ for (size_t i = 1; i < m_Index; i++)
+ m_Assets[i]->Show();
+ }
void Window::SetGrid(Grid* grid)
{
this->m_grid = grid;
@@ -204,11 +239,22 @@ namespace MUI
for (GridItem* itm : window->m_grid->GetItems())
window->m_grid->Reposition(itm);
}
+ else
+ {
+ RECT rect;
+ if (GetClientRect(window->m_hWnd, &rect))
+ {
+ for (size_t i = 1; i < window->m_Index; i++)
+ window->m_Assets[i]->reposition(
+ rect.bottom - rect.top,
+ rect.right - rect.left);
+ }
+ }
break;
}
case WM_CLOSE:
{
- if (window->onClose)
+ if (window->onClose)
((func_type)window->onClose)();
#ifdef DEBUG
GdiplusShutdown(window->gdiplusToken);
@@ -308,9 +354,11 @@ namespace MUI
DeleteObject(this->m_hBrushBackground);
this->m_Assets.erase(this->m_Assets.begin(), this->m_Assets.end());
this->m_UnusedIndexes.erase(this->m_UnusedIndexes.begin(), this->m_UnusedIndexes.end());
- DeleteObject(&(this->m_Index));
-
- PostQuitMessage(0);
+ m_Index = 1;
+ m_Windows--;
+ m_Destroyed = TRUE;
+ if (m_Windows <= 0)
+ PostQuitMessage(0);
}
void Window::OnCreate()
{
diff --git a/README.md b/README.md
index 3c78309..865c146 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
* Components list:
* Button
* CheckBox
- * Grid (you have to explicitly set the grid by using `window->SetGrid(&grid)` as in the test project, grid currently is very experimental and will probably change overtime)
+ * Grid (you have to explicitly set the grid by using `window->SetGrid(&grid)` as in the demo project)
* Image
* ListView
* RadioGroup
@@ -22,7 +22,7 @@
* TextBox
* Custom coloring of each component type(works best with `#define NEW_STYLE 0` )
## Demo project
-*You can find a demo project inside the `Test` folder, this project is where i test new features and additions*
+*You can find a demo project inside the `Demo` folder, this project is where i test new features and additions*
![demo-image](example.png)