Mercurial > dwindows
comparison win/dw.c @ 1450:145edf67013e
Fixed accidentally flipping splitbars vertically on Windows in that last commit.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 14 Dec 2011 01:19:50 +0000 |
parents | 632346743f46 |
children | fb4a71126df5 |
comparison
equal
deleted
inserted
replaced
1449:632346743f46 | 1450:145edf67013e |
---|---|
2971 | 2971 |
2972 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) | 2972 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
2973 { | 2973 { |
2974 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2974 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2975 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); | 2975 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
2976 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); | |
2977 | 2976 |
2978 ShowWindow(handle1, SW_HIDE); | 2977 ShowWindow(handle1, SW_HIDE); |
2979 ShowWindow(handle2, SW_HIDE); | 2978 ShowWindow(handle2, SW_HIDE); |
2980 | 2979 |
2981 if(type == DW_HORZ) | 2980 if(type == DW_HORZ) |
2982 { | 2981 { |
2983 int newx = x; | 2982 int newx = x; |
2984 float ratio = (float)percent/(float)100.0; | 2983 float ratio = (float)percent/(float)100.0; |
2984 Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); | |
2985 | 2985 |
2986 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); | 2986 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); |
2987 | 2987 |
2988 MoveWindow(handle1, 0, 0, newx, y, FALSE); | 2988 MoveWindow(handle1, 0, 0, newx, y, FALSE); |
2989 _do_resize(tmp, newx - 1, y - 1); | 2989 _do_resize(tmp, newx - 1, y - 1); |
2999 } | 2999 } |
3000 else | 3000 else |
3001 { | 3001 { |
3002 int newy = y; | 3002 int newy = y; |
3003 float ratio = (float)(100.0-percent)/(float)100.0; | 3003 float ratio = (float)(100.0-percent)/(float)100.0; |
3004 Box *tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); | |
3004 | 3005 |
3005 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); | 3006 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); |
3006 | 3007 |
3007 MoveWindow(handle1, 0, y - newy, x, newy, FALSE); | 3008 MoveWindow(handle2, 0, y - newy, x, newy, FALSE); |
3008 _do_resize(tmp, x - 1, newy - 1); | 3009 _do_resize(tmp, x - 1, newy - 1); |
3009 | 3010 |
3010 tmp = (Box *)GetWindowLongPtr(handle2, GWLP_USERDATA); | 3011 tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); |
3011 | 3012 |
3012 newy = y - newy - SPLITBAR_WIDTH; | 3013 newy = y - newy - SPLITBAR_WIDTH; |
3013 | 3014 |
3014 MoveWindow(handle2, 0, 0, x, newy, FALSE); | 3015 MoveWindow(handle1, 0, 0, x, newy, FALSE); |
3015 _do_resize(tmp, x - 1, newy - 1); | 3016 _do_resize(tmp, x - 1, newy - 1); |
3016 | 3017 |
3017 dw_window_set_data(hwnd, "_dw_start", (void *)newy); | 3018 dw_window_set_data(hwnd, "_dw_start", (void *)newy); |
3018 } | 3019 } |
3019 | 3020 |