This color picker is a GDImage control, we could add an extra button,
I have to check the code you are using with the native Windows control, to better figure what to do
So far i did this (search
for if (ShowColorPick) { )
#define IDT_COLORPICK 59999 // PAT: 12-20-2018
HWND CreateToolWindow(IN long ShowColorPick = 0) {
if (!IsWindow(gP.hTool)) {
HWND hCtrl = NULL, hWnd = NULL;
WNDCLASSEX wcx = { 0 };
WCHAR zClass[MAX_PATH]; ClearMemory(zClass, sizeof(zClass));
wcscopy(zClass, L"ZTOOLW");
wcx.cbSize = sizeof(wcx);
long IsInitialized = GetClassInfoEx(gP.hInstance, zClass, &wcx);
if (!IsInitialized) {
wcx.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
wcx.lpfnWndProc = ToolProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = gP.hInstance;
wcx.hIcon = LoadIcon(wcx.hInstance, L"PROGRAM");
wcx.hCursor = LoadCursor(NULL, IDC_ARROW);
wcx.hbrBackground = NULL;
wcx.lpszMenuName = NULL;
wcx.lpszClassName = zClass;
wcx.hIconSm = wcx.hIcon;
if (RegisterClassEx(&wcx)) { IsInitialized = TRUE; }
}
if (IsInitialized) {
DWORD dwStyle = WS_POPUP | WS_CAPTION; // | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
DWORD dwExStyle = WS_EX_TOOLWINDOW;
hWnd = CreateControl(dwExStyle, zClass, L"Controls", dwStyle, 0, -1000, ToolW, ToolH, gP.hMain, 0, gP.hInstance, 0);
if (IsWindow(hWnd)) {
Path_Combine(zClass, skSkinFolder(), L"DLG_Info.png");
skStaticImage(hWnd, zClass, 6, 6, 366, 196, 777);
wcscopy(zClass, L"button"); dwStyle = WS_CHILD | BS_AUTOCHECKBOX;
hCtrl = CreateControl(0, zClass, L"", dwStyle, 42, 50, 16, 16, hWnd, IDT_CHECK01, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"", dwStyle, 42, 96, 16, 16, hWnd, IDT_CHECK02, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"", dwStyle, 42, 142, 16, 16, hWnd, IDT_CHECK03, gP.hInstance, 0);
WCHAR zFont[MAX_PATH]; ClearMemory(zFont, sizeof(zFont));
Path_Combine(zFont, skSkinFolder(), L"trebuc.ttf");
wcscopy(zClass, L"static"); dwStyle = WS_CHILD;
hCtrl = CreateControl(0, zClass, L"Cap 1", dwStyle, 85, 29, 164, 20, hWnd, IDT_CAPTION01, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"Cap 2", dwStyle, 85, 75, 220, 20, hWnd, IDT_CAPTION02, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"Cap 3", dwStyle, 85, 121, 164, 20, hWnd, IDT_CAPTION03, gP.hInstance, 0);
long xOffset = 120;
hCtrl = CreateControl(0, zClass, L"", dwStyle, 85 + xOffset, 29, 50, 20, hWnd, IDT_VALUE01, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"", dwStyle, 85 + xOffset, 75, 50, 20, hWnd, IDT_VALUE02, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"", dwStyle, 85 + xOffset, 121, 50, 20, hWnd, IDT_VALUE03, gP.hInstance, 0);
wcscopy(zClass, TRACKBAR_CLASS); dwStyle = WS_CHILD | TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS;
hCtrl = CreateControl(0, zClass, L"", dwStyle, 85, 50, 166, 16, hWnd, IDT_SLIDE01, gP.hInstance, 0);
SendMessage(hCtrl, TBM_SETRANGE, TRUE, MAKELONG(0, 100)); SendMessage(hCtrl, TBM_SETPOS, TRUE, 50);
hCtrl = CreateControl(0, zClass, L"", dwStyle, 85, 96, 166, 16, hWnd, IDT_SLIDE02, gP.hInstance, 0);
SendMessage(hCtrl, TBM_SETRANGE, TRUE, MAKELONG(0, 100)); SendMessage(hCtrl, TBM_SETPOS, TRUE, 50);
hCtrl = CreateControl(0, zClass, L"", dwStyle, 85, 142, 166, 16, hWnd, IDT_SLIDE03, gP.hInstance, 0);
SendMessage(hCtrl, TBM_SETRANGE, TRUE, MAKELONG(0, 100)); SendMessage(hCtrl, TBM_SETPOS, TRUE, 50);
wcscopy(zClass, L"button"); dwStyle = WS_CHILD | BS_CENTER | BS_VCENTER | BS_NOTIFY;
hCtrl = CreateControl(0, zClass, L"But 1", dwStyle, 282, 47, 60, 20, hWnd, IDT_BUT01, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"But 2", dwStyle, 282, 93, 60, 20, hWnd, IDT_BUT02, gP.hInstance, 0);
hCtrl = CreateControl(0, zClass, L"But 3", dwStyle, 282, 139, 60, 20, hWnd, IDT_BUT03, gP.hInstance, 0);
dwStyle |= WS_VISIBLE;
hCtrl = CreateControl(0, zClass, L"Reset", dwStyle, 292, 218, 80, 27, hWnd, IDT_RESET, gP.hInstance, 0);
skSkinWindow(hWnd, L"");// "Dock|Undock|Minimize|Maximize|Restore|Close");
// PAT: 12-20-2018
if (ShowColorPick) {
hCtrl = zColorCtrl(6, 220, ToolW - 114, 30, hWnd, IDT_COLORPICK, zGetPickColor(0, 0));
}
skCreateToolTip(GetDlgItem(hWnd, IDT_SLIDE01), L"");
skCreateToolTip(GetDlgItem(hWnd, IDT_SLIDE02), L"");
skCreateToolTip(GetDlgItem(hWnd, IDT_SLIDE03), L"");
// We use the new trebuc.ttf private font stored into the Reader resource folder
skSetLabelFont(GetDlgItem(hWnd, IDT_CAPTION01), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_CAPTION02), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_CAPTION03), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_VALUE01), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_VALUE02), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_VALUE03), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_BUT01), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_BUT02), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_BUT03), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
skSetLabelFont(GetDlgItem(hWnd, IDT_RESET), zFont, 14, skARGB(255, 255, 255, 255), FontStyleRegular);
long nWidth, nHeight, w, h, x, y;
RECT rw; GetWindowRect(gP.hMain, &rw); nWidth = rw.right - rw.left; nHeight = rw.bottom - rw.top;
RECT rc; GetWindowRect(hWnd, &rc); w = rc.right - rc.left; h = rc.bottom - rc.top;
x = rw.left + (nWidth - w) / 2;
y = rw.top + (nHeight - h) / 2;
MoveWindow(hWnd, x, y, w, h, 0);
gP.hTool = hWnd;
}
}
}
if (!IsWindowVisible(gP.hTool)) {
SetToolwinParams(gP.hTool);
ShowWindow(gP.hTool, SW_SHOW);
}
return gP.hTool;
}
We could put the extra button on the left of the color picker, and reduce the width of the control accordingly.
But i can live with the Windows control for now.
AddedI have checked the SetToolwinParams, and i better understand now what to do
