當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.RECT類代碼示例

本文整理匯總了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)
}
開發者ID:NotBadPad,項目名稱:ui,代碼行數:12,代碼來源:group_windows.go

示例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))))
}
開發者ID:sjn1978,項目名稱:ui,代碼行數:16,代碼來源:area_windows.go

示例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)
}
開發者ID:NotBadPad,項目名稱:ui,代碼行數:20,代碼來源:tab_windows.go

示例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)
}
開發者ID:NotBadPad,項目名稱:ui,代碼行數:21,代碼來源:windows-one-tab.go

示例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)
}
開發者ID:sjn1978,項目名稱:ui,代碼行數:22,代碼來源:group_windows.go

示例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))
}
開發者ID:sjn1978,項目名稱:ui,代碼行數:6,代碼來源:container_windows.go


注:本文中的C.RECT類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。