📄 trayiconmenu.h
字号:
/*
* Openmysee
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _C_CTRAYICONMENU_H
#define _C_CTRAYICONMENU_H
#pragma once
class CTrayIconMenu
{
public:
CTrayIconMenu(void);
~CTrayIconMenu(void);
//////////////////////////////////预设的菜单命令常数////////////////////////
enum MENUCMDID
{
ID_POPUP = 0, //子菜单
ID_SEPERATOR = 1, //分隔线
ID_EXTERNAL = 2, //外部加入的子菜单
ID_LANGUAGE = 3, //多语言选择子菜单
ID_END = -1, //菜单终了
};
////////////////////////////////////////////////////////////////////
BOOL ShowMenu(HWND hparent, const UINT_PTR* p_cmdID, const TCHAR* p_cmdstr);
BOOL OnMenuPopup(HMENU hmenu, int pos);
LANGID GetCurLanguage(){return m_curLanguage;}
protected:
HWND hWnd; //父窗口
LANGID m_curLanguage; //菜单语言
HMENU h_popup; //当前的弹出窗口
HMENU MakeLanguageMenu(); //生成语言栏的子菜单
//菜单操作函数//
void GetMenuStr(LPTSTR p_buf, UINT size);
HMENU MakeMenu(const UINT_PTR*& p_cmdID, const TCHAR*& p_cmdstr); //用p_cmdID和p_cmdstr的数据生成一个菜单
void ReleaseMenu(HMENU hmenu, const UINT_PTR*& p_cmdID); //释放菜单。避免使用ID_EXTERNAL连接入的菜单被破坏
BOOL ShowMenu(const UINT_PTR* p_traycmd, const TCHAR* p_traystr); //实际地显示菜单
//菜单UI处理函数//
virtual UINT MenuUI(UINT m_cmdID); //获得某个命令在菜单上的UI,比如check或者grayed
//菜单命令处理函数//
virtual BOOL MenuCommand(UINT m_cmdID);
//实际的命令处理函数
BOOL OnSwitchLanguageEx(UINT m_language);
};
//语言菜单命令常数
enum TRAYCMDID
{
TRAYWM_LANGUAGECHANGE = WM_APP + 99,
TRAYWM_LANGUAGESTART = WM_APP + 100,
TRAYWM_LANGUAGEEND = WM_APP + 150,
};
enum LANGUAGE_ID{
DEFAULT_LANG_ID = 0x0409, // 默认语言
HONGKONG_LANG_ID = 0x0c04, // 香港默认语言
TAIWAN_LANG_ID = 0x0404, // 台湾默认语言
MAINLAND_LANG_ID = 0x0804, // 内地默认语言
MAX_KEY_BUFFER = 80, // 字符语言ID的长度限制
};
/*const UINT_PTR m_traycmd[] =
{CTrayIconMenu::ID_EXTERNAL, 0, CTrayIconMenu::ID_SEPERATOR,
TRAYWM_ABOUT, CTrayIconMenu::ID_SEPERATOR,
TRAYWM_HELP, CTrayIconMenu::ID_SEPERATOR,
TRAYWM_UPDATE, CTrayIconMenu::ID_SEPERATOR,
CTrayIconMenu::ID_POPUP,
TRAYWM_LANGUAGESTART, TRAYWM_LANGUAGESTART + 1, TRAYWM_LANGUAGESTART + 2,
CTrayIconMenu::ID_END,
CTrayIconMenu::ID_SEPERATOR,
TRAYWM_EXIT,
CTrayIconMenu::ID_END};*/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -