Exemple #1
0
bool wxGenericMDIParentFrame::ProcessEvent(wxEvent& event)
{
    if ( m_currentChild )
    {
        // the menu events should be given to the child as we show its menu bar
        // as our own
        const wxEventType eventType = event.GetEventType();
        if ( eventType == wxEVT_COMMAND_MENU_SELECTED ||
             eventType == wxEVT_UPDATE_UI )
        {
            // set the flag indicating that this event was forwarded to the
            // child from the parent and so shouldn't be propagated upwards if
            // not processed to avoid infinite loop
            m_childHandler = m_currentChild;
            wxON_BLOCK_EXIT_NULL(m_childHandler);

            if ( m_currentChild->ProcessWindowEvent(event) )
                return true;
        }
    }

    return wxMDIParentFrameBase::ProcessEvent(event);
}
Exemple #2
0
void ScopeGuardTestCase::BlockExitSetVar()
{
    m_count = 1;
    {
        wxON_BLOCK_EXIT_SET(m_count, 17);

        CPPUNIT_ASSERT_EQUAL( 1, m_count );
    }
    CPPUNIT_ASSERT_EQUAL( 17, m_count );


    int count = 1;
    {
        wxON_BLOCK_EXIT_SET(count, 17);

        CPPUNIT_ASSERT_EQUAL( 1, count );
    }
    CPPUNIT_ASSERT_EQUAL( 17, count );


    wxString s("hi");
    {
        wxON_BLOCK_EXIT_SET(s, "bye");

        CPPUNIT_ASSERT_EQUAL( "hi", s );
    }
    CPPUNIT_ASSERT_EQUAL( "bye", s );

    ScopeGuardTestCase *p = this;
    {
        wxON_BLOCK_EXIT_NULL(p);

        CPPUNIT_ASSERT( p );
    }
    CPPUNIT_ASSERT( !p );
}