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


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

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


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

示例1: OnKeyboardNavigation

void CQuickconnectBar::OnKeyboardNavigation(wxNavigationKeyEvent& event)
{
	if (event.GetDirection() && event.GetEventObject() == XRCCTRL(*this, "ID_QUICKCONNECT_DROPDOWN", wxButton))
	{
		event.SetEventObject(this);
		GetParent()->ProcessEvent(event);
	}
	else if (!event.GetDirection() && event.GetEventObject() == XRCCTRL(*this, "ID_QUICKCONNECT_HOST", wxTextCtrl))
	{
		event.SetEventObject(this);
		GetParent()->ProcessEvent(event);
	}
	else
		event.Skip();
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:15,代码来源:quickconnectbar.cpp

示例2: OnNavigationKey

void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
    if (event.IsWindowChange())
        AdvanceSelection( event.GetDirection() );
    else
        event.Skip();
}
开发者ID:CobaltBlues,项目名称:wxWidgets,代码行数:7,代码来源:notebook.cpp

示例3: OnNavigationKey

void wxTabNavigatorWindow::OnNavigationKey(wxNavigationKeyEvent &event)
{
	long selected = m_listBox->GetSelection();
	wxFlatNotebook* bk = static_cast<wxFlatNotebook*>(GetParent());
	long maxItems = bk->GetPageCount();
	long itemToSelect;
		
	if( event.GetDirection() )
	{
		// Select next page
		if (selected == maxItems - 1)
			itemToSelect = 0;
		else
			itemToSelect = selected + 1;
	}
	else
	{
		// Previous page
		if( selected == 0 )
			itemToSelect = maxItems - 1;
		else
			itemToSelect = selected - 1;
	}

	m_listBox->SetSelection( itemToSelect );
}
开发者ID:05storm26,项目名称:codelite,代码行数:26,代码来源:popup_dlg.cpp

示例4: 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

示例5: OnNavigationKey

void wxAuiNotebookEx::OnNavigationKey(wxNavigationKeyEvent& event)
{
	if (!event.IsWindowChange())
	{
		event.Skip();
		return;
	}

	AdvanceTab(event.GetDirection());
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:10,代码来源:aui_notebook_ex.cpp

示例6: OnNavigationKey

void cbAuiNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
#endif
{
    // if we change window, we call our own AdvanceSelection
    if ( event.IsWindowChange() )
        AdvanceSelection(event.GetDirection());
    else // otherwise we call the event-handler from the parent-class
    {
#if wxCHECK_VERSION(3, 0, 0)
        wxAuiNotebook::OnNavigationKeyNotebook(event);
#else
        wxAuiNotebook::OnNavigationKey(event);
#endif
    }
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:15,代码来源:cbauibook.cpp

示例7: OnNavigate

void wxTimeSpinCtrl::OnNavigate(wxNavigationKeyEvent &ev)
{
	if (wxWindow::FindFocus() == m_txt)
	{
		int tp = GetTimePart();
		if (ev.GetDirection())
			tp++;
		else
			tp--;
		if ((tp >= 0 && tp < 3) || (hasDay && tp == 3))
		{
			Highlight(tp);
			return;
		}
	}
	ev.Skip();
}
开发者ID:KrisShannon,项目名称:pgadmin3,代码行数:17,代码来源:timespin.cpp

示例8: 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

示例9: HandleOnNavigationKey

void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
{
    // for a TLW we shouldn't involve the parent window, it has nothing to do
    // with keyboard navigation inside this TLW
    wxWindow *parent = m_winParent->IsTopLevel() ? NULL
                                                 : m_winParent->GetParent();

    // the event is propagated downwards if the event emitter was our parent
    bool goingDown = event.GetEventObject() == parent;

    const wxWindowList& children = m_winParent->GetChildren();

    // if we have exactly one notebook-like child window (actually it could be
    // any window that returns true from its HasMultiplePages()), then
    // [Shift-]Ctrl-Tab and Ctrl-PageUp/Down keys should iterate over its pages
    // even if the focus is outside of the control because this is how the
    // standard MSW properties dialogs behave and we do it under other platforms
    // as well because it seems like a good idea -- but we can always put this
    // block inside "#ifdef __WXMSW__" if it's not suitable there
    if ( event.IsWindowChange() && !goingDown )
    {
        // check if we have a unique notebook-like child
        wxWindow *bookctrl = NULL;
        for ( wxWindowList::const_iterator i = children.begin(),
                                         end = children.end();
              i != end;
              ++i )
        {
            wxWindow * const window = *i;
            if ( window->HasMultiplePages() )
            {
                if ( bookctrl )
                {
                    // this is the second book-like control already so don't do
                    // anything as we don't know which one should have its page
                    // changed
                    bookctrl = NULL;
                    break;
                }

                bookctrl = window;
            }
        }

        if ( bookctrl )
        {
            // make sure that we don't bubble up the event again from the book
            // control resulting in infinite recursion
            wxNavigationKeyEvent eventCopy(event);
            eventCopy.SetEventObject(m_winParent);
            if ( bookctrl->GetEventHandler()->ProcessEvent(eventCopy) )
                return;
        }
    }

    // there is not much to do if we don't have children and we're not
    // interested in "notebook page change" events here
    if ( !children.GetCount() || event.IsWindowChange() )
    {
        // let the parent process it unless it already comes from our parent
        // of we don't have any
        if ( goingDown ||
             !parent || !parent->GetEventHandler()->ProcessEvent(event) )
        {
            event.Skip();
        }

        return;
    }

    // where are we going?
    const bool forward = event.GetDirection();

    // the node of the children list from which we should start looking for the
    // next acceptable child
    wxWindowList::compatibility_iterator node, start_node;

    // we should start from the first/last control and not from the one which
    // had focus the last time if we're propagating the event downwards because
    // for our parent we look like a single control
    if ( goingDown )
    {
        // just to be sure it's not used (normally this is not necessary, but
        // doesn't hurt neither)
        m_winLastFocused = NULL;

        // start from first or last depending on where we're going
        node = forward ? children.GetFirst() : children.GetLast();
    }
    else // going up
    {
        // try to find the child which has the focus currently

        // the event emitter might have done this for us
        wxWindow *winFocus = event.GetCurrentFocus();

        // but if not, we might know where the focus was ourselves
        if (!winFocus)
            winFocus = m_winLastFocused;

//.........这里部分代码省略.........
开发者ID:Anonymous2,项目名称:project64,代码行数:101,代码来源:containr.cpp

示例10: 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

示例11: OnNavigationKeyEvent

void CFilterConditionsDialog::OnNavigationKeyEvent(wxNavigationKeyEvent& event)
{
	wxWindow* source = FindFocus();
	if (!source)
	{
		event.Skip();
		return;
	}

	wxWindow* target = 0;

	if (event.GetDirection())
	{
		for (int i = 0; i < (int)m_filterControls.size(); i++)
		{
			if (m_filterControls[i].pType == source)
			{
				target = m_filterControls[i].pCondition;
				break;
			}
			if (m_filterControls[i].pCondition == source)
			{
				target = m_filterControls[i].pValue;
				if (!target)
					m_filterControls[i].pSet;
				break;
			}
			if (m_filterControls[i].pSet == source || m_filterControls[i].pValue == source)
			{
				target = m_filterControls[i].pRemove;
				break;
			}
			if (m_filterControls[i].pRemove == source)
			{
				int j = i + 1;
				if (j == (int)m_filterControls.size())
					target = m_pAdd;
				else
					target = m_filterControls[j].pType;
				break;
			}
		}
	}
	else
	{
		if (source == m_pAdd)
		{
			if (!m_filterControls.empty())
				target = m_filterControls[m_filterControls.size() - 1].pRemove;
		}
		else
		{

			for (int i = 0; i < (int)m_filterControls.size(); i++)
			{
				if (m_filterControls[i].pType == source)
				{
					if (i > 0)
						target = m_filterControls[i - 1].pRemove;
					break;
				}
				if (m_filterControls[i].pCondition == source)
				{
					target = m_filterControls[i].pType;
					break;
				}
				if (m_filterControls[i].pSet == source || m_filterControls[i].pValue == source)
				{
					target = m_filterControls[i].pCondition;
					break;
				}
				if (m_filterControls[i].pRemove == source)
				{
					target = m_filterControls[i].pValue;
					if (!target)
						m_filterControls[i].pSet;
					break;
				}
			}
		}
	}

	if (target)
		target->SetFocus();
	else
		event.Skip();
}
开发者ID:madnessw,项目名称:thesnow,代码行数:87,代码来源:filter_conditions_dialog.cpp

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