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


C++ wxGetKeyState函数代码示例

本文整理汇总了C++中wxGetKeyState函数的典型用法代码示例。如果您正苦于以下问题:C++ wxGetKeyState函数的具体用法?C++ wxGetKeyState怎么用?C++ wxGetKeyState使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _onTimer

void ScrollableGamePanel::_onTimer(wxTimerEvent& evt)
{
    const int KEY_SENSITIVITY = 20;
    int x = m_pMapScrollX->GetThumbPosition();
    int y = m_pMapScrollY->GetThumbPosition();
    bool bChanges = false;
    
    if(wxGetKeyState(WXK_LEFT))
    {
        m_pMapScrollX->SetThumbPosition(std::max(0, x - KEY_SENSITIVITY));
        bChanges = true;
    }
    if(wxGetKeyState(WXK_RIGHT))
    {
        m_pMapScrollX->SetThumbPosition(std::min(m_pMapScrollX->GetRange(), x + KEY_SENSITIVITY));
        bChanges = true;
    }
    if(wxGetKeyState(WXK_UP))
    {
        m_pMapScrollY->SetThumbPosition(std::max(0, y - KEY_SENSITIVITY));
        bChanges = true;
    }
    if(wxGetKeyState(WXK_DOWN))
    {
        m_pMapScrollY->SetThumbPosition(std::min(m_pMapScrollY->GetRange(), y + KEY_SENSITIVITY));
        bChanges = true;
    }
    if (bChanges)
    {
        _positionMap();
    }
}
开发者ID:Delapouite,项目名称:corsix-th,代码行数:32,代码来源:scrollable_game.cpp

示例2: wxGetKeyState

void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
{
    shiftKey = wxGetKeyState(WXK_SHIFT);
    ctrlKey = wxGetKeyState(WXK_CONTROL);
    altKey = wxGetKeyState(WXK_ALT);
    metaKey = false;
}
开发者ID:Moondee,项目名称:Artemis,代码行数:7,代码来源:KeyboardEventWx.cpp

示例3: GeneralControl

bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
    bool eventHandled = true;

    // Filter out the 'fake' mouse motion after a keyboard movement
    if( !aHotKey && m_movingCursorWithKeyboard )
    {
        m_movingCursorWithKeyboard = false;
        return false;
    }

    // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
    // for next cursor position
    // ( shift or ctrl key down are PAN command with mouse wheel)
    bool snapToGrid = true;

    if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
        snapToGrid = false;

    wxPoint oldpos = GetCrossHairPosition();
    wxPoint pos = aPosition;
    GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );

    SetCrossHairPosition( pos, snapToGrid );
    RefreshCrossHair( oldpos, aPosition, aDC );

    if( aHotKey )
    {
        eventHandled = OnHotKey( aDC, aHotKey, aPosition );
    }

    UpdateStatusBar();

    return eventHandled;
}
开发者ID:flighta-zeng,项目名称:kicad-source-mirror,代码行数:35,代码来源:moduleframe.cpp

示例4: switch

void IncrementalSelectListDlg::OnKeyDown(wxKeyEvent& event)
{
    //Manager::Get()->GetLogManager()->Log(mltDevDebug, "OnKeyDown");
    size_t sel = 0;
    switch (event.GetKeyCode())
    {
        case WXK_RETURN:
        case WXK_NUMPAD_ENTER:
            EndModal(wxID_OK);
            break;

        case WXK_ESCAPE:
            EndModal(wxID_CANCEL);
            break;

        case WXK_UP:
        case WXK_NUMPAD_UP:
            sel = m_List->GetSelection() - 1;
            m_List->SetSelection(sel == (size_t) -1 ? 0 : sel);
            break;

        case WXK_DOWN:
        case WXK_NUMPAD_DOWN:
            m_List->SetSelection(m_List->GetSelection() + 1);
            break;

        case WXK_PAGEUP:
        case WXK_NUMPAD_PAGEUP:
            sel = m_List->GetSelection() - 10;
            m_List->SetSelection(sel > m_List->GetCount() ? 0 : sel);
            break;

        case WXK_PAGEDOWN:
        case WXK_NUMPAD_PAGEDOWN:
            sel = m_List->GetSelection() + 10;
            m_List->SetSelection(sel >= m_List->GetCount() ? m_List->GetCount() - 1 : sel);
            break;

        case WXK_HOME:
            if (wxGetKeyState(WXK_CONTROL))
                m_List->SetSelection(0);
            else
                event.Skip();
            break;

        case WXK_END:
            if (wxGetKeyState(WXK_CONTROL))
                m_List->SetSelection(m_List->GetCount() - 1);
            else
                event.Skip();
            break;

        default:
            event.Skip();
            break;
    }
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:57,代码来源:incrementalselectlistdlg.cpp

示例5: SetStatusText

void MyStatusBar::OnIdle(wxIdleEvent& event)
{
    SetStatusText(numlockIndicators[wxGetKeyState(WXK_NUMLOCK)],
                  Field_NumLockIndicator);
    SetStatusText(capslockIndicators[wxGetKeyState(WXK_CAPITAL)],
                  Field_CapsLockIndicator);

    event.Skip();
}
开发者ID:emutavchi,项目名称:pxCore,代码行数:9,代码来源:statbar.cpp

示例6: wxGetKeyState

void SelectionTool::OnCanvasLeftMouseButtonClick(const wxMouseEvent &event)
{
    auto positionOnMap = m_canvas.GetMousePositionOnMap(event.GetPosition());
    if (wxGetKeyState(MOVE_SELECTED_KEY)) return;
    if (wxGetKeyState(REMOVE_SELECTION_KEY))
    {
        m_selectionManager.PunctualUnselect(positionOnMap);
    }
    else
        m_selectionManager.PunctualSelect(positionOnMap, wxGetKeyState(ADD_SELECTION_KEY));
    m_mousePositionOnMap = m_canvas.GetMousePositionOnMap(event.GetPosition());
}
开发者ID:rzaba0,项目名称:polybobin,代码行数:12,代码来源:selectiontool.cpp

示例7: OnCharHook

void MyFrame::OnCharHook(wxKeyEvent& evt)
{
    bool handled = false;

    // This never gets called on OSX (since we moved to wxWidgets-3.0.0), so we
    // rely on the menu accelerators on the MyFrame to provide the keyboard
    // responses. For Windows and Linux, we keep this here so the keystrokes
    // work when other windows like the Drift Tool window have focus.

    if (evt.GetKeyCode() == 'B')
    {
        if (!evt.GetEventObject()->IsKindOf(wxCLASSINFO(wxTextCtrl)))
        {
            int modifiers;
#ifdef __WXOSX__
            modifiers = 0;
            if (wxGetKeyState(WXK_ALT))
                modifiers |= wxMOD_ALT;
            if (wxGetKeyState(WXK_CONTROL))
                modifiers |= wxMOD_CONTROL;
            if (wxGetKeyState(WXK_SHIFT))
                modifiers |= wxMOD_SHIFT;
            if (wxGetKeyState(WXK_RAW_CONTROL))
                modifiers |= wxMOD_RAW_CONTROL;
#else
            modifiers = evt.GetModifiers();
#endif
            if (!modifiers)
            {
                pGuider->ToggleShowBookmarks();
                bookmarks_menu->Check(MENU_BOOKMARKS_SHOW, pGuider->GetBookmarksShown());
                handled = true;
            }
            else if (modifiers == wxMOD_CONTROL)
            {
                pGuider->DeleteAllBookmarks();
                handled = true;
            }
            else if (modifiers == wxMOD_SHIFT)
            {
                pGuider->BookmarkLockPosition();
                handled = true;
            }
        }
    }

    if (!handled)
    {
        evt.Skip();
    }
}
开发者ID:xeqtr1982,项目名称:phd2,代码行数:51,代码来源:myframe_events.cpp

示例8: onMouseLeftDown

bool SelectShapesOP::onMouseLeftDown(int x, int y)
{
	m_bDraggable = true;

	Vector pos = m_editPanel->transPosScreenToProject(x, y);
	IShape* selected = m_shapeImpl->queryShapeByPos(pos);
	if (selected)
	{
		if (wxGetKeyState(WXK_CONTROL))
		{
			if (m_selection->isExist(selected))
				m_selection->erase(selected);
			else
			{
				m_selection->insert(selected);
				if (m_selection->size() == 1)
					m_propertyPanel->setPropertySetting(createPropertySetting(selected));
				else
					m_propertyPanel->setPropertySetting(createPropertySetting(NULL));
			}
		}
		else
		{
			if (!m_selection->isExist(selected))
			{
				m_selection->clear();
				m_selection->insert(selected);
				if (m_propertyPanel)
					m_propertyPanel->setPropertySetting(createPropertySetting(selected));
			}
		}
		m_firstPos.setInvalid();

		if (m_callback)
			m_callback->updateControlValue();
	}
	else
	{
		DrawRectangleOP::onMouseLeftDown(x, y);
		m_firstPos = pos;
		if (wxGetKeyState(WXK_CONTROL))
			m_bDraggable = false;
		else
			m_selection->clear();
		m_editPanel->Refresh();
	}

	return false;
}
开发者ID:jjiezheng,项目名称:drag2d,代码行数:49,代码来源:SelectShapesOP.cpp

示例9: OnDropObjects

bool wxGxTreeView::OnDropObjects(wxCoord x, wxCoord y, const wxArrayString& GxObjects)
{
    bool bMove = !wxGetKeyState(WXK_CONTROL);

    wxPoint pt(x, y);
    int flag = wxTREE_HITTEST_ONITEMINDENT;
    wxTreeItemId ItemId = wxTreeCtrl::HitTest(pt, flag);
    if(ItemId.IsOk())
    {
        SetItemDropHighlight(ItemId, false);

	    wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ItemId);
	    if(pData == NULL)
		    return wxDragNone;
        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pData->m_nObjectID);
        IGxDropTarget* pTarget = dynamic_cast<IGxDropTarget*>(pGxObject);

        if(pTarget)
        {
            wxDragResult res(bMove == true ? wxDragMove : wxDragCopy);
            if(wxIsDragResultOk(pTarget->CanDrop(res)))
                return pTarget->Drop(GxObjects, bMove);
        } 
    }
    return false;
}
开发者ID:Mileslee,项目名称:wxgis,代码行数:26,代码来源:gxtreeview.cpp

示例10: OnPluginKeyDown

void ExtImportPrefs::OnPluginKeyDown(wxListEvent& event)
{
   for (int i = 0; i < 1; i++)
   {
#ifdef __WXMAC__
      if (!mFakeKeyEvent && !wxGetKeyState(WXK_COMMAND))
         break;
#else
      if (!mFakeKeyEvent && !wxGetKeyState(WXK_CONTROL))
         break;
#endif
         
      if (DoOnPluginKeyDown (event.GetKeyCode()))
         event.Skip();
   }
}
开发者ID:Rubelislam9950,项目名称:Audacity,代码行数:16,代码来源:ExtImportPrefs.cpp

示例11: wxGetKeyState

//
// Watch for shift key changes
//
void ToolManager::OnTimer( wxTimerEvent & event )
{
   // Go ahead and set the event to propagate
   event.Skip();

   // Can't do anything if we're not dragging.  This also prevents
   // us from intercepting events that don't belong to us from the
   // parent since we're Connect()ed to a couple.
   if( !mDragWindow )
   {
      return;
   }

   bool state = wxGetKeyState( WXK_SHIFT );
   if( mLastState != state )
   {
      mLastState = state;

#if defined(__WXMAC__)
      // Disable window animation
      wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
#endif

      mIndicator->Show( !state );

#if defined(__WXMAC__)
      // Disable window animation
      wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
#endif
   }

   return;
}
开发者ID:GYGit,项目名称:Audacity,代码行数:36,代码来源:ToolManager.cpp

示例12: MyMenu

/**************************************************************
***
**   ContextMenuProvider   ---   getNewViewMenu
***
***************************************************************/
wxMenu *ContextMenuProvider::getNewViewMenu()
{
    const int vedicitems[] = { 0, CMD_CHILD_NEW_DASA, CMD_CHILD_NEW_GRAPHICALDASA, CMD_CHILD_NEW_TRANSIT,
                               0, CMD_CHILD_NEW_YOGA, CMD_CHILD_NEW_ASHTAKAVARGA,
                               CMD_CHILD_NEW_SOLAR, -1
                             };
    const int westernitems[5] = { 0, CMD_CHILD_NEW_URANIAN, CMD_CHILD_NEW_TRANSIT, CMD_CHILD_NEW_SOLAR, -1 };
    const int appitems[5] = { APP_SHOWEPHEM, APP_SHOWECLIPSE, APP_SHOWHORA, APP_NEW_PARTNER, -1 };

    MyMenu *menu = new MyMenu( _( "New View" ), view );
    bool vedicmode = view->isVedic();
    if ( wxGetKeyState( WXK_SHIFT )) vedicmode = ! vedicmode;

    if ( view->getDoc())
    {
        // Varga submenu or western chart
        if ( vedicmode ) menu->addVargaMenu();
        else menu->addItem( CMD_CHILD_NEW_WCHART );

        if ( vedicmode )
        {
            menu->addItem( CMD_CHILD_NEW_VARGA );
            menu->addItem( CMD_CHILD_NEW_SBC );
        }
        menu->addItem( CMD_CHILD_NEW_TEXT );
        menu->addArray( vedicmode ? vedicitems : westernitems );
    }
    else
    {
        menu->addArray( appitems );
    }
    return menu;
}
开发者ID:jun-zhang,项目名称:qt-utilities,代码行数:38,代码来源:MenuProvider.cpp

示例13: onTextFindEnter

/* FindReplacePanel::onTextFindEnter
 * Called when the enter key is pressed within the 'Find' text box
 *******************************************************************/
void FindReplacePanel::onTextFindEnter(wxCommandEvent& e)
{
	if (wxGetKeyState(WXK_SHIFT))
		text_editor->findPrev(getFindText(), getFindFlags());
	else
		text_editor->findNext(getFindText(), getFindFlags());
}
开发者ID:Gaerzi,项目名称:SLADE,代码行数:10,代码来源:TextEditor.cpp

示例14: switch

//---------------------------------------------------------
void CWKSP_Map_Control::On_Drag_End(wxTreeEvent &event)
{
	if( event.GetItem().IsOk()
	&& (((CWKSP_Base_Item *)GetItemData(m_draggedItem))->Get_Type() == WKSP_ITEM_Map_Layer
	 || ((CWKSP_Base_Item *)GetItemData(m_draggedItem))->Get_Type() == WKSP_ITEM_Map_Graticule
	 || ((CWKSP_Base_Item *)GetItemData(m_draggedItem))->Get_Type() == WKSP_ITEM_Map_BaseMap ) )
	{
		CWKSP_Map		*pDst_Map, *pSrc_Map;
		CWKSP_Base_Item	*pSrc, *pDst, *pCpy;

		pDst		= (CWKSP_Base_Item *)GetItemData(event.GetItem());
		pSrc		= (CWKSP_Base_Item *)GetItemData(m_draggedItem);
		pSrc_Map	= (CWKSP_Map *)pSrc->Get_Manager();

		switch( pDst->Get_Type() )
		{
		default:
			pDst_Map	= NULL;
			break;

		case WKSP_ITEM_Map:
			pDst_Map	= (CWKSP_Map *)pDst;
			pDst		= NULL;
			break;

		case WKSP_ITEM_Map_Layer:
		case WKSP_ITEM_Map_Graticule:
		case WKSP_ITEM_Map_BaseMap:
			pDst_Map	= (CWKSP_Map *)pDst->Get_Manager();
			break;
		}

		if( pDst_Map )
		{
			Freeze();

			if( pDst_Map == pSrc_Map )
			{
				pDst_Map->Move_To(pSrc, pDst);

				pDst_Map->View_Refresh(false);
			}
			else if( (pCpy = pDst_Map->Add_Copy(pSrc)) != NULL )
			{
				pDst_Map->Move_To(pCpy, pDst);

				if( pCpy && !wxGetKeyState(WXK_CONTROL) )
				{
					Del_Item(pSrc_Map, pSrc);
				}

				pDst_Map->View_Refresh(false);
			}

			Thaw();
		}
	}

	m_draggedItem	= (wxTreeItemId)0l;
}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:61,代码来源:wksp_map_control.cpp

示例15: ERROR_INFO

void MyFrame::OnSelectGear(wxCommandEvent& evt)
{
    try
    {
        if (CaptureActive)
        {
            throw ERROR_INFO("OnSelectGear called while CaptureActive");
        }

        if (pConfig->NumProfiles() == 1 && pGearDialog->IsEmptyProfile())
        {
            if (ConfirmDialog::Confirm(
                _("It looks like this is a first-time connection to your camera and mount. The Setup Wizard can help\n"
                  "you with that and will also establish baseline guiding parameters for your new configuration.\n"
                  "Would you like to use the Setup Wizard now?"),
                  "/use_new_profile_wizard", _("Yes"), _("No"), _("Setup Wizard Recommendation")))
            {
                pGearDialog->ShowProfileWizard(evt);
                return;
            }
        }

        pGearDialog->ShowGearDialog(wxGetKeyState(WXK_SHIFT));
    }
    catch (wxString Msg)
    {
        POSSIBLY_UNUSED(Msg);
    }
}
开发者ID:xeqtr1982,项目名称:phd2,代码行数:29,代码来源:myframe_events.cpp


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