コード例 #1
0
ファイル: frame.go プロジェクト: CodyGuo/xcgui
func OnWndButtonUp(nFlags uint32, pPt *xcgui.POINT, pbHandled *bool) int {
	pt := *pPt

	hMenu := xcgui.XMenu_Create()
	xcgui.XMenu_AddItem(hMenu, 201, "窗格1", 0, 0)
	xcgui.XMenu_AddItem(hMenu, 202, "窗格2", 0, 0)
	xcgui.XMenu_AddItem(hMenu, 203, "窗格3", 0, 0)

	xcgui.ClientToScreen(xcgui.XWnd_GetHWND(mw), &pt)
	xcgui.XMenu_Popup(hMenu, xcgui.XWnd_GetHWND(mw), pt.X, pt.Y, 0, 0)

	return 0
}
コード例 #2
0
ファイル: main.go プロジェクト: CodyGuo/xcgui
func onWndMenuSelect(nID int, pbHandled *bool) int {
	switch nID {
	case 1330:
		web.XWeb_LoadUrl(hWeb, "http://www.hupu.cn")
	case 1331:
		web.XWeb_Reload(hWeb)
	case 1332:
		web.XWeb_StopLoading(hWeb)
	case 1333:
		// web.XWeb_SetProxy(hWeb, proxyType, hostName, port, username, pwd)
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "代理", "请在源码中设置代理服务器.", xcgui.MB_ICONWARNING)
	case 1334:
		zom := web.XWeb_GetZoom(hWeb)
		zom += 0.3
		web.XWeb_Zoom(hWeb, zom)
	case 1335:
		zom := web.XWeb_GetZoom(hWeb)
		zom -= 0.3
		web.XWeb_Zoom(hWeb, zom)
	case 1336:
		web.XWeb_ZoomReset(hWeb)
	case 1337:
		pCookie := web.XWeb_GetCookie(hWeb)
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow),
			"Cookie", pCookie, xcgui.MB_ICONINFORMATION)
	case 1338:
		web.XWeb_LoadUrl(hWeb, "file://./jsCallFunction.html")
	case 1340:
		web.XWeb_SetEditable(hWeb, true)
	case 1341:
		web.XWeb_SetEditable(hWeb, false)
	case 1351:
		web.XWeb_RunJs(hWeb, "javascript: alert('JS: \n    炫彩界面库-golang.')")
	case 1352:
		if web.XWeb_IsDocumentReady(hWeb) {
			SetStat("网页加载完毕!")
		} else if web.XWeb_IsLoadingCompleted(hWeb) {
			SetStat("网页加载完成!")
		} else if web.XWeb_IsLoadingFailed(hWeb) {
			SetStat("网页加载失败!")
		}
	case 1353:
		fmt.Println("js模拟填写,还未完成.")
	case 1360:
		version := web.XWeb_GetVersionString()
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "版本", version, xcgui.MB_ICONINFORMATION)
	}

	return 0
}
コード例 #3
0
ファイル: notifyicon.go プロジェクト: CodyGuo/xcgui
func RunXCMenu() {
	var p xcgui.POINT
	xcgui.GetCursorPos(&p)
	hMenu := xcgui.XMenu_Create()
	xcgui.XMenu_AddItem(hMenu, 101, "炫彩菜单101", 0, xcgui.MENU_ITEM_FLAGS_POPUP)
	xcgui.XMenu_AddItem(hMenu, 102, "炫彩菜单102", 0, 0)
	xcgui.XMenu_AddItem(hMenu, 103, "炫彩菜单103", 0, 0)
	xcgui.XMenu_AddItem(hMenu, 104, "炫彩菜单104", 0, 0)
	xcgui.XMenu_AddItem(hMenu, 105, "炫彩菜单105", 0, 0)
	xcgui.XMenu_AddItem(hMenu, 106, "退出程序", 0, 0)

	xcgui.XMenu_AddItem(hMenu, 1011, "炫彩菜单101-1", 101, 0)
	xcgui.XMenu_AddItem(hMenu, 1012, "炫彩菜单101-2", 101, 0)

	xcgui.SetForegroundWindow(xcgui.XWnd_GetHWND(hWindow))
	xcgui.XMenu_Popup(hMenu, xcgui.XWnd_GetHWND(hWindow), p.X, p.Y, 0, 0)
}
コード例 #4
0
ファイル: menu.go プロジェクト: CodyGuo/xcgui
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
}
コード例 #5
0
ファイル: modal.go プロジェクト: CodyGuo/xcgui
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
}
コード例 #6
0
ファイル: notifyicon.go プロジェクト: CodyGuo/xcgui
func OnWndMenuSelect(nID int, pBool bool) int {
	switch nID {
	case 1011:
		ni.ShowInfo("提示信息", "炫彩菜单101-1")
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "提示信息", "炫彩菜单101-1", xcgui.MB_ICONINFORMATION)
	case 1012:
		ni.ShowWarning("警告信息", "炫彩菜单101-2")
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "警告信息", "炫彩菜单101-2", xcgui.MB_ICONWARNING)
	case 102:
		ni.ShowError("错误信息", "炫彩菜单102")
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "错误信息", "炫彩菜单102", xcgui.MB_ICONERROR)
	case 106:
		ni.ShowMessage("退出程序", "正在退出程序...")
		ni.Dispose()
		walk.App().Exit(0)
		xcgui.XExitXCGUI()
	default:
		ni.ShowMessage("其他信息", "您选择的菜单:"+fmt.Sprint(nID))
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "其他信息", "您选择了其他菜单.", xcgui.MB_USERICON)
	}

	return 0
}
コード例 #7
0
ファイル: main.go プロジェクト: CodyGuo/xcgui
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()
}
コード例 #8
0
ファイル: window.go プロジェクト: CodyGuo/xcgui
func (wb *WindowBase) Handle() xc.HWND {
	wb.hWnd = xc.XWnd_GetHWND(wb.hWindow)
	return wb.hWnd
}
コード例 #9
0
ファイル: main.go プロジェクト: CodyGuo/xcgui
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()
}
コード例 #10
0
ファイル: main.go プロジェクト: CodyGuo/xcgui
func onLButtonDown(nFlags uint32, pPt *xcgui.POINT, pbHandled *bool) int {
	win.SetFocus(win.HWND(xcgui.XWnd_GetHWND(hWindow)))

	return 0
}
コード例 #11
0
ファイル: imageviewer.go プロジェクト: CodyGuo/xcgui
// 重载,返回炫彩窗口句柄
func (mw *MyMainWindow) Handle() win.HWND {
	return win.HWND(xcgui.XWnd_GetHWND(mw.hWindow))
}