菜单是一个特殊的窗口,特殊在 在指定鼠标位置显示,焦点消失时,自动销毁,无任务栏图标等
我们看看,duilib是如何实现这些功能的
enum MenuAlignment { eMenuAlignment_Left = 1 << 1, eMenuAlignment_Top = 1 << 2, eMenuAlignment_Right = 1 << 3, eMenuAlignment_Bottom = 1 << 4, };
菜单类
extern const TCHAR* const kMenuElementUIInterfaceName;// = _T("MenuElement); class CMenuElementUI; class CMenuWnd : public ui::WindowImplBase { public: virtual Control* CreateControl(const std::wstring& pstrClass) override; enum PopupPosType { RIGHT_BOTTOM, RIGHT_TOP }; CMenuWnd(HWND hParent = NULL); void Init(STRINGorID xml, LPCTSTR pSkinType, POINT point, PopupPosType popupPosType = RIGHT_BOTTOM); std::wstring GetWindowClassName() const; LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM l
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/230144.html原文链接:https://javaforall.net
