本文整理汇总了C++中Dialog::IsShown方法的典型用法代码示例。如果您正苦于以下问题:C++ Dialog::IsShown方法的具体用法?C++ Dialog::IsShown怎么用?C++ Dialog::IsShown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dialog
的用法示例。
在下文中一共展示了Dialog::IsShown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMouseControlledDialogCount
int32_t Screen::GetMouseControlledDialogCount()
{
Dialog *pDlg; int32_t iResult=0;
for (Element *pEl = GetFirst(); pEl; pEl = pEl->GetNext())
if (pDlg = pEl->GetDlg())
if (pDlg->IsShown() && pDlg->IsMouseControlled())
++iResult;
return iResult;
}
示例2:
Dialog *Screen::GetTopDialog()
{
// search backwards in component list
Dialog *pDlg;
for (Element *pEl = pLast; pEl; pEl = pEl->GetPrev())
if (pDlg = pEl->GetDlg())
if (pDlg->IsShown())
return pDlg;
// no dlg found
return NULL;
}
示例3: MouseInput
bool Screen::MouseInput(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, Dialog *pForDlg, class C4Viewport *pForVP)
{
// help mode and button pressed: Abort help and discard button
if (Game.MouseControl.IsHelp())
{
switch (iButton)
{
case C4MC_Button_None:
// just movement
break;
case C4MC_Button_LeftDown:
case C4MC_Button_RightDown:
// special for left/right down: Just ignore them, but don't stop help yet
// help should be stopped on button-up, so these won't be processed
iButton = C4MC_Button_None;
break;
default:
// buttons stop help
Game.MouseControl.AbortHelp();
iButton = C4MC_Button_None;
break;
}
}
// forward to mouse
Mouse.Input(iButton, iX, iY, dwKeyParam);
// dragging
if (Mouse.pDragElement)
{
int32_t iX2=iX, iY2=iY;
Mouse.pDragElement->ScreenPos2ClientPos(iX2, iY2);
if (!Mouse.IsLDown())
{
// stop dragging
Mouse.pDragElement->StopDragging(Mouse, iX2, iY2, dwKeyParam);
Mouse.pDragElement = NULL;
}
else
{
// continue dragging
Mouse.pDragElement->DoDragging(Mouse, iX2, iY2, dwKeyParam);
}
}
// backup previous MouseOver-element
Mouse.pPrevMouseOverElement = Mouse.pMouseOverElement;
Mouse.pMouseOverElement = NULL;
bool fProcessed = false;
// active context menu?
if (!pForVP && pContext && pContext->CtxMouseInput(Mouse, iButton, iX, iY, dwKeyParam))
{
// processed by context menu: OK!
}
// otherwise: active dlg and inside screen? (or direct forward to specific dlg/viewport dlg)
else if (rcBounds.Contains(iX, iY) || pForDlg || pForVP)
{
// context menu open but mouse down command issued? close context then
if (pContext && (iButton == C4MC_Button_LeftDown || iButton == C4MC_Button_RightDown))
AbortContext(true);
// get client pos
if (!pForDlg && !pForVP)
{
C4Rect &rcClientArea = GetClientRect();
iX -= rcClientArea.x; iY -= rcClientArea.y;
}
// exclusive mode: process active dialog only
if (IsExclusive() && !pForDlg && !pForVP)
{
if (pActiveDlg && pActiveDlg->IsVisible() && !pActiveDlg->IsFading())
{
// bounds check to dlg: only if not dragging
C4Rect &rcDlgBounds = pActiveDlg->GetBounds();
if (Mouse.IsLDown() || rcDlgBounds.Contains(iX, iY))
// forward to active dialog
pActiveDlg->MouseInput(Mouse, iButton, iX - rcDlgBounds.x, iY - rcDlgBounds.y, dwKeyParam);
else
Mouse.pMouseOverElement = NULL;
}
else
// outside dialog: own handling (for screen context menu)
Window::MouseInput(Mouse, iButton, iX, iY, dwKeyParam);
}
else
{
// non-exclusive mode: process all dialogs; make them active on left-click
Dialog *pDlg;
for (Element *pEl = pLast; pEl; pEl = pEl->GetPrev())
if (pDlg = pEl->GetDlg())
if (pDlg->IsShown())
{
// if specified: process specified dlg only
if (pForDlg && pDlg != pForDlg) continue;
// if specified: process specified viewport only
bool fIsExternalDrawDialog = pDlg->IsExternalDrawDialog();
C4Viewport *pVP = fIsExternalDrawDialog ? pDlg->GetViewport() : NULL;
if (pForVP && pForVP != pVP) continue;
// calc offset
C4Rect &rcDlgBounds = pDlg->GetBounds();
int32_t iOffX=0, iOffY=0;
// special handling for viewport dialogs
if (fIsExternalDrawDialog)
{
//.........这里部分代码省略.........