move win menu bar to sysmenu

This commit is contained in:
chuanweizhang2013 2014-05-06 17:03:40 +08:00
parent cd7ea468e8
commit c3d7465cc7
5 changed files with 42 additions and 17 deletions

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="con" path="org.eclipse.koneki.ldt.ExecutionEnvironmentContainer/cocos2dx/3.0-rc0"/>
</buildpath>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CocosGame</name>
<name>HelloLua</name>
<comment></comment>
<projects>
</projects>

View File

@ -124,7 +124,7 @@
"src_project_name": "HelloLua",
"files": [
"res/config.json",
".project",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",

View File

@ -45,9 +45,8 @@ INT_PTR CALLBACK AboutDialogCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
void createViewMenu()
{
HMENU menu = GetMenu(glfwGetWin32Window(g_eglView->getWindow()));
HMENU viewMenu = GetSubMenu(menu, 1);
HMENU hSysMenu = GetSystemMenu(glfwGetWin32Window(g_eglView->getWindow()), FALSE);
HMENU viewMenu = GetSubMenu(hSysMenu, 8);
for (int i = ConfigParser::getInstance()->getScreenSizeCount() - 1; i >= 0; --i)
{
SimulatorScreenSize size = ConfigParser::getInstance()->getScreenSize(i);
@ -69,8 +68,8 @@ void createViewMenu()
void updateMenu()
{
HMENU menu = GetMenu(glfwGetWin32Window(g_eglView->getWindow()));
HMENU viewMenu = GetSubMenu(menu, 1);
HMENU hSysMenu = GetSystemMenu(glfwGetWin32Window(g_eglView->getWindow()), FALSE);
HMENU viewMenu = GetSubMenu(hSysMenu, 8);
if (g_landscape)
{
@ -211,13 +210,34 @@ void shutDownApp()
::SendMessage(hWnd,WM_CLOSE,NULL,NULL);
}
void reStart()
{
PROCESS_INFORMATION info;
STARTUPINFO startup;
TCHAR szPath[128]={0};
TCHAR *szCmdLine=NULL;
GetModuleFileName(NULL, szPath, sizeof(szPath));
szCmdLine = GetCommandLine();
GetStartupInfo(&startup);
BOOL bSucc = CreateProcess(szPath, szCmdLine, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &info);
if(bSucc)
{
ExitProcess(-1);
}
}
/*@brief new windows process*/
LRESULT CALLBACK SNewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
switch (message)
{
case WM_COMMAND:
case WM_KEYDOWN:
if (wParam == VK_F5)
{
reStart();
break;
}
case WM_SYSCOMMAND:
{
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
@ -241,19 +261,19 @@ LRESULT CALLBACK SNewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
break;
case ID_CONTROL_RELOAD:
reloadScript("");
reStart();
break;
case ID_HELP_ABOUT:
onHelpAbout();
break;
default:
if (wmId >= ID_VIEW_SIZE && wmId <= ID_VIEW_SIZE + ConfigParser::getInstance()->getScreenSizeCount() - 1)
{
onViewChangeFrameSize(wmId);
break;
}
return 0;
//return 0;
}
}
break;
@ -301,7 +321,16 @@ void createSimulator(const char* viewName, float width, float height, float fram
HWND hWnd=glfwGetWin32Window(g_eglView->getWindow());
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU_COCOS));
SetMenu(hWnd, hMenu);
HMENU hSysMenu = GetSystemMenu(hWnd, FALSE);
HMENU hviewMenu = GetSubMenu(hMenu,1);
HMENU hcontrolMenu = GetSubMenu(hMenu,2);
AppendMenu(hSysMenu,MF_SEPARATOR,0,NULL);
if (hSysMenu != INVALID_HANDLE_VALUE && hMenu != INVALID_HANDLE_VALUE)
{
AppendMenu(hSysMenu, MF_POPUP, (UINT)hviewMenu, TEXT("view"));
AppendMenu(hSysMenu, MF_POPUP, (UINT)hcontrolMenu, TEXT("control"));
}
//SetMenu(hWnd, hMenu);
createViewMenu();
updateMenu();

View File

@ -65,7 +65,7 @@ BEGIN
END
POPUP "&Control"
BEGIN
MENUITEM "Reload", ID_CONTROL_RELOAD
MENUITEM "Restart(F5)", ID_CONTROL_RELOAD
END
POPUP "&Help"
BEGIN