Example #1
0
func OnbtnClick(hEventEle xcgui.HELE, pbHandled *bool) int {
	hMenu := xcgui.XMenu_Create()
	xcgui.XMenu_SetBkImage(hMenu, xcgui.XImage_LoadFile("../img/comma_face_12.png", true))

	xcgui.XMenu_AddItemIcon(hMenu, 201, "111", xcgui.XC_ID_ROOT, xcgui.XImage_LoadFile("../img/plus.png", false), xcgui.MENU_STATE_FLAGS_CHECK)
	xcgui.XMenu_AddItem(hMenu, 202, "222", 0, 0)
	xcgui.XMenu_AddItem(hMenu, 203, "333", 0, 0)

	xcgui.XMenu_AddItem(hMenu, 204, "444", 203, 0)
	xcgui.XMenu_AddItem(hMenu, 205, "555", 203, 0)

	rcButton := new(xcgui.RECT)
	xcgui.XEle_GetRect(hEventEle, rcButton)
	pt := xcgui.POINT{int(rcButton.Left), int(rcButton.Bottom)}
	xcgui.ClientToScreen(xcgui.XWnd_GetHWND(hWindow), &pt)
	xcgui.XMenu_Popup(hMenu, xcgui.XWnd_GetHWND(hWindow), pt.X, pt.Y, 0, 0)

	return 0
}
Example #2
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 400, 400, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hPicture := xcgui.XShapePic_Create(20, 50, 100, 100, xcgui.HXCGUI(hWindow))
	xcgui.XShapePic_SetImage(hPicture, xcgui.XImage_LoadFile("../img/comma_face_02.png", false))

	xcgui.XWnd_AdjustLayout(hWindow)
	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Example #3
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 300, 200, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	info := new(my_image_info)

	info.hImage1 = xcgui.XImage_LoadFile("../../img/1.png", false)
	info.hImage2 = xcgui.XImage_LoadFile("../../img/2.png", false)
	info.hImage3 = xcgui.XImage_LoadFile("../../img/3.png", false)
	info.hImage4 = xcgui.XImage_LoadFile("../../img/4.png", false)
	info.hImage5 = xcgui.XImage_LoadFile("../../img/5.png", false)
	info.hImage6 = xcgui.XImage_LoadFile("../../img/6.png", false)

	left, top := 20, 50
	for i := 0; i < 5; i++ {
		CreateButton(left, top, info, hWindow)
		left += 50
	}

	left, top = 20, 100
	for i := 0; i < 5; i++ {
		CreateButtonLoop(left, top, info, hWindow)
		left += 50
	}

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()

}
Example #4
0
func NewIconFromFile(filePath string) (hIcon xc.HIMAGE, err error) {
	absFilePath, err := filepath.Abs(filePath)
	if err != nil {
		return 0, wrapError(err)
	}

	hIcon = xc.HIMAGE(xc.XImage_LoadFile(
		absFilePath,
		// xc.StringToUTF16Ptr(absFilePath),
		false))

	if hIcon == 0 {
		return 0, lastError("LoadImage")
	}

	return hIcon, nil
}
Example #5
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 500, 400, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hListView := xcgui.XListView_Create(20, 40, 450, 300, xcgui.HXCGUI(hWindow))
	xcgui.XListView_SetItemTemplateXML(hListView, "../xml-template/ListView_Item.xml")

	hAdapter := xcgui.XAdapterListView_Create()
	xcgui.XAdapterListView_GroupAddColumn(hAdapter, "name3")
	xcgui.XAdapterListView_ItemAddColumn(hAdapter, "name")
	xcgui.XAdapterListView_ItemAddColumn(hAdapter, "name2")

	xcgui.XListView_BindAdapter(hListView, hAdapter)

	group1 := xcgui.XAdapterListView_GroupAddItemText(hAdapter, "group1")
	group2 := xcgui.XAdapterListView_GroupAddItemText(hAdapter, "group2")

	hImage := xcgui.XImage_LoadFile("../img/comma_face_01.png", false)

	for i := 0; i < 20; i++ {
		index1 := xcgui.XAdapterListView_ItemAddItemImage(hAdapter, group1, hImage)
		xcgui.XAdapterListView_ItemSetText(hAdapter, group1, index1, 1, "group1-item-"+fmt.Sprint(i))

		index2 := xcgui.XAdapterListView_ItemAddItemImage(hAdapter, group2, hImage)
		xcgui.XAdapterListView_ItemSetText(hAdapter, group2, index2, 1, "group2-item-"+fmt.Sprint(i))
	}

	xcgui.XEle_RegEventC(hListView, xcgui.XE_LISTVIEW_SELECT, xcgui.CallBack(OnListViewSelect))
	xcgui.XEle_RegEventC(hListView, xcgui.XE_LISTVIEW_EXPAND, xcgui.CallBack(OnListViewExpand))

	xcgui.XEle_RegEventC(hListView, xcgui.XE_LISTVIEW_TEMP_CREATE, xcgui.CallBack(OnTemplateCreate))
	xcgui.XEle_RegEventC(hListView, xcgui.XE_LISTVIEW_TEMP_DESTROY, xcgui.CallBack(OnTemplateDestroy))
	xcgui.XEle_RegEventC(hListView, xcgui.XE_LISTVIEW_TEMP_ADJUST_COORDINATE, xcgui.CallBack(OnTemplateAdjustCoordinate))

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}