MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / UpdateControls

Method UpdateControls

Explorer++/Helper/ResizableDialog.cpp:52–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void ResizableDialog::UpdateControls(int iWidth, int iHeight)
53{
54 HWND hCtrl;
55 RECT rc;
56
57 for (const auto &control : m_ControlList)
58 {
59 hCtrl = GetDlgItem(m_hDlg, control.iID);
60 GetWindowRect(hCtrl, &rc);
61 MapWindowPoints(
62 HWND_DESKTOP, m_hDlg, reinterpret_cast<LPPOINT>(&rc), sizeof(RECT) / sizeof(POINT));
63
64 /* Update the size/position of each of the controls.
65 Both resizes and movements rely on the fact that two
66 of the edges on a control will always be at a fixed
67 distance from the right/bottom edges of the dialog. */
68 switch (control.Type)
69 {
70 case TYPE_MOVE:
71 switch (control.Constraint)
72 {
73 case CONSTRAINT_NONE:
74 SetWindowPos(hCtrl, NULL, iWidth - control.iWidthDelta,
75 iHeight - control.iHeightDelta, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
76 break;
77
78 case CONSTRAINT_X:
79 SetWindowPos(hCtrl, NULL, iWidth - control.iWidthDelta, rc.top, 0, 0,
80 SWP_NOSIZE | SWP_NOZORDER);
81 break;
82
83 case CONSTRAINT_Y:
84 SetWindowPos(hCtrl, NULL, rc.left, iHeight - control.iHeightDelta, 0, 0,
85 SWP_NOSIZE | SWP_NOZORDER);
86 break;
87 }
88 break;
89
90 case TYPE_RESIZE:
91 switch (control.Constraint)
92 {
93 case CONSTRAINT_NONE:
94 SetWindowPos(hCtrl, NULL, 0, 0, iWidth - control.iWidthDelta - rc.left,
95 iHeight - control.iHeightDelta - rc.top, SWP_NOMOVE | SWP_NOZORDER);
96 break;
97
98 case CONSTRAINT_X:
99 SetWindowPos(hCtrl, NULL, 0, 0, iWidth - control.iWidthDelta - rc.left,
100 rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
101 break;
102
103 case CONSTRAINT_Y:
104 SetWindowPos(hCtrl, NULL, 0, 0, rc.right - rc.left,
105 iHeight - control.iHeightDelta - rc.top, SWP_NOMOVE | SWP_NOZORDER);
106 break;
107 }
108 break;
109 }

Callers 1

BaseDialogProcMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected