bool MvcBook::OpenModel(MvcModel* pModel) { if(!pModel) { System::LogMessage("MvcBook::OpenModel: pModel is NULL"); return false; } if(!m_pBook) { System::LogMessage("MvcBook::OpenModel: m_pBook is NULL"); return false; } AutoPtrT<MvcView> pView; pView.reset(pModel->CreateView()); if(!pView) { System::LogMessage("MvcBook::OpenModel: pModel->CreateView return NULL"); return false; } if(!pView->OnCreated()) { System::LogMessage("MvcBook::OpenModel: pView->Create return false"); return false; } if(!AttachView(pView.get())) return false; pView.release(); return true; }
void TGame::AfterInitialization() { nel::TTGUIApplication::AfterInitialization(); #ifdef USE_OVERLAY // add the overlay scene Overlay = std::make_shared<TOverlayView>(GameState); AttachView(Overlay); #endif // register our game states Factory.RegisterObjectType(SID_Splash, std::bind(&TGame::CreateState_Splash, this)); Factory.RegisterObjectType(SID_Menu, std::bind(&TGame::CreateState_Menu, this)); Factory.RegisterObjectType(SID_Options, std::bind(&TGame::CreateState_Options, this)); Factory.RegisterObjectType(SID_ServerSelect, std::bind(&TGame::CreateState_ServerSelect, this)); Factory.RegisterObjectType(SID_ServerConnect, std::bind(&TGame::CreateState_ServerConnect, this)); Factory.RegisterObjectType(SID_Lobby, std::bind(&TGame::CreateState_Lobby, this)); Factory.RegisterObjectType(SID_LoadMatch, std::bind(&TGame::CreateState_LoadMatch, this)); Factory.RegisterObjectType(SID_Play, std::bind(&TGame::CreateState_Play, this)); Factory.RegisterObjectType(SID_RoundEnd, std::bind(&TGame::CreateState_RoundEnd, this)); Factory.RegisterObjectType(SID_MatchEnd, std::bind(&TGame::CreateState_MatchEnd, this)); AddLogic(Server); AddLogic(Client); }
/** * Generate and register the icon for a given combination of states. * @param enabled @c true for the enabled state, @c false for disabled. * @param checked @c true for the checked state, @c false for unchecked. */ void BaseRadioButton::InitIcon(bool enabled, bool checked) { //TODO: Share this set of icons with all radio button instances. auto icon = std::make_shared<SymbolIcon>( 1, 1, // Size will be set the superclass in Layout(). checked ? Symbol::DOT_CIRCLE_O : Symbol::CIRCLE_O, enabled ? COLOR_WHITE : 0x7fffffff); icon->AttachView(display); SetStateIcon(enabled, checked, icon); }
bool MvcBook::OpenModel(MvcModel* pModel) { if(!pModel) { System::LogMessage("MvcBook::OpenModel: pModel is NULL"); return false; } if(!m_pBook) { System::LogMessage("MvcBook::OpenModel: m_pBook is NULL"); return false; } LockGuard<WndUpdator> lock(WndManager::current().wup); AutoPtrT<MvcView> pView; pView.reset(pModel->CreateView()); if(!pView) { System::LogMessage("MvcBook::OpenModel: pModel->CreateView return NULL"); return false; } if(!pView->OnCreated()) { System::LogMessage("MvcBook::OpenModel: pView->Create return false"); return false; } if(!AttachView(pView.get())) return false; pView.release(); return true; }