| 60 | } |
| 61 | |
| 62 | INT_PTR CALLBACK BaseDialog::BaseDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 63 | { |
| 64 | switch (uMsg) |
| 65 | { |
| 66 | case WM_INITDIALOG: |
| 67 | { |
| 68 | m_hDlg = hDlg; |
| 69 | |
| 70 | if (m_bResizable) |
| 71 | { |
| 72 | RECT rcMain; |
| 73 | GetWindowRect(m_hDlg, &rcMain); |
| 74 | |
| 75 | /* Assume that the current width and height of |
| 76 | the dialog are the minimum width and height. |
| 77 | Note that at this point, the dialog has NOT |
| 78 | been initialized in any way, so it will not |
| 79 | have had a chance to be resized yet. */ |
| 80 | m_iMinWidth = GetRectWidth(&rcMain); |
| 81 | m_iMinHeight = GetRectHeight(&rcMain); |
| 82 | |
| 83 | std::list<ResizableDialog::Control_t> controlList; |
| 84 | m_dsc = DIALOG_SIZE_CONSTRAINT_NONE; |
| 85 | GetResizableControlInformation(m_dsc, controlList); |
| 86 | |
| 87 | m_prd = std::make_unique<ResizableDialog>(m_hDlg, controlList); |
| 88 | } |
| 89 | |
| 90 | UINT dpi = m_dpiCompat.GetDpiForWindow(m_hDlg); |
| 91 | int iconWidth = m_dpiCompat.GetSystemMetricsForDpi(SM_CXSMICON, dpi); |
| 92 | int iconHeight = m_dpiCompat.GetSystemMetricsForDpi(SM_CYSMICON, dpi); |
| 93 | m_icon = GetDialogIcon(iconWidth, iconHeight); |
| 94 | |
| 95 | if (m_icon) |
| 96 | { |
| 97 | SetClassLongPtr(m_hDlg, GCLP_HICONSM, reinterpret_cast<LONG_PTR>(m_icon.get())); |
| 98 | } |
| 99 | |
| 100 | m_tipWnd = CreateTooltipControl(m_hDlg, m_hInstance); |
| 101 | } |
| 102 | break; |
| 103 | |
| 104 | case WM_GETMINMAXINFO: |
| 105 | if (m_bResizable) |
| 106 | { |
| 107 | auto pmmi = reinterpret_cast<LPMINMAXINFO>(lParam); |
| 108 | |
| 109 | pmmi->ptMinTrackSize.x = m_iMinWidth; |
| 110 | pmmi->ptMinTrackSize.y = m_iMinHeight; |
| 111 | |
| 112 | if (m_dsc == DIALOG_SIZE_CONSTRAINT_X) |
| 113 | { |
| 114 | pmmi->ptMaxTrackSize.y = m_iMinHeight; |
| 115 | } |
| 116 | |
| 117 | if (m_dsc == DIALOG_SIZE_CONSTRAINT_Y) |
| 118 | { |
| 119 | pmmi->ptMaxTrackSize.x = m_iMinWidth; |
no test coverage detected