Ejemplo n.º 1
0
func main() {
	hWindow = xcgui.XWnd_Create(100, 100, 400, 300, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.XBtn_SetType(xcgui.XBtn_Create(5, 3, 60, 20, "Close", xcgui.HXCGUI(hWindow)), xcgui.BUTTON_TYPE_CLOSE)

	hButton := xcgui.XBtn_Create(20, 50, 120, 20, "popu-modalWindow", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hButton, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClick))
	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)

	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 2
0
func NewButton(parent Window, rect Rectangle) (*Button, error) {
	btn := new(Button)

	btn.hEle = xc.XBtn_Create(
		rect.X,
		rect.Y,
		rect.Width,
		rect.Height,
		"",
		xc.HXCGUI(parent.AsWindowBase().hWindow))

	if btn.hEle == 0 {
		return nil, lastError("XBtnCreate")
	}

	// var OnEventProc = func(hEventEle xc.HELE, nEvent int, wParam, lParam uintptr, pbHandled *xc.BOOL) uintptr {
	//     fmt.Println(nEvent, wParam, lParam)
	//     fmt.Println("事件正常.")
	//     return uintptr(0)
	// }

	// xc.XEleRegEventC(btn.hEle, xc.XE_BNCLICK, syscall.NewCallback(OnEventProc))

	return btn, nil
}
Ejemplo n.º 3
0
func main() {
	mw := new(MyMainWindow)

	mw.hWindow = xcgui.XWnd_Create(0, 0, 800, 600, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(mw.hWindow)

	hButton := xcgui.XBtn_Create(50, 100, 100, 30, "浏览图片", xcgui.HXCGUI(mw.hWindow))
	hButtonAbout := xcgui.XBtn_Create(200, 100, 100, 30, "关于", xcgui.HXCGUI(mw.hWindow))

	xcgui.XEle_RegEventC1(hButton, xcgui.XE_BNCLICK, xcgui.CallBack(mw.openAction_Triggered))
	xcgui.XEle_RegEventC1(hButtonAbout, xcgui.XE_BNCLICK, xcgui.CallBack(mw.aboutAction_Triggered))

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

}
Ejemplo n.º 4
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 300, 300, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hScrollView := xcgui.XSView_Create(20, 50, 200, 200, xcgui.HXCGUI(hWindow))
	xcgui.XSView_SetTotalSize(hScrollView, 300, 300)

	xcgui.XBtn_Create(10, 10, 100, 20, "Button1", xcgui.HXCGUI(hScrollView))
	xcgui.XBtn_Create(10, 40, 100, 20, "Button2", xcgui.HXCGUI(hScrollView))
	xcgui.XBtn_Create(10, 70, 100, 20, "Button3", xcgui.HXCGUI(hScrollView))

	xcgui.XEle_RegEventC(hScrollView, xcgui.XE_SCROLLVIEW_SCROLL_H, xcgui.CallBack(OnScrollViewScrollH))
	xcgui.XEle_RegEventC(hScrollView, xcgui.XE_SCROLLVIEW_SCROLL_V, xcgui.CallBack(OnScrollViewScrollV))

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 5
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 500, 400, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hListBox = xcgui.XListBox_Create(20, 40, 300, 310, xcgui.HXCGUI(hWindow))
	xcgui.XListBox_SetItemTemplateXML(hListBox, "../xml-template/ListBox_Item.xml")
	xcgui.XSView_SetLineSize(hListBox, 20, 20)

	hAdapter := xcgui.XAdapterTable_Create()
	xcgui.XListBox_BindAdapter(hListBox, hAdapter)
	xcgui.XAdapterTable_AddColumn(hAdapter, "name")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name2")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name3")

	for i := 0; i < 20; i++ {
		index := xcgui.XAdapterTable_AddItemTextEx(hAdapter, "name", "item-"+fmt.Sprint(i))
		if index != xcgui.XC_ID_ERROR {
			xcgui.XAdapterTable_SetItemTextEx(hAdapter, index, "name2", "item-1-"+fmt.Sprint(i))
			xcgui.XAdapterTable_SetItemTextEx(hAdapter, index, "name3", "item-2-"+fmt.Sprint(i))
		}
	}

	hButton1 := xcgui.XBtn_Create(330, 40, 150, 18, "插入", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hButton1, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClickAdd))

	hButton2 := xcgui.XBtn_Create(330, 60, 150, 18, "删除", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hButton2, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClickDel))

	hButton3 := xcgui.XBtn_Create(330, 84, 150, 18, "删除 index=(1-3)", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hButton3, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClickDelEx))

	hRichEidt = xcgui.XRichEdit_Create(330, 106, 120, 200, xcgui.HXCGUI(hWindow))
	xcgui.XSView_ShowSBarV(hRichEidt, true)
	xcgui.XRichEdit_EnableMultiLine(hRichEidt, true)

	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_TEMP_CREATE_END, xcgui.CallBack(OnTemplateCreate))
	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_TEMP_DESTROY, xcgui.CallBack(OnTemplateDestroy))
	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_TEMP_ADJUST_COORDINATE, xcgui.CallBack(OnTemplateAdjustCoordinate))
	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_SELECT, xcgui.CallBack(OnListBoxSelect))

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 6
0
func CreateButtonLoop(left, top int, pInfo *my_image_info, hWindow xcgui.HWINDOW) {
	hButton := xcgui.XBtn_Create(left, top, 37, 42, "B", xcgui.HXCGUI(hWindow))
	xcgui.XBtn_AddAnimationFrame(hButton, pInfo.hImage1, 100)
	xcgui.XBtn_AddAnimationFrame(hButton, pInfo.hImage2, 100)
	xcgui.XBtn_AddAnimationFrame(hButton, pInfo.hImage3, 100)
	xcgui.XBtn_AddAnimationFrame(hButton, pInfo.hImage4, 100)
	xcgui.XBtn_AddAnimationFrame(hButton, pInfo.hImage5, 100)
	xcgui.XBtn_AddAnimationFrame(hButton, pInfo.hImage6, 100)

	xcgui.XBtn_EnableAnimation(hButton, true, true)
}
Ejemplo n.º 7
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 300, 200, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.XBtn_SetType(xcgui.XBtn_Create(10, 5, 60, 20, "Close", xcgui.HXCGUI(hWindow)), xcgui.BUTTON_TYPE_CLOSE)

	xcgui.XEle_Create(20, 50, 100, 100, xcgui.HXCGUI(hWindow))

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)

	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 8
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 300, 200, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.XBtn_SetType(xcgui.XBtn_Create(5, 3, 60, 20, "Close", xcgui.HXCGUI(hWindow)), xcgui.BUTTON_TYPE_CLOSE)

	hCheck1 := xcgui.XBtn_Create(20, 40, 100, 20, "Radio1", xcgui.HXCGUI(hWindow))
	hCheck2 := xcgui.XBtn_Create(20, 70, 100, 20, "Radio2", xcgui.HXCGUI(hWindow))
	hCheck3 := xcgui.XBtn_Create(20, 100, 100, 20, "Radio3", xcgui.HXCGUI(hWindow))

	xcgui.XBtn_SetGroupID(hCheck1, 1)
	xcgui.XBtn_SetGroupID(hCheck2, 1)
	xcgui.XBtn_SetGroupID(hCheck3, 1)

	xcgui.XBtn_SetType(hCheck1, xcgui.BUTTON_TYPE_RADIO)
	xcgui.XBtn_SetType(hCheck2, xcgui.BUTTON_TYPE_RADIO)
	xcgui.XBtn_SetType(hCheck3, xcgui.BUTTON_TYPE_RADIO)

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 9
0
func OnBtnClick(pbHandled *bool) int {
	hWindowModal := xcgui.XModalWnd_Create(200, 200, "炫彩界面窗口", xcgui.XWnd_GetHWND(hWindow), xcgui.XC_WINDOW_STYLE_MODAL)
	xcgui.XBtn_SetType(xcgui.XBtn_Create(5, 3, 60, 20, "Close", xcgui.HXCGUI(hWindowModal)), xcgui.BUTTON_TYPE_CLOSE)

	nResult := xcgui.XModalWnd_DoModal(hWindowModal)

	log.Println("exit modal ", nResult)

	*pbHandled = true

	return 0
}
Ejemplo n.º 10
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 500, 200, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hToolBar := xcgui.XToolBar_Create(20, 40, 320, 28, xcgui.HXCGUI(hWindow))

	hButton1 := xcgui.XBtn_Create(0, 0, 60, 20, "Button1", xcgui.HXCGUI(hToolBar))
	hButton2 := xcgui.XBtn_Create(0, 0, 60, 20, "Button2", xcgui.HXCGUI(hToolBar))
	hButton3 := xcgui.XBtn_Create(0, 0, 60, 20, "Button3", xcgui.HXCGUI(hToolBar))
	hButton4 := xcgui.XBtn_Create(0, 0, 60, 20, "Button4", xcgui.HXCGUI(hToolBar))
	hButton5 := xcgui.XBtn_Create(0, 0, 60, 20, "Button5", xcgui.HXCGUI(hToolBar))
	xcgui.XToolBar_InsertEle(hToolBar, hButton1, -1)
	xcgui.XToolBar_InsertEle(hToolBar, hButton2, -1)
	xcgui.XToolBar_InsertEle(hToolBar, hButton3, -1)
	xcgui.XToolBar_InsertEle(hToolBar, hButton4, -1)
	xcgui.XToolBar_InsertEle(hToolBar, hButton5, -1)

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 11
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 300, 200, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hProgressBar = xcgui.XProgBar_Create(20, 40, 260, 20, xcgui.HXCGUI(hWindow))
	xcgui.XProgBar_SetRange(hProgressBar, 100)
	xcgui.XProgBar_SetPos(hProgressBar, 50)
	xcgui.XProgBar_SetSpaceTwo(hProgressBar, 10, 10)

	hButtonAdd = xcgui.XBtn_Create(20, 70, 50, 18, "+", xcgui.HXCGUI(hWindow))
	hButtonMunus := xcgui.XBtn_Create(80, 70, 50, 18, "-", xcgui.HXCGUI(hWindow))

	xcgui.XEle_RegEventC1(hButtonAdd, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClick))
	xcgui.XEle_RegEventC1(hButtonMunus, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClick))
	xcgui.XEle_RegEventC(hProgressBar, xcgui.XE_PROGRESSBAR_CHANGE, xcgui.CallBack(OnProgressBarChange))

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

}
Ejemplo n.º 12
0
func main() {
	hWindow = xcgui.XWnd_Create(0, 0, 300, 200, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hButton := xcgui.XBtn_Create(20, 50, 80, 20, "弹出菜单", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC1(hButton, xcgui.XE_BNCLICK, xcgui.CallBack(OnbtnClick))

	xcgui.XWnd_RegEventC(hWindow, xcgui.XWM_MENU_POPUP, xcgui.CallBack(OnWndMenuPopup))
	xcgui.XWnd_RegEventC(hWindow, xcgui.XWM_MENU_POPUP_WND, xcgui.CallBack(OnWndMenuPopupWnd))
	xcgui.XWnd_RegEventC(hWindow, xcgui.XWM_MENU_SELECT, xcgui.CallBack(OnWndMenuSelect))
	xcgui.XWnd_RegEventC(hWindow, xcgui.XWM_MENU_EXIT, xcgui.CallBack(OnWndMenuExit))

	xcgui.XWnd_RegEventC(hWindow, xcgui.XWM_MENU_DRAW_BACKGROUND, xcgui.CallBack(OnWndMenuDrawBackground))

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

}
Ejemplo n.º 13
0
func main() {
	mw = xcgui.XFrameWnd_Create(0, 0, 600, 400, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.XBtn_SetType(xcgui.XBtn_Create(3, 3, 20, 20, "X", xcgui.HXCGUI(mw)), xcgui.BUTTON_TYPE_CLOSE)

	hPane1 := xcgui.XPane_Create("111", 200, 200, mw)
	hPane2 := xcgui.XPane_Create("2222222222", 200, 200, mw)
	hPane3 := xcgui.XPane_Create("333", 200, 200, mw)

	xcgui.XFrameWnd_AddPane(mw, 0, hPane1, xcgui.Align_left)

	xcgui.XFrameWnd_AddPane(mw, 0, hPane2, xcgui.Align_bottom)

	xcgui.XFrameWnd_AddPane(mw, 0, hPane3, xcgui.Align_right)

	xcgui.XWnd_RegEventC(mw, xcgui.WM_RBUTTONUP, xcgui.CallBack(OnWndButtonUp))

	xcgui.XWnd_AdjustLayout(mw)
	xcgui.XWnd_ShowWindow(mw, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 14
0
func main() {
	xcgui.XInitXCGUI()
	hwnd := xcgui.XWnd_Create(400, 200, 300, 200, "标题", xcgui.NULL, xcgui.XC_WINDOW_STYLE_DEFAULT)

	parent := xcgui.HXCGUI(hwnd)
	//button
	btn := xcgui.XBtn_Create(10, 5, 80, 22, "关闭", parent)
	xcgui.XBtn_SetType(btn, xcgui.BUTTON_TYPE_CLOSE)
	//监听btn事件
	xcgui.XEle_RegEventC(btn, xcgui.XE_BNCLICK, syscall.NewCallback(OnBtnClick))
	//label
	lb := xcgui.XShapeText_Create(50, 100, 100, 22, "hello world!", parent)
	xcgui.XShapeText_SetText(lb, "hello 世界!")
	xcgui.XShapeText_SetTextColor(lb, 0xff0000, 255)

	//取text及长度
	str := xcgui.XShapeText_GetTextGo(lb)
	fmt.Println(str)
	fmt.Println(xcgui.XShapeText_GetTextLength(lb))

	xcgui.XWnd_ShowWindow(hwnd, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Ejemplo n.º 15
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 820, 700, "测试", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	button := xcgui.XBtn_Create(300, 35, 50, 30, "执行js", xcgui.HXCGUI(hWindow))

	hWeb = web.XWeb_Create(20, 100, 750, 550, xcgui.XWnd_GetHWND(hWindow))
	web.XWeb_SetCookieEnabled(hWeb, true)

	version := web.XWeb_GetVersionString()
	fmt.Println(version)

	web.XWeb_SetUserAgentA(hWeb, "Mozilla/5.0 (Windows NT 12.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Codyguo/45.0.2454.101 Safari/537.36")

	version2 := web.XWeb_GetVersion()
	fmt.Println(version2)

	web.XWeb_LoadUrl(hWeb, "http://www.xcgui.com/bbs/forum.php")

	xcgui.XEle_RegEventC1(button, xcgui.XE_BNCLICK, xcgui.CallBack(RunJS))
	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}