nuclear@0: #include "widget.h" nuclear@0: #include "nucwin.h" nuclear@0: nuclear@0: Widget *NWCreateWindow(const char *name, int x, int y, int xsz, int ysz, uint16 flags) { nuclear@0: if(x == NWT_CENTERX) { nuclear@0: x = (GetSystemMetrics(SM_CXSCREEN) - xsz) >> 1; nuclear@0: } nuclear@0: if(y == NWT_CENTERY) { nuclear@0: y = (GetSystemMetrics(SM_CYSCREEN) - ysz) >> 1; nuclear@0: } nuclear@0: nuclear@0: HINSTANCE AppInstance = GetModuleHandle(0); nuclear@0: unsigned long ex_style = flags & NWT_WIN_TOPMOST ? WS_EX_TOPMOST : 0; nuclear@0: return CreateWindowEx(ex_style, "NucWin", name, WS_OVERLAPPEDWINDOW | WS_VISIBLE, x, y, xsz, ysz, 0, 0, AppInstance, 0); nuclear@0: } nuclear@0: nuclear@0: nuclear@0: void NWResize(Widget *wdg, int nx, int ny) { nuclear@0: int xpos = (GetSystemMetrics(SM_CXSCREEN) - nx) >> 1; nuclear@0: int ypos = (GetSystemMetrics(SM_CYSCREEN) - ny) >> 1; nuclear@0: MoveWindow(wdg, xpos, ypos, nx, ny, true); nuclear@0: } nuclear@0: nuclear@0: void NWResizeClientArea(Widget *wdg, uint32 WinStyle) { nuclear@0: RECT rect; nuclear@0: GetWindowRect(wdg, &rect); nuclear@0: AdjustWindowRectEx(&rect, WinStyle, false, 0); nuclear@0: MoveWindow(wdg, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, true); nuclear@0: } nuclear@0: nuclear@0: void NWSetWindowPos(Widget *wdg, const Point &pos) { nuclear@0: Point sz = NWGetWindowSize(wdg); nuclear@0: MoveWindow(wdg, pos.x, pos.y, sz.x, sz.y, true); nuclear@0: } nuclear@0: nuclear@0: Point NWGetWindowPos(Widget *wdg) { nuclear@0: Rect rect; nuclear@0: GetWindowRect(wdg, &rect); nuclear@0: nuclear@0: return Point(rect.left, rect.top); nuclear@0: } nuclear@0: nuclear@0: Point NWGetWindowSize(Widget *wdg) { nuclear@0: Rect rect; nuclear@0: GetWindowRect(wdg, &rect); nuclear@0: nuclear@0: return Point(rect.right - rect.left, rect.bottom - rect.top); nuclear@0: } nuclear@0: