Exemplo n.º 1
0
func main() {
	xcgui.XInitXCGUI()
	hwnd := xcgui.XWndCreate(400, 200, 300, 200, "标题",
		xcgui.NULL, xcgui.XC_WINDOW_STYLE_DEFAULT)

	parent := xcgui.HXCGUI(hwnd)
	//button
	btn := xcgui.XBtnCreate(10, 5, 80, 22, "关闭", parent)
	xcgui.XBtnSetType(btn, xcgui.BUTTON_TYPE_CLOSE)
	//监听btn事件
	xcgui.XEleRegEventC(btn, xcgui.XE_BNCLICK, syscall.NewCallback(OnBtnClick))
	//label
	lb := xcgui.XShapeTextCreate(50, 100, 100, 22, "hello world!", parent)
	xcgui.XShapeTextSetText(lb, "hello 世界!")
	xcgui.XShapeTextSetTextColor(lb, 0xff0000, 255)

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

	xcgui.XWndShowWindow(hwnd, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 2
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 350, 400, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hTree := xcgui.XTree_Create(20, 40, 300, 300, xcgui.HXCGUI(hWindow))
	xcgui.XTree_SetItemTemplateXML(hTree, "../xml-template/Tree_Item.xml")

	hAdapter := xcgui.XAdapterTree_Create()
	xcgui.XTree_BindAdapter(hTree, hAdapter)
	xcgui.XAdapterTree_AddColumn(hAdapter, "name")

	for i := 0; i < 20; i++ {
		xcgui.XAdapterTree_InsertItemText(hAdapter, "name-"+fmt.Sprint(i)+"-0", xcgui.XC_ID_ROOT, xcgui.XC_ID_LAST)
	}

	xcgui.XAdapterTree_InsertItemText(hAdapter, "Item1-----1", 1, xcgui.XC_ID_LAST)         // idc1
	idc2 := xcgui.XAdapterTree_InsertItemText(hAdapter, "Item1-----2", 1, xcgui.XC_ID_LAST) // idc2
	xcgui.XAdapterTree_InsertItemText(hAdapter, "Item1-----2--1", idc2, xcgui.XC_ID_LAST)   // idc2-1

	xcgui.XEle_RegEventC(hTree, xcgui.XE_TREE_SELECT, xcgui.CallBack(OnTreeSelect))
	xcgui.XEle_RegEventC(hTree, xcgui.XE_TREE_EXPAND, xcgui.CallBack(OnTreeExpand))

	xcgui.XEle_RegEventC(hTree, xcgui.XE_TREE_TEMP_CREATE, xcgui.CallBack(OnTemplateCreate))
	xcgui.XEle_RegEventC(hTree, xcgui.XE_TREE_TEMP_DESTROY, xcgui.CallBack(OnTemplateDestroy))
	xcgui.XEle_RegEventC(hTree, xcgui.XE_TREE_TEMP_ADJUST_COORDINATE, xcgui.CallBack(OnTemplateAdjustCoordinate))

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 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()

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

	// hShapeLine
	xcgui.XShapeLine_Create(20, 50, 100, 100, xcgui.HXCGUI(hWindow))
	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 5
0
func main() {
	xcgui.XCLoadResource("resource.xml", "")

	hxCGUI := xcgui.XCLoadLayout("layout.xml", 0)

	xcgui.XWndAdjustLayout(xcgui.HWINDOW(hxCGUI))
	xcgui.XWndShowWindow(xcgui.HWINDOW(hxCGUI), xcgui.SW_SHOW)

	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 6
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()
}
Exemplo n.º 7
0
func main() {
	hWindow = xcgui.XWnd_Create(0, 0, 0, 0, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_NOTHING)

	// We load our icon from a file.
	icon, err := walk.NewIconFromFile("../../img/x.ico")
	if err != nil {
		log.Fatal(err)
	}

	// Create the notify icon and make sure we clean it up on exit.
	ni, err = walk.NewNotifyIcon()
	if err != nil {
		log.Fatal(err)
	}
	defer ni.Dispose()

	// Set the icon and a tool tip text.
	if err := ni.SetIcon(icon); err != nil {
		log.Fatal(err)
	}
	if err := ni.SetToolTip("托盘"); err != nil {
		log.Fatal(err)
	}

	// When the left mouse button is pressed, bring up our balloon.
	ni.MouseDown().Attach(func(x, y int, button walk.MouseButton) {
		if button == walk.LeftButton {
			if err := ni.ShowCustom(
				"自定义消息",
				"这是一个带图标的自定义消息."); err != nil {
				log.Fatal(err)
			}
		} else {
			RunXCMenu()
		}

	})

	// 托盘图标默认为隐藏状态,需设置为显示。
	if err := ni.SetVisible(true); err != nil {
		log.Fatal(err)
	}

	// Now that the icon is visible, we can bring up an info balloon.
	if err := ni.ShowInfo("托盘", "正在运行中."); err != nil {
		log.Fatal(err)
	}

	// 注册菜单选择事件
	xcgui.XWnd_RegEventC(hWindow, xcgui.XWM_MENU_SELECT, xcgui.CallBack(OnWndMenuSelect))

	// Run the message loop.
	xcgui.XRunXCGUI()
}
Exemplo n.º 8
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()
}
Exemplo n.º 9
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()
}
Exemplo n.º 10
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 400, 300, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hEle := xcgui.XEle_Create(60, 60, 200, 200, xcgui.HXCGUI(hWindow))
	hTextBlock := xcgui.XShapeText_Create(0, 0, 100, 20, "123456", xcgui.HXCGUI(hEle))

	xcgui.XShapeText_SetLayoutWidth(hTextBlock, xcgui.LAYOUT_SIZE_TYPE_AUTO, 0)
	xcgui.XShapeText_SetLayoutHeight(hTextBlock, xcgui.LAYOUT_SIZE_TYPE_AUTO, 0)

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

	hSBar1 := xcgui.XSBar_Create(20, 50, 200, 20, xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hSBar1, xcgui.XE_SBAR_SCROLL, xcgui.CallBack(OnSBarScroll))

	hSBar2 := xcgui.XSBar_Create(230, 50, 20, 200, xcgui.HXCGUI(hWindow))
	xcgui.XSBar_SetHorizon(hSBar2, false)

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

	hSliderBar := xcgui.XSliderBar_Create(20, 40, 260, 60, xcgui.HXCGUI(hWindow))
	xcgui.XSliderBar_SetRange(hSliderBar, 10)
	xcgui.XSliderBar_SetButtonHeight(hSliderBar, 27)
	xcgui.XSliderBar_SetButtonWidth(hSliderBar, 27)
	xcgui.XSliderBar_SetSpaceTwo(hSliderBar, 10, 10)

	xcgui.XEle_RegEventC(hSliderBar, xcgui.XE_SLIDERBAR_CHANGE, xcgui.CallBack(OnSliderBarChange))

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

}
Exemplo n.º 13
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()

}
Exemplo n.º 14
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()
}
Exemplo n.º 15
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()
}
Exemplo n.º 16
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()

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

	hComboBox := xcgui.XComboBox_Create(20, 40, 120, 20, xcgui.HXCGUI(hWindow))
	xcgui.XComboBox_SetItemTemplateXML(hComboBox, "../xml-template/ComboBox_ListBox_Item.xml")
	xcgui.XRichEdit_SetText(hComboBox, "123")

	hAdapter := xcgui.XAdapterTable_Create()
	xcgui.XComboBox_BindApapter(hComboBox, hAdapter)
	xcgui.XAdapterTable_AddColumn(hAdapter, "name")

	for i := 0; i < 20; i++ {
		xcgui.XAdapterTable_AddItemText(hAdapter, "name-"+fmt.Sprint(i)+"-0")
	}

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 18
0
func (wb *WindowBase) Run() int {

	// var msg xc.MSG

	// for wb.hWindow != 0 {
	//     switch xc.GetMessage(&msg, 0, 0, 0) {
	//     case 0:
	//         return int(msg.WParam)
	//     case -1:
	//         return -1
	//     }

	//     xc.TranslateMessage(&msg)
	//     xc.DispatchMessage(&msg)

	// }
	xc.XRunXCGUI()

	return 0
}
Exemplo n.º 19
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()
}
Exemplo n.º 20
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 550, 380, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hList := xcgui.XList_Create(20, 40, 500, 300, xcgui.HXCGUI(hWindow))
	xcgui.XList_SetItemTemplateXML(hList, "../xml-template/List_Item.xml")
	xcgui.XSView_SetLineSize(hList, 20, 20)

	for i := 0; i < 3; i++ {
		xcgui.XList_AddColumn(hList, 100)
	}

	hAdapterHeader := xcgui.XAdapterMap_Create()
	xcgui.XList_BindAdapterHeader(hList, hAdapterHeader)

	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name", "aaa")
	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name2", "bbb")
	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name3", "ccc")
	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name4", "test")

	hAdapter := xcgui.XAdapterTable_Create()
	xcgui.XList_BindAdapter(hList, hAdapter)
	xcgui.XAdapterTable_AddColumn(hAdapter, "name")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name2")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name3")

	xcgui.XList_SetColumnWidth(hList, 0, 150)
	xcgui.XList_SetColumnWidth(hList, 1, 150)
	xcgui.XList_SetColumnWidth(hList, 2, 150)

	for i := 0; i < 20; i++ {
		xcgui.XAdapterTable_AddItemText(hAdapter, "item-"+fmt.Sprint(i))

		xcgui.XAdapterTable_SetItemText(hAdapter, i, 1, "child-"+fmt.Sprint(i)+"-1")
		xcgui.XAdapterTable_SetItemText(hAdapter, i, 2, "child-"+fmt.Sprint(i)+"-2")
	}

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 21
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()
}
Exemplo n.º 22
0
Arquivo: frame.go Projeto: maxid/xcgui
func main() {
	mw = xcgui.XFrameWndCreate(0, 0, 600, 400, xcgui.StringToUTF16Ptr("炫彩界面库窗口"), xcgui.NULL, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.XBtnSetType(xcgui.XBtnCreate(3, 3, 20, 20, xcgui.StringToUTF16Ptr("X"), xcgui.HXCGUI(mw)), xcgui.BUTTON_TYPE_CLOSE)

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

	xcgui.XFrameWndAddPane(mw, xcgui.NULL, hPane1, xcgui.Align_left)

	xcgui.XFrameWndAddPane(mw, xcgui.NULL, hPane2, xcgui.Align_bottom)

	xcgui.XFrameWndAddPane(mw, xcgui.NULL, hPane3, xcgui.Align_right)

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

	xcgui.XWndAdjustLayout(mw)
	xcgui.XWndShowWindow(mw, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 23
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()
}
Exemplo n.º 24
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()

}
Exemplo n.º 25
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()
}
Exemplo n.º 26
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()
}
Exemplo n.º 27
0
func main() {
	xcgui.XC_LoadResource("xml/resource.xml", "")
	hxcgui := xcgui.XC_LoadLayout("xml/layout.xml", 0)
	hWindow = xcgui.HWINDOW(hxcgui)
	xcgui.XWnd_AdjustLayout(hWindow)

	// 后退
	hGoBack = xcgui.XC_GetObjectByID(130)
	// xcgui.XEle_RegEventC1(xcgui.HELE(hGoBack), xcgui.XE_BNCLICK, xcgui.CallBack(onBtnClick))
	xcgui.XEle_RegEventC1(xcgui.HELE(hGoBack),
		xcgui.XE_BNCLICK,
		xcgui.CallBackGo(func() {
			fmt.Println("后退中...")
			web.XWeb_GoBack(hWeb)
		}))

	// url地址栏
	hEditUrl = xcgui.XC_GetObjectByID(131)
	xcgui.XEle_EnableSwitchFocus(xcgui.HELE(hEditUrl), true)
	xcgui.XEle_RegEventC(xcgui.HELE(hEditUrl), xcgui.XE_CHAR, xcgui.CallBack(onEventChar))
	// 解决焦点丢失问题
	xcgui.XEle_RegEventC(xcgui.HELE(hEditUrl), xcgui.XE_LBUTTONDOWN, xcgui.CallBack(onLButtonDown))

	// 前进
	hGoForward = xcgui.XC_GetObjectByID(132)
	xcgui.XEle_RegEventC1(xcgui.HELE(hGoForward), xcgui.XE_BNCLICK, xcgui.CallBack(onBtnClick))

	// 浏览器body区
	xcgui.XWnd_GetBodyRect(hWindow, &rtBody)

	hWeb = web.XWeb_Create(
		int(rtBody.Left),
		int(rtBody.Top),
		int(rtBody.Right-rtBody.Left),
		int(rtBody.Bottom-rtBody.Top),
		xcgui.XWnd_GetHWND(hWindow))

	// 更多
	hMenuBar = xcgui.XC_GetObjectByID(133)
	xcgui.XMenuBar_AddButton(xcgui.HELE(hMenuBar), "更多")
	hMenu = xcgui.XMenuBar_GetMenu(xcgui.HELE(hMenuBar), 0)

	if hMenu != 0 {
		xcgui.XMenu_AddItem(hMenu, 1330, "主页", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1331, "重新载入", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1332, "停止载入", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1333, "代理加载谷歌", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1334, "放大", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1335, "缩小", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1336, "恢复缩放", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1337, "获取Cookie", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1338, "js调用vs函数", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1340, "设置网页可编辑", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1341, "设置网页不可编辑", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1351, "执行js脚本", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1352, "取浏览器状态", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1353, "js模拟填写", 0, 0)
		xcgui.XMenu_AddItem(hMenu, 1360, "关于", 0, 0)

	}
	// 菜单选择
	xcgui.XEle_RegEventC(xcgui.HELE(hMenuBar), xcgui.XE_MENU_SELECT, xcgui.CallBack(onWndMenuSelect))

	// 默认打开百度
	web.XWeb_LoadUrl(hWeb, "http://www.baidu.com")

	// URL变化
	web.XWeb_OnURLChanged(hWeb, xcgui.CallBack(onURLChanged), 1)

	// Title 变化修改状态栏
	hState = xcgui.XC_GetObjectByID(311)
	web.XWeb_OnTitleChanged(hWeb, xcgui.CallBack(onTitleChanged), 1)

	// 窗口变化web窗体自适应
	xcgui.XWnd_RegEventC(hWindow, xcgui.WM_SIZE, xcgui.CallBack(OnWndSize))

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 28
0
func main() {
	xcgui.XWnd_Create(0, 0, 0, 0, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_NOTHING)

	// We load our icon from a file.
	icon, err := walk.NewIconFromFile("../../img/x.ico")
	if err != nil {
		log.Fatal(err)
	}

	// Create the notify icon and make sure we clean it up on exit.
	ni, err := walk.NewNotifyIcon()
	if err != nil {
		log.Fatal(err)
	}
	defer ni.Dispose()

	// Set the icon and a tool tip text.
	if err := ni.SetIcon(icon); err != nil {
		log.Fatal(err)
	}
	if err := ni.SetToolTip("托盘"); err != nil {
		log.Fatal(err)
	}

	// When the left mouse button is pressed, bring up our balloon.
	ni.MouseDown().Attach(func(x, y int, button walk.MouseButton) {
		if button != walk.LeftButton {
			return
		}

		if err := ni.ShowCustom(
			"自定义消息",
			"这是一个带图标的自定义消息."); err != nil {
			log.Fatal(err)
		}
	})

	// 菜单使用walk的,主程序为xcgui.
	exitAction := walk.NewAction()
	if err := exitAction.SetText("退出"); err != nil {
		log.Fatal(err)
	}
	exitAction.Triggered().Attach(func() {
		ni.Dispose()
		walk.App().Exit(0)
		xcgui.XExitXCGUI()
	})

	if err := ni.ContextMenu().Actions().Add(exitAction); err != nil {
		log.Fatal(err)
	}

	// 托盘图标默认为隐藏状态,需设置为显示。
	if err := ni.SetVisible(true); err != nil {
		log.Fatal(err)
	}

	// Now that the icon is visible, we can bring up an info balloon.
	if err := ni.ShowInfo("托盘", "正在运行中."); err != nil {
		log.Fatal(err)
	}

	// Run the message loop.
	xcgui.XRunXCGUI()
}