当前位置: 首页>>代码示例>>C++>>正文


C++ ToggleButton::SetIsEnabled方法代码示例

本文整理汇总了C++中ToggleButton::SetIsEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ ToggleButton::SetIsEnabled方法的具体用法?C++ ToggleButton::SetIsEnabled怎么用?C++ ToggleButton::SetIsEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ToggleButton的用法示例。


在下文中一共展示了ToggleButton::SetIsEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mRoot

TicTacToeLogic::TicTacToeLogic(Noesis::Gui::FrameworkElement* uiRoot): mRoot(uiRoot)
{
    NS_ASSERT(mRoot);

    mBoardPanel = NsStaticCast<FrameworkElement*>(mRoot->FindName("Board"));
    NS_ASSERT(mBoardPanel);
    mBoardPanel->MouseLeftButtonDown() += MakeDelegate(this, &TicTacToeLogic::BoardClicked);

    for (NsSize row = 0; row < 3; ++row)
    {
        for (NsSize col = 0; col < 3; ++col)
        {
            NsString cellName = NsString::Format("Cell%u%u", row, col);

            ToggleButton* btn = NsStaticCast<ToggleButton*>(mRoot->FindName(cellName.c_str()));
            NS_ASSERT(btn);

            Cell& cell = mBoard[row][col];
            cell.btn = btn;

            Ptr<Boxing::BoxedValue> boxedCell = Boxing::Box<Cell*>(&cell);
            btn->SetTag(boxedCell.GetPtr());
            btn->SetIsEnabled(false);
            btn->Checked() += MakeDelegate(this, &TicTacToeLogic::CellChecked);
        }
    }

    mStatusText = NsStaticCast<TextBlock*>(mRoot->FindName("StatusText"));
    NS_ASSERT(mStatusText);

    mScorePlayer1Text = NsStaticCast<TextBlock*>(mRoot->FindName("ScorePlayer1"));
    NS_ASSERT(mScorePlayer1Text);

    mScorePlayer2Text = NsStaticCast<TextBlock*>(mRoot->FindName("ScorePlayer2"));
    NS_ASSERT(mScorePlayer2Text);

    mScoreTiesText = NsStaticCast<TextBlock*>(mRoot->FindName("ScoreTies"));
    NS_ASSERT(mScoreTiesText);

    mScoreText = 0;

    Ptr<ResourceKeyString> key;

    key = ResourceKeyString::Create("WinAnim");
    mWinAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));
    mWinAnimation->Completed() += MakeDelegate(this, &TicTacToeLogic::WinAnimationCompleted);

    key = ResourceKeyString::Create("TieAnim");
    mTieAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));
    mTieAnimation->Completed() += MakeDelegate(this, &TicTacToeLogic::TieAnimationCompleted);

    key = ResourceKeyString::Create("ResetAnim");
    mResetAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));
    mResetAnimation->Completed() += MakeDelegate(this, &TicTacToeLogic::ResetAnimationCompleted);

    key = ResourceKeyString::Create("ProgressAnim");
    mProgressAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));

    key = ResourceKeyString::Create("ProgressFadeAnim");
    mProgressFadeAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));
    mProgressFadeAnimation->Completed() += MakeDelegate(this,
        &TicTacToeLogic::ProgressFadeAnimationCompleted);

    key = ResourceKeyString::Create("ScoreHalfAnim");
    mScoreHalfAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));
    mScoreHalfAnimation->Completed() += MakeDelegate(this,
        &TicTacToeLogic::ScoreHalfAnimationCompleted);

    key = ResourceKeyString::Create("ScoreEndAnim");
    mScoreEndAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));

    key = ResourceKeyString::Create("StatusHalfAnim");
    mStatusHalfAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));
    mStatusHalfAnimation->Completed() += MakeDelegate(this,
        &TicTacToeLogic::StatusHalfAnimationCompleted);

    key = ResourceKeyString::Create("StatusEndAnim");
    mStatusEndAnimation = NsStaticCast<Storyboard*>(mRoot->FindResource(key.GetPtr()));

    mStatusText->SetText("Player 1 Turn");
    mPlayer = Player_1;
    mLastStarterPlayer = Player_1;
    mScorePlayer1 = 0;
    mScorePlayer2 = 0;
    mScoreTies = 0;
    mScore = 0;

    StartGame();
}
开发者ID:bitdesign,项目名称:OgreBindings,代码行数:89,代码来源:TicTacToeLogic.cpp


注:本文中的ToggleButton::SetIsEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。