Implemented container.bounds() on Windows.
This commit is contained in:
parent
45acb35a6d
commit
1face3a455
|
@ -57,6 +57,15 @@ HWND newContainer(void)
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RECT containerBounds(HWND hwnd)
|
||||||
|
{
|
||||||
|
RECT r;
|
||||||
|
|
||||||
|
if (GetClientRect(hwnd, &r) == 0)
|
||||||
|
xpanic("error getting container client rect for container.bounds()", GetLastError());
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
void calculateBaseUnits(HWND hwnd, int *baseX, int *baseY, LONG *internalLeading)
|
void calculateBaseUnits(HWND hwnd, int *baseX, int *baseY, LONG *internalLeading)
|
||||||
{
|
{
|
||||||
HDC dc;
|
HDC dc;
|
||||||
|
|
|
@ -57,6 +57,11 @@ func (c *container) parent() *controlParent {
|
||||||
return &controlParent{c.hwnd}
|
return &controlParent{c.hwnd}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *container) bounds(d *sizing) (int, int, int, int) {
|
||||||
|
r := C.containerBounds(c.hwnd)
|
||||||
|
return int(r.left), int(r.top), int(r.right - r.left), int(r.bottom - r.top)
|
||||||
|
}
|
||||||
|
|
||||||
// For Windows, Microsoft just hands you a list of preferred control sizes as part of the MSDN documentation and tells you to roll with it.
|
// For Windows, Microsoft just hands you a list of preferred control sizes as part of the MSDN documentation and tells you to roll with it.
|
||||||
// These sizes are given in "dialog units", which are independent of the font in use.
|
// These sizes are given in "dialog units", which are independent of the font in use.
|
||||||
// We need to convert these into standard pixels, which requires we get the device context of the OS window.
|
// We need to convert these into standard pixels, which requires we get the device context of the OS window.
|
||||||
|
|
|
@ -125,6 +125,7 @@ extern void tableSelectItem(HWND, intptr_t);
|
||||||
#define containerclass L"gouicontainer"
|
#define containerclass L"gouicontainer"
|
||||||
extern DWORD makeContainerWindowClass(char **);
|
extern DWORD makeContainerWindowClass(char **);
|
||||||
extern HWND newContainer();
|
extern HWND newContainer();
|
||||||
|
extern RECT containerBounds(HWND);
|
||||||
extern void calculateBaseUnits(HWND, int *, int *, LONG *);
|
extern void calculateBaseUnits(HWND, int *, int *, LONG *);
|
||||||
|
|
||||||
// area_windows.c
|
// area_windows.c
|
||||||
|
|
Loading…
Reference in New Issue