コード例 #1
0
            virtual void ProcessEvent( EFlowEvent evt, SActivationInfo* pActInfo )
            {
                switch ( evt )
                {
                    case eFE_Suspend:
                        break;

                    case eFE_Resume:
                        break;

                    case eFE_Initialize:
                        INITIALIZE_OUTPUTS( pActInfo );
                        break;

                    case eFE_Activate:
                        {
                            if ( IsPortActive( pActInfo, EIP_ACTIVATE ) )
                            {
                                // get the view definition
                                std::string sPath = GetPortString( pActInfo, EIP_PATH );
                                m_sPathW.assign( sPath.begin(), sPath.end() );

                                // indicate that we have to create/update the view later
                                m_bViewNeedsUpdate = true;
                                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
                            }
                        }
                        break;

                    case eFE_Update:
                        // make sure the view is created, after the system is ready
                        if ( m_bViewNeedsUpdate &&  gCoherentUISystem->IsReady() )
                        {
                            if ( m_pViewListener )
                            {
                                // update only
                                Coherent::UI::View* view = m_pViewListener->GetView();
                                view->Load( m_sPathW.c_str() );
                                view->Reload( true );
                            }
                            else
                            {
                                // create
                                m_pViewListener = gCoherentUISystem->CreateHUDView( m_sPathW );
                            }
                            m_bViewNeedsUpdate = false;
                        }

                        // set the view id output after the view is available
                        if ( m_pViewListener )
                        {
                            Coherent::UI::View* view = m_pViewListener->GetView();
                            if ( view )
                            {
                                ActivateOutput<int>( pActInfo, EOP_VIEWID, view->GetId() );
                                // updates are not necessary until next initialization
                                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false );
                            }
                        }
                        break;
                }
            }