diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-17 22:47:04 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-17 22:47:04 -0400 |
| commit | 29b80f7542423c74e320c847a81874f457c957e3 (patch) | |
| tree | 33a60314a9b9339e54d96b9c3c835dd9a52f83a6 /redo/sizing_windows.c | |
| parent | 2c025a97efe8f9b15af6af643126f75085e75476 (diff) | |
Migrated sizing_windows.go to C.
Diffstat (limited to 'redo/sizing_windows.c')
| -rw-r--r-- | redo/sizing_windows.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/redo/sizing_windows.c b/redo/sizing_windows.c new file mode 100644 index 0000000..0b1620b --- /dev/null +++ b/redo/sizing_windows.c @@ -0,0 +1,37 @@ +/* 17 july 2014 */ + +#include "winapi_windows.h" + +HDC getDC(HWND hwnd) +{ + HDC dc; + + dc = GetDC(hwnd); + if (dc == NULL) + xpanic("error getting DC for preferred size calculations", GetLastError()); +/* TODO */ + /* TODO save for restoring later */ +/* + if (SelectObject(dc, controlFont) == NULL) + xpanic("error loading control font into device context for preferred size calculation", GetLastError()); +*/ + return dc; +} + +void releaseDC(HWND hwnd, HDC dc) +{ + if (ReleaseDC(hwnd, dc) == 0) + xpanic("error releasing DC for preferred size calculations", GetLastError()); +} + +void getTextMetricsW(HDC dc, TEXTMETRICW *tm) +{ + if (GetTextMetricsW(dc, tm) == 0) + xpanic("error getting text metrics for preferred size calculations", GetLastError()); +} + +void moveWindow(HWND hwnd, int x, int y, int width, int height) +{ + if (MoveWindow(hwnd, x, y, width, height, TRUE) == 0) + xpanic("error setting window/control rect", GetLastError()); +} |
