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


C++ wxNavigationKeyEvent::SetCurrentFocus方法代码示例

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


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

示例1: OnNavigationKey

void Notebook::OnNavigationKey(wxNavigationKeyEvent &e)
{
	CustomTab *tab(NULL);
	if ( e.IsWindowChange() ) {
		if ( !m_popupWin && GetPageCount() > 0) {
			m_popupWin = new NotebookNavDialog( this );
			if(m_popupWin->ShowModal() == wxID_OK && m_popupWin->GetSelection()){
				tab = m_popupWin->GetSelection();
				size_t idx = m_tabs->TabToIndex(tab);
				SetSelection(idx);
			}

			m_popupWin->Destroy();
			m_popupWin = NULL;

			if(tab) {
				tab->GetWindow()->SetFocus();
			}

		} else if ( m_popupWin ) {
			// a dialog is already opened
			m_popupWin->OnNavigationKey(e);
			return;
		}
	} else {
		// pass to the parent
		if ( GetParent() ) {
			e.SetCurrentFocus(this);
			GetParent()->GetEventHandler()->ProcessEvent(e);
		}
	}
}
开发者ID:RVictor,项目名称:EmbeddedLite,代码行数:32,代码来源:custom_notebook.cpp

示例2: OnNavigationKey

void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
    if ( event.IsWindowChange() )
    {
        // change pages
        AdvanceSelection( event.GetDirection() );
    }
    else
    {
        // we get this event in 2 cases
        //
        // a) one of our pages might have generated it because the user TABbed
        // out from it in which case we should propagate the event upwards and
        // our parent will take care of setting the focus to prev/next sibling
        //
        // or
        //
        // b) the parent panel wants to give the focus to us so that we
        // forward it to our selected page. We can't deal with this in
        // OnSetFocus() because we don't know which direction the focus came
        // from in this case and so can't choose between setting the focus to
        // first or last panel child
        wxWindow *parent = GetParent();

        // the cast is here to fix a GCC ICE
        if ( ((wxWindow*)event.GetEventObject()) == parent )
        {
            // no, it doesn't come from child, case (b): forward to a page
            if ( m_selection != wxNOT_FOUND )
            {
                // so that the page knows that the event comes from it's parent
                // and is being propagated downwards
                event.SetEventObject( this );

                wxWindow *page = m_pages[m_selection];
                if ( !page->HandleWindowEvent( event ) )
                {
                    page->SetFocus();
                }
                //else: page manages focus inside it itself
            }
            else
            {
                // we have no pages - still have to give focus to _something_
                SetFocus();
            }
        }
        else
        {
            // it comes from our child, case (a), pass to the parent
            if ( parent )
            {
                event.SetCurrentFocus( this );
                parent->HandleWindowEvent( event );
            }
        }
    }
}
开发者ID:cwalther,项目名称:wxWidgets,代码行数:58,代码来源:notebook_osx.cpp

示例3: OnNavigationKey

void wxFlatNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
	if ( event.IsWindowChange() )
	{
		if( HasFlag(wxFNB_SMART_TABS) )
		{
			if( !m_popupWin && GetPageCount() > 0)
			{
				m_popupWin = new wxTabNavigatorWindow( this );
				m_popupWin->ShowModal();
				m_popupWin->Destroy();
				SetSelection((size_t)GetSelection());
				m_popupWin = NULL;
			}
			else if( m_popupWin )
			{
				// a dialog is already opened
				m_popupWin->OnNavigationKey( event );
				return;
			}
		}
		else
		{
			// change pages
			AdvanceSelection(event.GetDirection());
		}
	}
	else
	{
		// pass to the parent
		if ( GetParent() )
		{
			event.SetCurrentFocus(this);
			#if wxCHECK_VERSION(2, 9, 0)
			GetParent()->GetEventHandler()->ProcessEvent(event);
			#else
			GetParent()->ProcessEvent(event);
			#endif
		}
	}
}
开发者ID:stahta01,项目名称:codeAdapt_IDE,代码行数:41,代码来源:wxFlatNotebook.cpp

示例4: HandleOnNavigationKey


//.........这里部分代码省略.........
    for ( ;; )
    {
        // don't go into infinite loop
        if ( start_node && node && node == start_node )
            break;

        // Have we come to the last or first item on the panel?
        if ( !node )
        {
            if ( !start_node )
            {
                // exit now as otherwise we'd loop forever
                break;
            }

            if ( !goingDown )
            {
                // Check if our (maybe grand) parent is another panel: if this
                // is the case, they will know what to do with this navigation
                // key and so give them the chance to process it instead of
                // looping inside this panel (normally, the focus will go to
                // the next/previous item after this panel in the parent
                // panel).
                wxWindow *focusedParent = m_winParent;
                while ( parent )
                {
                    // We don't want to tab into a different dialog or frame or
                    // even an MDI child frame, so test for this explicitly
                    // (and in particular don't just use IsTopLevel() which
                    // would return false in the latter case).
                    if ( focusedParent->IsTopNavigationDomain() )
                        break;

                    event.SetCurrentFocus( focusedParent );
                    if ( parent->GetEventHandler()->ProcessEvent( event ) )
                        return;

                    focusedParent = parent;

                    parent = parent->GetParent();
                }
            }
            //else: as the focus came from our parent, we definitely don't want
            //      to send it back to it!

            // no, we are not inside another panel so process this ourself
            node = forward ? children.GetFirst() : children.GetLast();

            continue;
        }

        wxWindow *child = node->GetData();

        // don't TAB to another TLW
        if ( child->IsTopLevel() )
        {
            node = forward ? node->GetNext() : node->GetPrevious();

            continue;
        }

#if defined(__WXMSW__) && wxUSE_RADIOBTN
        if ( event.IsFromTab() )
        {
            if ( wxIsKindOf(child, wxRadioButton) )
            {
开发者ID:Anonymous2,项目名称:project64,代码行数:67,代码来源:containr.cpp

示例5: OnNavigationKey

void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
    if ( event.IsWindowChange() ) {
        // change pages
        AdvanceSelection(event.GetDirection());
    }
    else {
        // we get this event in 3 cases
        //
        // a) one of our pages might have generated it because the user TABbed
        // out from it in which case we should propagate the event upwards and
        // our parent will take care of setting the focus to prev/next sibling
        //
        // or
        //
        // b) the parent panel wants to give the focus to us so that we
        // forward it to our selected page. We can't deal with this in
        // OnSetFocus() because we don't know which direction the focus came
        // from in this case and so can't choose between setting the focus to
        // first or last panel child
        //
        // or
        //
        // c) we ourselves (see MSWTranslateMessage) generated the event
        //
        wxWindow * const parent = GetParent();

        // the wxObject* casts are required to avoid MinGW GCC 2.95.3 ICE
        const bool isFromParent = event.GetEventObject() == (wxObject*) parent;
        const bool isFromSelf = event.GetEventObject() == (wxObject*) this;
        const bool isForward = event.GetDirection();

        if ( isFromSelf && !isForward )
        {
            // focus is currently on notebook tab and should leave
            // it backwards (Shift-TAB)
            event.SetCurrentFocus(this);
            parent->HandleWindowEvent(event);
        }
        else if ( isFromParent || isFromSelf )
        {
            // no, it doesn't come from child, case (b) or (c): forward to a
            // page but only if entering notebook page (i.e. direction is
            // backwards (Shift-TAB) comething from out-of-notebook, or
            // direction is forward (TAB) from ourselves),
            if ( m_selection != wxNOT_FOUND &&
                    (!event.GetDirection() || isFromSelf) )
            {
                // so that the page knows that the event comes from it's parent
                // and is being propagated downwards
                event.SetEventObject(this);

                wxWindow *page = m_pages[m_selection];
                if ( !page->HandleWindowEvent(event) )
                {
                    page->SetFocus();
                }
                //else: page manages focus inside it itself
            }
            else // otherwise set the focus to the notebook itself
            {
                SetFocus();
            }
        }
        else
        {
            // it comes from our child, case (a), pass to the parent, but only
            // if the direction is forwards. Otherwise set the focus to the
            // notebook itself. The notebook is always the 'first' control of a
            // page.
            if ( !isForward )
            {
                SetFocus();
            }
            else if ( parent )
            {
                event.SetCurrentFocus(this);
                parent->HandleWindowEvent(event);
            }
        }
    }
}
开发者ID:chromylei,项目名称:third_party,代码行数:82,代码来源:notebook.cpp

示例6: OnNavigationKey

void wxNotebook::OnNavigationKey (
  wxNavigationKeyEvent&             rEvent
)
{
    if (rEvent.IsWindowChange())
    {
        //
        // Change pages
        //
        AdvanceSelection(rEvent.GetDirection());
    }
    else
    {
        //
        // We get this event in 2 cases
        //
        // a) one of our pages might have generated it because the user TABbed
        // out from it in which case we should propagate the event upwards and
        // our parent will take care of setting the focus to prev/next sibling
        //
        // or
        //
        // b) the parent panel wants to give the focus to us so that we
        // forward it to our selected page. We can't deal with this in
        // OnSetFocus() because we don't know which direction the focus came
        // from in this case and so can't choose between setting the focus to
        // first or last panel child
        //
        wxWindow*                   pParent = GetParent();

        if (rEvent.GetEventObject() == pParent)
        {
            //
            // No, it doesn't come from child, case (b): forward to a page
            //
            if (m_nSelection != -1)
            {
                //
                // So that the page knows that the event comes from it's parent
                // and is being propagated downwards
                //
                rEvent.SetEventObject(this);

                wxWindow*           pPage = m_pages[m_nSelection];

                if (!pPage->GetEventHandler()->ProcessEvent(rEvent))
                {
                    pPage->SetFocus();
                }
                //else: page manages focus inside it itself
            }
            else
            {
                //
                // We have no pages - still have to give focus to _something_
                //
                SetFocus();
            }
        }
        else
        {
            //
            // It comes from our child, case (a), pass to the parent
            //
            if (pParent)
            {
                rEvent.SetCurrentFocus(this);
                pParent->GetEventHandler()->ProcessEvent(rEvent);
            }
        }
    }
} // end of wxNotebook::OnNavigationKey
开发者ID:hgwells,项目名称:tive,代码行数:72,代码来源:notebook.cpp


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