MCPcopy Create free account
hub / github.com/DentonW/DevIL / ResizeDlgProc

Function ResizeDlgProc

DevIL/examples/windows_example/WindowsTest.cpp:1264–1321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1262
1263
1264INT_PTR APIENTRY ResizeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
1265{
1266 static TCHAR x[255], y[255], z[255];
1267 static ILuint xsize, ysize, zsize;
1268 static RECT Rect;
1269
1270 switch (message)
1271 {
1272 case WM_INITDIALOG:
1273 {
1274 wsprintf(x, L"%d", Width);
1275 wsprintf(y, L"%d", Height);
1276 wsprintf(z, L"%d", Depth);
1277 SetDlgItemText(hDlg, IDC_EDIT_RESIZE_X, x);
1278 SetDlgItemText(hDlg, IDC_EDIT_RESIZE_Y, y);
1279 SetDlgItemText(hDlg, IDC_EDIT_RESIZE_Z, z);
1280 return TRUE;
1281 }
1282 break;
1283
1284 case WM_COMMAND:
1285 {
1286 if (LOWORD(wParam) == IDOK) {
1287 GetDlgItemText(hDlg, IDC_EDIT_RESIZE_X, x, 255);
1288 GetDlgItemText(hDlg, IDC_EDIT_RESIZE_Y, y, 255);
1289 GetDlgItemText(hDlg, IDC_EDIT_RESIZE_Z, z, 255);
1290 xsize = _wtoi(x);
1291 ysize = _wtoi(y);
1292 zsize = _wtoi(z);
1293 if (xsize && ysize && zsize) {
1294 iluScale(xsize, ysize, zsize);
1295
1296 Width = ilGetInteger(IL_IMAGE_WIDTH);
1297 Height = ilGetInteger(IL_IMAGE_HEIGHT);
1298 Depth = ilGetInteger(IL_IMAGE_DEPTH);
1299
1300 GetWindowRect(HWnd, &Rect);
1301 SetWindowPos(HWnd, HWND_TOP, Rect.left, Rect.top,
1302 Width < MIN_W ? MIN_W + BORDER_W : Width + BORDER_W,
1303 Height + MENU_H, SWP_SHOWWINDOW);
1304
1305 InvalidateRect(HWnd, NULL, FALSE);
1306 }
1307 EndDialog(hDlg, TRUE);
1308 }
1309 if (LOWORD(wParam) == IDCANCEL) {
1310 EndDialog(hDlg, FALSE);
1311 }
1312 }
1313 break;
1314
1315 case WM_CLOSE:
1316 EndDialog(hDlg, TRUE);
1317 break;
1318 }
1319
1320 return FALSE;
1321}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected