mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-12-11 18:48:14 +00:00
[idd] helper: add basic group box around mode config
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "CConfigWindow.h"
|
#include "CConfigWindow.h"
|
||||||
#include "CListBox.h"
|
#include "CListBox.h"
|
||||||
|
#include "CGroupBox.h"
|
||||||
#include <CDebug.h>
|
#include <CDebug.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
@@ -28,7 +29,7 @@ CConfigWindow::CConfigWindow() : m_scale(1)
|
|||||||
m_modes = m_settings.getModes();
|
m_modes = m_settings.getModes();
|
||||||
|
|
||||||
if (!CreateWindowEx(0, MAKEINTATOM(s_atom), L"Looking Glass IDD Configuration",
|
if (!CreateWindowEx(0, MAKEINTATOM(s_atom), L"Looking Glass IDD Configuration",
|
||||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, 500, 400,
|
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 400,
|
||||||
NULL, NULL, hInstance, this))
|
NULL, NULL, hInstance, this))
|
||||||
{
|
{
|
||||||
DEBUG_ERROR_HR(GetLastError(), "Failed to create window");
|
DEBUG_ERROR_HR(GetLastError(), "Failed to create window");
|
||||||
@@ -52,7 +53,7 @@ void CConfigWindow::updateFont()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (HWND child : std::initializer_list<HWND>({ *m_version, *m_modeBox }))
|
for (HWND child : std::initializer_list<HWND>({ *m_version, *m_modeGroup, *m_modeBox }))
|
||||||
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
|
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +84,8 @@ LRESULT CConfigWindow::onCreate()
|
|||||||
m_scale = GetDpiForWindow(m_hwnd) / 96.0;
|
m_scale = GetDpiForWindow(m_hwnd) / 96.0;
|
||||||
m_version.reset(new CStaticWidget(L"Looking Glass IDD " LG_VERSION_STR, WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
|
m_version.reset(new CStaticWidget(L"Looking Glass IDD " LG_VERSION_STR, WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
|
||||||
|
|
||||||
|
m_modeGroup.reset(new CGroupBox(L"Custom modes", WS_CHILD | WS_VISIBLE, m_hwnd));
|
||||||
|
|
||||||
m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | LBS_NOTIFY, m_hwnd));
|
m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | LBS_NOTIFY, m_hwnd));
|
||||||
if (m_modes)
|
if (m_modes)
|
||||||
{
|
{
|
||||||
@@ -106,6 +109,7 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
|
|||||||
{
|
{
|
||||||
WidgetPositioner pos(m_scale, width, height);
|
WidgetPositioner pos(m_scale, width, height);
|
||||||
pos.pinTopLeftRight(*m_version, 12, 12, 12, 20);
|
pos.pinTopLeftRight(*m_version, 12, 12, 12, 20);
|
||||||
pos.pinLeftTopBottom(*m_modeBox, 12, 40, 200, 12);
|
pos.pinLeftTopBottom(*m_modeGroup, 12, 40, 200, 12);
|
||||||
|
pos.pinLeftTopBottom(*m_modeBox, 24, 64, 176, 24);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,14 @@
|
|||||||
#include "UIHelpers.h"
|
#include "UIHelpers.h"
|
||||||
|
|
||||||
class CListBox;
|
class CListBox;
|
||||||
|
class CGroupBox;
|
||||||
|
|
||||||
class CConfigWindow : public CWindow
|
class CConfigWindow : public CWindow
|
||||||
{
|
{
|
||||||
static ATOM s_atom;
|
static ATOM s_atom;
|
||||||
|
|
||||||
std::unique_ptr<CStaticWidget> m_version;
|
std::unique_ptr<CStaticWidget> m_version;
|
||||||
|
std::unique_ptr<CGroupBox> m_modeGroup;
|
||||||
std::unique_ptr<CListBox> m_modeBox;
|
std::unique_ptr<CListBox> m_modeBox;
|
||||||
|
|
||||||
std::function<void()> m_onDestroy;
|
std::function<void()> m_onDestroy;
|
||||||
|
|||||||
10
idd/LGIddHelper/CGroupBox.cpp
Normal file
10
idd/LGIddHelper/CGroupBox.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "CGroupBox.h"
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <CDebug.h>
|
||||||
|
|
||||||
|
CGroupBox::CGroupBox(LPCWSTR title, DWORD style, HWND parent)
|
||||||
|
{
|
||||||
|
m_hwnd = createWindowSimple(WC_BUTTON, title, style | BS_GROUPBOX, parent);
|
||||||
|
if (!m_hwnd)
|
||||||
|
DEBUG_ERROR_HR(GetLastError(), "Failed to create static widget");
|
||||||
|
}
|
||||||
9
idd/LGIddHelper/CGroupBox.h
Normal file
9
idd/LGIddHelper/CGroupBox.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CWidget.h"
|
||||||
|
|
||||||
|
class CGroupBox : public CWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CGroupBox(LPCWSTR title, DWORD style, HWND parent);
|
||||||
|
};
|
||||||
@@ -180,6 +180,7 @@ copy /Y "$(ProjectDir)VERSION" "$(SolutionDir)$(Platform)\$(Configuration)\LGIdd
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="$(SolutionDir)LGCommon\*.cpp" />
|
<ClCompile Include="$(SolutionDir)LGCommon\*.cpp" />
|
||||||
<ClCompile Include="CConfigWindow.cpp" />
|
<ClCompile Include="CConfigWindow.cpp" />
|
||||||
|
<ClCompile Include="CGroupBox.cpp" />
|
||||||
<ClCompile Include="CListBox.cpp" />
|
<ClCompile Include="CListBox.cpp" />
|
||||||
<ClCompile Include="CNotifyWindow.cpp" />
|
<ClCompile Include="CNotifyWindow.cpp" />
|
||||||
<ClCompile Include="CPipeClient.cpp" />
|
<ClCompile Include="CPipeClient.cpp" />
|
||||||
@@ -193,6 +194,7 @@ copy /Y "$(ProjectDir)VERSION" "$(SolutionDir)$(Platform)\$(Configuration)\LGIdd
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CLInclude Include="$(SolutionDir)LGCommon\*.h" />
|
<CLInclude Include="$(SolutionDir)LGCommon\*.h" />
|
||||||
<ClInclude Include="CConfigWindow.h" />
|
<ClInclude Include="CConfigWindow.h" />
|
||||||
|
<ClInclude Include="CGroupBox.h" />
|
||||||
<ClInclude Include="CListBox.h" />
|
<ClInclude Include="CListBox.h" />
|
||||||
<ClInclude Include="CNotifyWindow.h" />
|
<ClInclude Include="CNotifyWindow.h" />
|
||||||
<ClInclude Include="CPipeClient.h" />
|
<ClInclude Include="CPipeClient.h" />
|
||||||
|
|||||||
@@ -49,6 +49,10 @@
|
|||||||
<ClCompile Include="UIHelpers.cpp">
|
<ClCompile Include="UIHelpers.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="$(SolutionDir)LGCommon\*.cpp" />
|
||||||
|
<ClCompile Include="CGroupBox.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CLInclude Include="$(SolutionDir)LGCommon\*.h" />
|
<CLInclude Include="$(SolutionDir)LGCommon\*.h" />
|
||||||
@@ -85,6 +89,11 @@
|
|||||||
<ClInclude Include="CListBox.h">
|
<ClInclude Include="CListBox.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<CLInclude Include="$(SolutionDir)LGCommon\*.h" />
|
||||||
|
<CLInclude Include="$(SolutionDir)LGCommon\*.h" />
|
||||||
|
<ClInclude Include="CGroupBox.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
|||||||
Reference in New Issue
Block a user