本文整理匯總了Golang中C.RECT類的典型用法代碼示例。如果您正苦於以下問題:Golang RECT類的具體用法?Golang RECT怎麽用?Golang RECT使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RECT類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: commitResize
func (g *group) commitResize(c *allocation, d *sizing) {
var r C.RECT
// pretend that the client area of the group box only includes the actual empty space
// container will handle the necessary adjustments properly
r.left = 0
r.top = 0
r.right = C.LONG(c.width)
r.bottom = C.LONG(c.height)
g.container.move(&r)
basecommitResize(g, c, d)
}
示例2: Repaint
func (a *area) Repaint(r image.Rectangle) {
var hscroll, vscroll C.int
var rect C.RECT
C.SendMessageW(a.hwnd, C.msgAreaGetScroll, C.WPARAM(uintptr(unsafe.Pointer(&hscroll))), C.LPARAM(uintptr(unsafe.Pointer(&vscroll))))
r = r.Add(image.Pt(int(hscroll), int(vscroll))) // adjust by scroll position
r = image.Rect(0, 0, a.width, a.height).Intersect(r)
if r.Empty() {
return
}
rect.left = C.LONG(r.Min.X)
rect.top = C.LONG(r.Min.Y)
rect.right = C.LONG(r.Max.X)
rect.bottom = C.LONG(r.Max.Y)
C.SendMessageW(a.hwnd, C.msgAreaRepaint, 0, C.LPARAM(uintptr(unsafe.Pointer(&rect))))
}
示例3: commitResize
// a tab control contains other controls; size appropriately
func (t *tab) commitResize(c *allocation, d *sizing) {
var r C.RECT
// figure out what the rect for each child is...
// the tab contents are children of the tab itself, so ignore c.x and c.y, which are relative to the window!
r.left = C.LONG(0)
r.top = C.LONG(0)
r.right = C.LONG(c.width)
r.bottom = C.LONG(c.height)
C.tabGetContentRect(t._hwnd, &r)
// and resize tabs
// don't resize just the current tab; resize all tabs!
for _, c := range t.tabs {
// because each widget is actually a child of the Window, the origin is the one we calculated above
c.move(&r)
}
// and now resize the tab control itself
basecommitResize(t, c, d)
}
示例4: commitResize
// a tab control contains other controls; size appropriately
func (t *tab) commitResize(c *allocation, d *sizing) {
var r C.RECT
// figure out what the rect for each child is...
// the tab contents are children of the tab itself, so ignore c.x and c.y, which are relative to the window!
r.left = C.LONG(0)
r.top = C.LONG(0)
r.right = C.LONG(c.width)
r.bottom = C.LONG(c.height)
C.tabGetContentRect(t._hwnd, &r)
// and resize tabs
// resize only the current tab; we trigger a resize on a tab change to make sure things look correct
if len(t.tabs) > 0 {
t.tabs[C.SendMessageW(t._hwnd, C.TCM_GETCURSEL, 0, 0)].move(&r)
}
// save the tab size so we can
t.switchrect = r
// and now resize the tab control itself
basecommitResize(t, c, d)
}
示例5: xpreferredSize
func (g *group) xpreferredSize(d *sizing) (width, height int) {
var r C.RECT
width, height = g.child.preferredSize(d)
if width < int(g.textlen) { // if the text is longer, try not to truncate
width = int(g.textlen)
}
r.left = 0
r.top = 0
r.right = C.LONG(width)
r.bottom = C.LONG(height)
// use negative numbers to increase the size of the rectangle
if g.margined {
marginRectDLU(&r, -groupYMarginTop, -groupYMarginBottom, -groupXMargin, -groupXMargin, d)
} else {
// unforutnately, as mentioned above, the size of a groupbox includes the label and border
// 1 character cell (4DLU x, 8DLU y) on each side (but only 3DLU on the bottom) should be enough to make up for that; TODO is not, we can change it
// TODO make these named constants
marginRectDLU(&r, -8, -3, -4, -4, d)
}
return int(r.right - r.left), int(r.bottom - r.top)
}
示例6: marginRectDLU
func marginRectDLU(r *C.RECT, top int, bottom int, left int, right int, d *sizing) {
r.left += C.LONG(fromdlgunitsX(left, d))
r.top += C.LONG(fromdlgunitsY(top, d))
r.right -= C.LONG(fromdlgunitsX(right, d))
r.bottom -= C.LONG(fromdlgunitsY(bottom, d))
}