本文整理汇总了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();
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例5: SetStatusText
void MyStatusBar::OnIdle(wxIdleEvent& event)
{
SetStatusText(numlockIndicators[wxGetKeyState(WXK_NUMLOCK)],
Field_NumLockIndicator);
SetStatusText(capslockIndicators[wxGetKeyState(WXK_CAPITAL)],
Field_CapsLockIndicator);
event.Skip();
}
示例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());
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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);
}
}