|
1
|
1 #pragma once
|
|
|
2 #include "win32_op.h"
|
|
|
3
|
|
|
4 namespace PP {
|
|
|
5 // Recreate std control with a different style, keep position, title, font
|
|
|
6 template<typename CWindowT>
|
|
|
7 void reStyleCtrl(CWindowT& btn, DWORD winStyle, DWORD winStyleEx) {
|
|
|
8 CWindowT btnNew;
|
|
|
9 CString title;
|
|
|
10 CWindow parent = btn.GetParent();
|
|
|
11 btn.GetWindowText(title);
|
|
|
12 CRect rc; WIN32_OP_D(btn.GetWindowRect(rc)); WIN32_OP_D(parent.ScreenToClient(rc));
|
|
|
13 CWindow wndPrev = parent.GetNextDlgTabItem(btn, TRUE);
|
|
|
14 auto ctrlID = btn.GetDlgCtrlID();
|
|
|
15 auto font = btn.GetFont();
|
|
|
16 btn.DestroyWindow();
|
|
|
17 WIN32_OP_D(btnNew.Create(parent, rc, title, winStyle | WS_CLIPSIBLINGS, winStyleEx, ctrlID));
|
|
|
18 if (wndPrev != NULL) btnNew.SetWindowPos(wndPrev, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
|
|
19 btnNew.SetFont(font);
|
|
|
20 btn = btnNew;
|
|
|
21 }
|
|
|
22 } |