#include "stdafx.h" #ifdef FOOBAR2000_DESKTOP_WINDOWS #include "dialog_resize_helper.h" static BOOL GetChildWindowRect(HWND wnd, UINT id, RECT* child) { RECT temp; HWND wndChild = GetDlgItem(wnd, id); if (wndChild == NULL) return FALSE; if (!GetWindowRect(wndChild, &temp)) return FALSE; if (!MapWindowPoints(0, wnd, (POINT*)&temp, 2)) return FALSE; *child = temp; return TRUE; } void dialog_resize_helper::set_parent(HWND wnd) { reset(); parent = wnd; GetClientRect(parent,&orig_client); } void dialog_resize_helper::reset() { parent = 0; sizegrip = 0; } void dialog_resize_helper::on_wm_size() { if (parent) { unsigned count = m_table.get_size(); if (sizegrip != 0) count++; HDWP hWinPosInfo = BeginDeferWindowPos(count); for(unsigned n=0;nptMaxTrackSize.x = r.right - r.left; info->ptMaxTrackSize.y = r.bottom - r.top; } if (min_x && min_y) { r.left = 0; r.right = min_x; r.top = 0; r.bottom = min_y; MapDialogRect(hWnd,&r); AdjustWindowRectEx(&r, dwStyle, FALSE, dwExStyle); info->ptMinTrackSize.x = r.right - r.left; info->ptMinTrackSize.y = r.bottom - r.top; } } lResult = 0; return TRUE; case WM_INITDIALOG: set_parent(hWnd); { t_size n; for(n=0;n