本文整理汇总了C#中Gwen.Control.Base.CloseMenus方法的典型用法代码示例。如果您正苦于以下问题:C# Base.CloseMenus方法的具体用法?C# Base.CloseMenus怎么用?C# Base.CloseMenus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gwen.Control.Base
的用法示例。
在下文中一共展示了Base.CloseMenus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMouseClicked
/// <summary>
/// Mouse click handler.
/// </summary>
/// <param name="canvas">Canvas.</param>
/// <param name="mouseButton">Mouse button number.</param>
/// <param name="down">Specifies if the button is down.</param>
/// <returns>True if handled.</returns>
public bool OnMouseClicked(Base canvas, int mouseButton, bool down)
{
// If we click on a control that isn't a menu we want to close
// all the open menus. Menus are children of the canvas.
if (down && (null == HoveredControl || !HoveredControl.IsMenuComponent))
{
canvas.CloseMenus();
}
if (null == HoveredControl) return false;
if (HoveredControl.GetCanvas() != canvas) return false;
if (!HoveredControl.IsVisible) return false;
if (HoveredControl == canvas) return false;
if (mouseButton > MaxMouseButtons)
return false;
if (mouseButton == 0)
m_KeyData.LeftMouseDown = down;
else if (mouseButton == 1)
m_KeyData.RightMouseDown = down;
// Double click.
// Todo: Shouldn't double click if mouse has moved significantly
bool isDoubleClick = false;
if (down &&
m_LastClickPos.X == MousePosition.X &&
m_LastClickPos.Y == MousePosition.Y &&
(Platform.Neutral.GetTimeInSeconds() - m_LastClickTime[mouseButton]) < DoubleClickSpeed)
{
isDoubleClick = true;
}
if (down && !isDoubleClick)
{
m_LastClickTime[mouseButton] = Platform.Neutral.GetTimeInSeconds();
m_LastClickPos = MousePosition;
}
if (down)
{
FindKeyboardFocus(HoveredControl);
}
HoveredControl.UpdateCursor();
// This tells the child it has been touched, which
// in turn tells its parents, who tell their parents.
// This is basically so that Windows can pop themselves
// to the top when one of their children have been clicked.
if (down)
HoveredControl.Touch();
if (MouseClicked!=null)
MouseClicked.Invoke(this, new EventArgs());
#if GWEN_HOOKSYSTEM
if (bDown)
{
if (Hook::CallHook(&Hook::BaseHook::OnControlClicked, HoveredControl, MousePosition.x,
MousePosition.y))
return true;
}
#endif
switch (mouseButton)
{
case 0:
{
if (DragAndDrop.OnMouseButton(HoveredControl, MousePosition.X, MousePosition.Y, down))
return true;
if (isDoubleClick)
HoveredControl.InputMouseDoubleClickedLeft(MousePosition.X, MousePosition.Y);
else
HoveredControl.InputMouseClickedLeft(MousePosition.X, MousePosition.Y, down);
return true;
}
case 1:
{
if (isDoubleClick)
HoveredControl.InputMouseDoubleClickedRight(MousePosition.X, MousePosition.Y);
else
HoveredControl.InputMouseClickedRight(MousePosition.X, MousePosition.Y, down);
return true;
}
}
return false;
}