Skip to content

Commit ae3e058

Browse files
committed
[general]
updated EnumConcepts to v1.2 bumped rev [dcxdock] updated some exceptions. [xpopup] changed about the code in DrawItemCheckBox() abit. [button][calender][datetime] removed some commented code.
1 parent 781a3aa commit ae3e058

File tree

11 files changed

+107
-64
lines changed

11 files changed

+107
-64
lines changed

Classes/UltraDock/dcxDockCommands.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ mIRC(xdock)
332332

333333
// check if at least 2 parameters
334334
if (numtok < 2)
335-
throw Dcx::dcxException("Invalid Flag");
335+
//throw Dcx::dcxException("Invalid Flag");
336+
throw DcxExceptions::dcxInvalidFlag();
336337

337338
const auto dockHwnd = reinterpret_cast<HWND>(input.getnexttok().to_<DWORD>()); // tok 2
338339

@@ -396,7 +397,8 @@ mIRC(xdock)
396397
const auto flags(input.getnexttok()); // tok 3
397398

398399
if ((numtok > 2) && (flags[0] != TEXT('+')))
399-
throw Dcx::dcxException("Invalid flag format");
400+
//throw Dcx::dcxException("Invalid flag format");
401+
throw DcxExceptions::dcxInvalidFlag();
400402

401403
// dock to toolbar
402404
// [-t] [hwnd to dock] [+options]
@@ -417,7 +419,8 @@ mIRC(xdock)
417419
mWnd = reinterpret_cast<HWND>(input.getnexttok().to_<DWORD>()); // tok 4
418420

419421
if (!IsWindow(mWnd))
420-
throw Dcx::dcxException("Invalid window");
422+
//throw Dcx::dcxException("Invalid window");
423+
throw DcxExceptions::dcxInvalidArguments();
421424

422425
DockWindow(mWnd, dockHwnd, TEXT("ListBox"), flags);
423426
}
@@ -428,8 +431,9 @@ mIRC(xdock)
428431
mWnd = reinterpret_cast<HWND>(input.getnexttok().to_<DWORD>()); // tok 4
429432

430433
if (!IsWindow(mWnd))
431-
throw Dcx::dcxException("Invalid window");
432-
434+
//throw Dcx::dcxException("Invalid window");
435+
throw DcxExceptions::dcxInvalidArguments();
436+
433437
DockWindow(mWnd, dockHwnd, nullptr, flags);
434438
}
435439
// dock to treelist
@@ -477,7 +481,9 @@ mIRC(xdock)
477481
dflags = Dcx::dcxGetProp<DockFlags>(dockHwnd, TEXT("dcx_docked"));
478482

479483
if (dflags == DockFlags::DOCKF_NONE) // not any dock.
480-
throw Dcx::dcxException("Unable to find flags information.");
484+
//throw Dcx::dcxException("Unable to find flags information.");
485+
throw DcxExceptions::dcxInvalidFlag();
486+
481487
#if DCX_USE_WRAPPERS
482488
Dcx::dcxWindowRect rc(dockHwnd);
483489
#else
@@ -512,7 +518,8 @@ mIRC(xdock)
512518
throw Dcx::dcxException("Can't resize an auto width & height dialog");
513519

514520
default:
515-
throw Dcx::dcxException("Unknown dock flag");
521+
//throw Dcx::dcxException("Unknown dock flag");
522+
throw DcxExceptions::dcxInvalidFlag();
516523
}
517524

518525
// x & y handled by mIRC update, only change width & height.

Classes/dcxbutton.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ DcxButton::DcxButton(const UINT ID, DcxDialog* const p_Dialog, const HWND mParen
4040
this);
4141

4242
if (!IsWindow(m_Hwnd))
43-
//throw Dcx::dcxException("Unable To Create Window");
4443
throw DcxExceptions::dcxUnableToCreateWindow();
4544

4645
if (ws.m_NoTheme)
4746
Dcx::UXModule.dcxSetWindowTheme(m_Hwnd, L" ", L" ");
4847

49-
//setNoThemed((ws.m_NoTheme != false));
5048
setNoThemed(ws.m_NoTheme);
5149

5250
m_aColors[0] = GetSysColor(COLOR_BTNTEXT); // normal

Classes/dcxcalendar.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ DcxCalendar::DcxCalendar(const UINT ID, DcxDialog* const p_Dialog, const HWND mP
4949
this);
5050

5151
if (!IsWindow(m_Hwnd))
52-
//throw Dcx::dcxException("Unable To Create Window");
5352
throw DcxExceptions::dcxUnableToCreateWindow();
5453

5554
if (ws.m_NoTheme)

Classes/dcxcontrol.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,14 @@ const DcxColourFlags DcxControl::parseColorFlags(const TString& flags) noexcept
750750
if (xflags[TEXT('G')])
751751
iFlags |= DcxColourFlags::GRADENDCOLOR;
752752

753+
// for checkboxes
754+
if (xflags[TEXT('c')])
755+
iFlags |= DcxColourFlags::CHECKBOXBGCOLOR;
756+
if (xflags[TEXT('f')])
757+
iFlags |= DcxColourFlags::CHECKBOXFRAMECOLOR;
758+
if (xflags[TEXT('C')])
759+
iFlags |= DcxColourFlags::CHECKBOXTICKCOLOR;
760+
753761
return iFlags;
754762
}
755763

@@ -2724,7 +2732,7 @@ void DcxControl::InitializeDcxControls()
27242732
dcxRegisterClass<DcxReBar>(REBARCLASSNAME, DCX_REBARCTRLCLASS);
27252733

27262734
// Custom Color Combo
2727-
DCX_DEBUG(mIRCLinker::debug, __FUNCTIONW__, TEXT("Registering ComboBox..."));
2735+
DCX_DEBUG(mIRCLinker::debug, __FUNCTIONW__, TEXT("Registering ColorCombo..."));
27282736
dcxRegisterClass<DcxColorCombo>(WC_COMBOBOX, DCX_COLORCOMBOCLASS);
27292737

27302738
// Custom TabCtrl

Classes/dcxcontrol.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@
3333
enum class DcxColourFlags
3434
: UINT
3535
{
36-
None,
37-
TEXTCOLOR, //!< Control Text Color;
38-
TEXTBKGCOLOR, //!< Control Text Background Color;
39-
BKGCOLOR = 0x04, //!< Control Background Color;
40-
BORDERCOLOR = 0x08, //!< Control Border Color;
41-
GRADSTARTCOLOR = 0x10, //!< Colour At the start of the gradient;
42-
GRADENDCOLOR = 0x20 //!< Colour At the end of the gradient;
36+
None, // No styles
37+
TEXTCOLOR, //!< Control Text Color;
38+
TEXTBKGCOLOR, //!< Control Text Background Color;
39+
BKGCOLOR = 0x0004, //!< Control Background Color;
40+
BORDERCOLOR = 0x0008, //!< Control Border Color;
41+
GRADSTARTCOLOR = 0x0010, //!< Colour At the start of the gradient;
42+
GRADENDCOLOR = 0x0020, //!< Colour At the end of the gradient;
43+
CHECKBOXFRAMECOLOR = 0x0040, // Checkbox frame colour
44+
CHECKBOXBGCOLOR = 0x0080, // CheckBox Background colour
45+
CHECKBOXTICKCOLOR = 0x0100 // CheckBox Tick colour
4346
};
4447

4548
//#define CTLF_ALLOW_PBAR 0x0000000000000001ULL

Classes/dcxdatetime.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ DcxDateTime::DcxDateTime(const UINT ID, DcxDialog *const p_Dialog, const HWND mP
4242
this);
4343

4444
if (!IsWindow(m_Hwnd))
45-
//throw Dcx::dcxException("Unable To Create Window");
4645
throw DcxExceptions::dcxUnableToCreateWindow();
4746

4847
if (ws.m_NoTheme)

Classes/dcxtoolbar.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ enum class dcxToolBar_ImageLists
2828
TB_IML_HOT = 0x04, //!< Toolbar HotTrack ImageList
2929
TB_ICO_GREY = 0x08 //!< ???
3030
};
31-
template <typename T>
32-
constexpr dcxToolBar_ImageLists& operator |=(dcxToolBar_ImageLists& eStyle, const T& dStyle) noexcept
33-
{
34-
return eStyle = static_cast<dcxToolBar_ImageLists>(static_cast<DWORD>(eStyle) | static_cast<DWORD>(dStyle));
35-
}
31+
//template <typename T>
32+
//constexpr dcxToolBar_ImageLists& operator |=(dcxToolBar_ImageLists& eStyle, const T& dStyle) noexcept
33+
//{
34+
// return eStyle = static_cast<dcxToolBar_ImageLists>(static_cast<DWORD>(eStyle) | static_cast<DWORD>(dStyle));
35+
//}
3636
template <typename T>
3737
constexpr T& operator |=(T& eStyle, const dcxToolBar_ImageLists& dStyle) noexcept
3838
{
@@ -54,11 +54,11 @@ enum class dcxToolBar_Styles
5454
BTNS_HIGHLIGHT_BTNCOLOR = 0x00200000, //!< Toolbar Buttons colour when highlighted.
5555
BTNS_HOTTRACK_BTNCOLOR = 0x00400000 //!< Toolbar Buttons colour when hot.
5656
};
57-
template <typename T>
58-
constexpr dcxToolBar_Styles& operator |=(dcxToolBar_Styles& eStyle, const T& dStyle) noexcept
59-
{
60-
return eStyle = static_cast<dcxToolBar_Styles>(static_cast<DWORD>(eStyle) | static_cast<DWORD>(dStyle));
61-
}
57+
//template <typename T>
58+
//constexpr dcxToolBar_Styles& operator |=(dcxToolBar_Styles& eStyle, const T& dStyle) noexcept
59+
//{
60+
// return eStyle = static_cast<dcxToolBar_Styles>(static_cast<DWORD>(eStyle) | static_cast<DWORD>(dStyle));
61+
//}
6262
template <typename T>
6363
constexpr T& operator |=(T& eStyle, const dcxToolBar_Styles& dStyle) noexcept
6464
{

Classes/xpopup/xpopupmenuitem.cpp

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -505,41 +505,45 @@ void XPopupMenuItem::DrawItemCheckBox(const LPDRAWITEMSTRUCT lpdis, const XPMENU
505505
if ((!hBrush) || (!hPenBorder) || (!hPenText))
506506
return;
507507

508-
const auto hOldBrush = SelectObject(lpdis->hDC, hBrush);
509-
Auto(SelectObject(lpdis->hDC, hOldBrush));
510-
511-
const auto hOldPen = SelectObject(lpdis->hDC, hPenBorder);
512-
Auto(SelectObject(lpdis->hDC, hOldPen));
513-
514508
RECT rc = lpdis->rcItem;
515509

516-
InflateRect(&rc, 0, -1);
517-
rc.left += 1;
518-
rc.right = rc.left + rc.bottom - rc.top;
510+
const auto hOldBrush = SelectObject(lpdis->hDC, hBrush);
511+
Auto(SelectObject(lpdis->hDC, hOldBrush));
519512

520-
//RoundRect( lpdis->hDC, rc.left, rc.top, rc.right, rc.bottom, 5, 5 );
521-
Rectangle(lpdis->hDC, rc.left, rc.top, rc.right, rc.bottom);
513+
{
514+
/*const auto hOldPen =*/ SelectObject(lpdis->hDC, hPenBorder);
515+
//Auto(SelectObject(lpdis->hDC, hOldPen));
522516

523-
const auto hOldPenTxt = SelectObject(lpdis->hDC, hPenText);
524-
Auto(SelectObject(lpdis->hDC, hOldPenTxt));
517+
InflateRect(&rc, 0, -1);
518+
rc.left += 1;
519+
rc.right = rc.left + rc.bottom - rc.top;
525520

526-
const auto x = (rc.right + rc.left) / 2 - 3;
527-
const auto y = (rc.bottom + rc.top) / 2 - 3;
521+
//RoundRect( lpdis->hDC, rc.left, rc.top, rc.right, rc.bottom, 5, 5 );
522+
Rectangle(lpdis->hDC, rc.left, rc.top, rc.right, rc.bottom);
523+
}
528524

529-
MoveToEx(lpdis->hDC, x, y + 2, nullptr);
530-
LineTo(lpdis->hDC, x, y + 5);
531-
MoveToEx(lpdis->hDC, x + 1, y + 3, nullptr);
532-
LineTo(lpdis->hDC, x + 1, y + 6);
533-
MoveToEx(lpdis->hDC, x + 2, y + 4, nullptr);
534-
LineTo(lpdis->hDC, x + 2, y + 7);
535-
MoveToEx(lpdis->hDC, x + 3, y + 3, nullptr);
536-
LineTo(lpdis->hDC, x + 3, y + 6);
537-
MoveToEx(lpdis->hDC, x + 4, y + 2, nullptr);
538-
LineTo(lpdis->hDC, x + 4, y + 5);
539-
MoveToEx(lpdis->hDC, x + 5, y + 1, nullptr);
540-
LineTo(lpdis->hDC, x + 5, y + 4);
541-
MoveToEx(lpdis->hDC, x + 6, y, nullptr);
542-
LineTo(lpdis->hDC, x + 6, y + 3);
525+
{
526+
const auto hOldPenTxt = SelectObject(lpdis->hDC, hPenText);
527+
Auto(SelectObject(lpdis->hDC, hOldPenTxt));
528+
529+
const auto x = (rc.right + rc.left) / 2 - 3;
530+
const auto y = (rc.bottom + rc.top) / 2 - 3;
531+
532+
MoveToEx(lpdis->hDC, x, y + 2, nullptr);
533+
LineTo(lpdis->hDC, x, y + 5);
534+
MoveToEx(lpdis->hDC, x + 1, y + 3, nullptr);
535+
LineTo(lpdis->hDC, x + 1, y + 6);
536+
MoveToEx(lpdis->hDC, x + 2, y + 4, nullptr);
537+
LineTo(lpdis->hDC, x + 2, y + 7);
538+
MoveToEx(lpdis->hDC, x + 3, y + 3, nullptr);
539+
LineTo(lpdis->hDC, x + 3, y + 6);
540+
MoveToEx(lpdis->hDC, x + 4, y + 2, nullptr);
541+
LineTo(lpdis->hDC, x + 4, y + 5);
542+
MoveToEx(lpdis->hDC, x + 5, y + 1, nullptr);
543+
LineTo(lpdis->hDC, x + 5, y + 4);
544+
MoveToEx(lpdis->hDC, x + 6, y, nullptr);
545+
LineTo(lpdis->hDC, x + 6, y + 3);
546+
}
543547
}
544548

545549
/*!

EnumConcepts.h

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
#pragma once
22

3-
// v1.1 By Ook
3+
// v1.2 By Ook
44
//
55

66
#include <concepts>
77
#include <gsl/gsl>
88

99
namespace EnumConcepts
1010
{
11+
template <class T>
12+
concept IsEnum = std::is_enum_v<T>;
13+
1114
template<class _Ty>
1215
struct is_Numeric
1316
: std::integral_constant<bool,
1417
(std::is_arithmetic_v<_Ty> || std::is_same_v<_Ty, std::byte> || std::is_enum_v<_Ty>)
1518
&& !std::is_same_v<_Ty, wchar_t>
1619
&& !std::is_same_v<_Ty, char>
1720
&& !std::is_pointer_v<_Ty>
21+
//&& !std::is_enum_v<_Ty>
1822
>
1923
{
2024
};
@@ -23,13 +27,20 @@ namespace EnumConcepts
2327
template <typename T>
2428
constexpr bool is_Numeric_v = is_Numeric<T>::value;
2529

26-
template <class T>
27-
concept IsEnum = std::is_enum_v<T>;
28-
2930
template <class T>
3031
concept IsNumeric = is_Numeric_v<T>;
3132
}
3233

34+
//template <EnumConcepts::IsEnum E>
35+
//constexpr E& operator |=(E& eStyle, const E& dStyle) noexcept
36+
//{
37+
// if constexpr (sizeof(E) <= sizeof(size_t))
38+
// eStyle = static_cast<E>(static_cast<size_t>(eStyle) | static_cast<size_t>(dStyle));
39+
// else
40+
// eStyle = static_cast<E>(static_cast<uint64_t>(eStyle) | static_cast<uint64_t>(dStyle));
41+
// return eStyle;
42+
//}
43+
3344
template <EnumConcepts::IsNumeric T, EnumConcepts::IsEnum E>
3445
constexpr E& operator |=(E& eStyle, const T& dStyle) noexcept
3546
{
@@ -40,6 +51,20 @@ constexpr E& operator |=(E& eStyle, const T& dStyle) noexcept
4051
return eStyle;
4152
}
4253

54+
//template <EnumConcepts::IsNumeric T, EnumConcepts::IsEnum E>
55+
//constexpr T& operator |=(T& dStyle, const E& eStyle) noexcept
56+
//{
57+
// //if constexpr (sizeof(E) <= sizeof(size_t) && sizeof(T) <= sizeof(size_t))
58+
// // dStyle = static_cast<T>(static_cast<size_t>(eStyle) | static_cast<size_t>(dStyle));
59+
// //else
60+
// // dStyle = static_cast<T>(static_cast<uint64_t>(eStyle) | static_cast<uint64_t>(dStyle));
61+
// //return dStyle;
62+
//
63+
// dStyle |= static_cast<T>(eStyle);
64+
//
65+
// return dStyle;
66+
//}
67+
4368
template <EnumConcepts::IsNumeric T, EnumConcepts::IsEnum E>
4469
constexpr E operator |(const E& eStyle, const T& dStyle) noexcept
4570
{

dcx.rc

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)