📄 popupmenu.hpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#pragma once
#ifndef __POPUPMENU_HPP__
#define __POPUPMENU_HPP__
#include "Controls.hpp"
#include "CommonControl.hpp"
#include <vector.hxx>
class PopupMenuItem_t;
class PopupMenuImpl_t :
public CommonControlImpl_t<PopupMenuImpl_t, PopupMenu_t>
{
public:
PopupMenuImpl_t();
~PopupMenuImpl_t();
//implementation for CommonControlImpl_t
DECLARE_NO_SUPERCLASS();
LRESULT ControlWindowProc(
UINT Message,
WPARAM wParam,
LPARAM lParam,
bool& Handled
);
HRESULT
SetMenuItemInfo(
UINT MenuItemId,
__in const MENUITEMINFO* pInfo
);
private:
int
GetVisibleItems(
void
);
//message handlers
LRESULT
OnCreate(
__in CREATESTRUCT* pCreateStruct
);
LRESULT
OnKeydown(
WPARAM wParam,
LPARAM lParam
);
LRESULT
OnKillFocus(
WPARAM wParam,
LPARAM lParam
);
LRESULT
OnLButtonDown(
WPARAM wParam,
LPARAM lParam
);
LRESULT
OnPaint(
HDC hdc
);
LRESULT
OnSetFocus(
WPARAM wParam,
LPARAM lParam
);
LRESULT
OnCalculateDimensions(
__out SIZE* pDimensions
);
LRESULT
OnInsertItem(
__in PopupMenuItem_t* pItem
);
LRESULT
OnSetFlyoutParent(
HWND FlyoutParent
);
//helper functions
bool
SetCurrentSelection(
int NewSelection
);
void GetItemRect(
int Index,
__in RECT* pRect
);
void
OnItemActivated(
void
);
void
HidePopupMenus(
void
);
void
HideMyselfOnly(
void
);
private:
ce::vector<PopupMenuItem_t*> m_Items;
int m_TopItem;
int m_SelectedItem;
int m_MaxNumberOfVisibleItems;
bool m_HideMyselfOnly;
bool m_IsInputMenu;
HMENU m_hMenu;
PopupMenu_t m_ParentPopup;
PopupMenu_t m_ChildPopup;
MenuBar_t m_MenuBar;
};
#endif // !defined __POPUPMENU_HPP__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -