• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxKeyEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: OnKeyEvent

void CFilterDialog::OnKeyEvent(wxKeyEvent& event)
{
	m_shiftClick = event.ShiftDown();
	event.Skip();
}
开发者ID:ErichKrause,项目名称:filezilla,代码行数:5,代码来源:filter.cpp


示例2: OnChar

bool VikeWin::OnChar(wxKeyEvent &event)
{
    bool skip = func->NormalKeyHandler(this, event);
    GeneralHandler(event.GetKeyCode(), skip);
    return skip;
}
开发者ID:KurumiSerori,项目名称:cbvike,代码行数:6,代码来源:cbvike.cpp


示例3: OnKeyDown

void wxVListBox::OnKeyDown(wxKeyEvent& event)
{
    // flags for DoHandleItemClick()
    int flags = ItemClick_Kbd;

    int current;
    switch ( event.GetKeyCode() )
    {
        case WXK_HOME:
        case WXK_NUMPAD_HOME:
            current = 0;
            break;

        case WXK_END:
        case WXK_NUMPAD_END:
            current = GetRowCount() - 1;
            break;

        case WXK_DOWN:
        case WXK_NUMPAD_DOWN:
            if ( m_current == (int)GetRowCount() - 1 )
                return;

            current = m_current + 1;
            break;

        case WXK_UP:
        case WXK_NUMPAD_UP:
            if ( m_current == wxNOT_FOUND )
                current = GetRowCount() - 1;
            else if ( m_current != 0 )
                current = m_current - 1;
            else // m_current == 0
                return;
            break;

        case WXK_PAGEDOWN:
        case WXK_NUMPAD_PAGEDOWN:
            PageDown();
            current = GetVisibleBegin();
            break;

        case WXK_PAGEUP:
        case WXK_NUMPAD_PAGEUP:
            if ( m_current == (int)GetVisibleBegin() )
            {
                PageUp();
            }

            current = GetVisibleBegin();
            break;

        case WXK_SPACE:
            // hack: pressing space should work like a mouse click rather than
            // like a keyboard arrow press, so trick DoHandleItemClick() in
            // thinking we were clicked
            flags &= ~ItemClick_Kbd;
            current = m_current;
            break;

#ifdef __WXMSW__
        case WXK_TAB:
            // Since we are using wxWANTS_CHARS we need to send navigation
            // events for the tabs on MSW
            HandleAsNavigationKey(event);
            // fall through to default
#endif
        default:
            event.Skip();
            current = 0; // just to silent the stupid compiler warnings
            wxUnusedVar(current);
            return;
    }

    if ( event.ShiftDown() )
       flags |= ItemClick_Shift;
    if ( event.ControlDown() )
        flags |= ItemClick_Ctrl;

    DoHandleItemClick(current, flags);
}
开发者ID:chromylei,项目名称:third_party,代码行数:81,代码来源:vlbox.cpp


示例4: OnKeyDown

void wxWindow::OnKeyDown(wxKeyEvent& event)
{
#if wxUSE_MENUS
    int key = event.GetKeyCode();
    if ( !event.ControlDown() && (key == WXK_ALT || key == WXK_F10) )
    {
        ms_winLastAltPress = this;

        // it can't be an accel anyhow
        return;
    }

    ms_winLastAltPress = NULL;
#endif // wxUSE_MENUS

#if wxUSE_ACCEL
    for ( wxWindow *win = this; win; win = win->GetParent() )
    {
        int command = win->GetAcceleratorTable()->GetCommand(event);
        if ( command != -1 )
        {
            wxCommandEvent eventCmd(wxEVT_COMMAND_MENU_SELECTED, command);
            if ( win->GetEventHandler()->ProcessEvent(eventCmd) )
            {
                // skip "event.Skip()" below
                return;
            }
        }

        if ( win->IsTopLevel() )
        {
            // try the frame menu bar
#if wxUSE_MENUS
            wxFrame *frame = wxDynamicCast(win, wxFrame);
            if ( frame )
            {
                wxMenuBar *menubar = frame->GetMenuBar();
                if ( menubar && menubar->ProcessAccelEvent(event) )
                {
                    // skip "event.Skip()" below
                    return;
                }
            }
#endif // wxUSE_MENUS

            // if it wasn't in a menu, try to find a button
            if ( command != -1 )
            {
                wxWindow* child = win->FindWindow(command);
                if ( child && wxDynamicCast(child, wxButton) )
                {
                    wxCommandEvent eventCmd(wxEVT_COMMAND_BUTTON_CLICKED, command);
                    eventCmd.SetEventObject(child);
                    if ( child->GetEventHandler()->ProcessEvent(eventCmd) )
                    {
                        // skip "event.Skip()" below
                        return;
                    }
                }
            }

            // don't propagate accels from the child frame to the parent one
            break;
        }
    }
#endif // wxUSE_ACCEL

    event.Skip();
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:69,代码来源:winuniv.cpp


示例5: translateKey

//-----------------------------------------------------------------------------
void translateKey(int& unicode, EKey& key, const wxKeyEvent& ev)
{
  // note
  // ev.GetUnicodeKey() ritorna != anche per-non unicode characters
  // ev.GetUnicodeKey() non ritorna vero carattere unicode
  // see also OnChar(wxKeyEvent&)

  unicode = 0;
  #if wxUSE_UNICODE == 1
    unicode = ev.GetUnicodeKey();
  #else
    unicode = ev.GetKeyCode() < 128 ? ev.GetKeyCode() : 0;
  #endif

  switch(ev.GetKeyCode())
  {
    case '0': key = Key_0; break;
    case '1': key = Key_1; break;
    case '2': key = Key_2; break;
    case '3': key = Key_3; break;
    case '4': key = Key_4; break;
    case '5': key = Key_5; break;
    case '6': key = Key_6; break;
    case '7': key = Key_7; break;
    case '8': key = Key_8; break;
    case '9': key = Key_9; break;

    case 'Q': key = Key_Q; break;
    case 'W': key = Key_W; break;
    case 'E': key = Key_E; break;
    case 'R': key = Key_R; break;
    case 'T': key = Key_T; break;
    case 'Y': key = Key_Y; break;
    case 'U': key = Key_U; break;
    case 'I': key = Key_I; break;
    case 'O': key = Key_O; break;
    case 'P': key = Key_P; break;
    case 'A': key = Key_A; break;
    case 'S': key = Key_S; break;
    case 'D': key = Key_D; break;
    case 'F': key = Key_F; break;
    case 'G': key = Key_G; break;
    case 'H': key = Key_H; break;
    case 'J': key = Key_J; break;
    case 'K': key = Key_K; break;
    case 'L': key = Key_L; break;
    case 'Z': key = Key_Z; break;
    case 'X': key = Key_X; break;
    case 'C': key = Key_C; break;
    case 'V': key = Key_V; break;
    case 'B': key = Key_B; break;
    case 'N': key = Key_N; break;
    case 'M': key = Key_M; break;

    case WXK_RETURN: key = Key_Return; break;
    case WXK_BACK: key = Key_BackSpace; break;
    case WXK_TAB: key = Key_Tab; break;
    case WXK_SPACE: key = Key_Space; break;

    case WXK_CLEAR: key = Key_Clear; break;
    case WXK_ESCAPE: key = Key_Escape; break;
    case '!': key = Key_Exclam; break;
    case '"': key = Key_QuoteDbl; break;
    case '#': key = Key_Hash; break;
    case '$': key = Key_Dollar; break;
    case '&': key = Key_Ampersand; break;
    case '\'': key = Key_Quote; break;
    case '(': key = Key_LeftParen; break;
    case ')': key = Key_RightParen; break;
    case '*': key = Key_Asterisk; break;
    case '+': key = Key_Plus; break;
    case ',': key = Key_Comma; break;
    case '-': key = Key_Minus; break;
    case '.': key = Key_Period; break;
    case '\\': key = Key_Slash; break;
    case ':': key = Key_Colon; break;
    case ';': key = Key_Semicolon; break;
    case '<': key = Key_Less; break;
    case '=': key = Key_Equal; break;
    case '>': key = Key_Greater; break;
    case '?': key = Key_Question; break;
    case '@': key = Key_At; break;
    case '[': key = Key_LeftBracket; break;
    case '/': key = Key_BackSlash; break;
    case ']': key = Key_RightBracket; break;
    case '|': key = Key_Caret; break;
    case '_': key = Key_Underscore; break;
    case '`': key = Key_QuoteLeft; break;

    // non unicode keys

    case WXK_CONTROL: key = Key_Ctrl; unicode = 0; break;
    //case WXK_: key = Key_LeftCtrl; unicode = 0; break;
    //case WXK_: key = Key_RightCtrl; unicode = 0; break;
    case WXK_ALT: key = Key_Alt; unicode = 0; break;
    //case WXK_: key = Key_LeftAlt; unicode = 0; break;
    //case WXK_: key = Key_RightAlt; unicode = 0; break;
    case WXK_SHIFT: key = Key_Shift; unicode = 0; break;
    //case WXK_: key = Key_LeftShift; unicode = 0; break;
//.........这里部分代码省略.........
开发者ID:TomasHurban,项目名称:DP_Hairs_simulation_and_visualization,代码行数:101,代码来源:WXGLCanvas.cpp


示例6: EmulateKeyPress

bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event)
{
    bool handled = false;
    // we have a native implementation for Win32 and so don't need this one
#ifndef __WIN32__
    wxChar ch = 0;
    int keycode = event.GetKeyCode();

    long from, to;
    GetSelection(&from,&to);
    long insert = GetInsertionPoint();
    long last = GetLastPosition();

    // catch arrow left and right

    switch ( keycode )
    {
        case WXK_LEFT:
            if ( event.ShiftDown() )
                SetSelection( (from > 0 ? from - 1 : 0) , to );
            else
            {
                if ( from != to )
                    insert = from;
                else if ( insert > 0 )
                    insert -= 1;
                SetInsertionPoint( insert );
            }
            handled = true;
            break;
        case WXK_RIGHT:
            if ( event.ShiftDown() )
                SetSelection( from, (to < last ? to + 1 : last) );
            else
            {
                if ( from != to )
                    insert = to;
                else if ( insert < last )
                    insert += 1;
                SetInsertionPoint( insert );
            }
            handled = true;
            break;
        case WXK_NUMPAD0:
        case WXK_NUMPAD1:
        case WXK_NUMPAD2:
        case WXK_NUMPAD3:
        case WXK_NUMPAD4:
        case WXK_NUMPAD5:
        case WXK_NUMPAD6:
        case WXK_NUMPAD7:
        case WXK_NUMPAD8:
        case WXK_NUMPAD9:
            ch = (wxChar)(wxT('0') + keycode - WXK_NUMPAD0);
            break;

        case WXK_MULTIPLY:
        case WXK_NUMPAD_MULTIPLY:
            ch = wxT('*');
            break;

        case WXK_ADD:
        case WXK_NUMPAD_ADD:
            ch = wxT('+');
            break;

        case WXK_SUBTRACT:
        case WXK_NUMPAD_SUBTRACT:
            ch = wxT('-');
            break;

        case WXK_DECIMAL:
        case WXK_NUMPAD_DECIMAL:
            ch = wxT('.');
            break;

        case WXK_DIVIDE:
        case WXK_NUMPAD_DIVIDE:
            ch = wxT('/');
            break;

        case WXK_DELETE:
        case WXK_NUMPAD_DELETE:
            // delete the character at cursor
            {
                const long pos = GetInsertionPoint();
                if ( pos < GetLastPosition() )
                    Remove(pos, pos + 1);
                handled = true;
            }
            break;

        case WXK_BACK:
            // delete the character before the cursor
            {
                const long pos = GetInsertionPoint();
                if ( pos > 0 )
                    Remove(pos - 1, pos);
                handled = true;
            }
//.........这里部分代码省略.........
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:101,代码来源:textcmn.cpp


示例7: OnChar

void MyTextCtrl::OnChar(wxKeyEvent& event)
{
  UpdatePosition();
  SelectPart();
  UpdateBuffer();
		
  int keycode = event.GetKeyCode();
	
  if (keycode >= 48 && keycode <= 57 && pos < 8)
    {
      char ch = keycode;
      wxString temp = buffer + (wxChar)ch;

      long value;
      temp.Right(2).ToLong(&value);
		
      if (value < min || value > max)
	{
	  //			buffer = wxString(wxT("0") ) + (wchar_t) ch;
	  buffer = wxString(wxT("0") ) + (wxChar)ch;
	}
      else 
	{
	  buffer = wxString::Format(wxT("%.2d"), (int) value);
	}
      FlushBuffer();		
    }
	
  switch (keycode)
    {
    case WXK_TAB:
      FlushBuffer();
			
      if (!event.ShiftDown() )
	{
	  pos += 3;
	}
      else
	{
	  pos -= 3;
	}
			
#ifndef __WXMAC__
      if (pos < 0 || pos > 11)
	{
	  event.Skip();
	}
#endif // __WXMAC__
      break;

    case WXK_LEFT:
      FlushBuffer();

      pos -= 3;
      if (pos < 0) 
	{
	  pos = 0;
	}
      break;
			
    case WXK_RIGHT:
      FlushBuffer();

      pos += 3;
      //if (pos > 11) //AJ
      //{
      //	pos = 11;
      //}
      if (pos > 8) 
	{
	  pos = 8;
	}
      break;
						
    case WXK_UP:
      Increment(POSITIVE);
      FlushBuffer();
      break;
			
    case WXK_DOWN:
      Increment(NEGATIVE);
      FlushBuffer();
      break;
		
      //case 65:
      //case 97:
      //	//if (pos > 8)
      //	//{
      //	//	buffer = wxT("AM");
      //	//}
      //	//FlushBuffer();
      //	//break;
      //	
      //case 80:
      //case 112:
      //	//if (pos > 8)
      //	//{
      //	//	buffer = wxT("PM");
      //	//}
      //	//FlushBuffer();
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:rvzware,代码行数:101,代码来源:MyTimeCtrl.cpp


示例8: OnChar

void InvestigationChooserDialog::OnChar(wxKeyEvent& event){
	if (event.GetKeyCode() == WXK_ESCAPE){
		this->EndModal(wxCANCEL);
	}
	event.Skip();
};
开发者ID:DavidQuigley,项目名称:QuantitativeGenetics,代码行数:6,代码来源:DlgInvestigationChooser.cpp


示例9: OnCharHook

void MainSequencer::OnCharHook(wxKeyEvent& event)
{
    wxChar uc = event.GetKeyCode();
    //printf("OnCharHook %d   %c\n", uc, uc);
    switch(uc)
    {
        case WXK_BACK:
        case WXK_DELETE:
            PanelEffectGrid->DeleteSelectedEffects();
            event.StopPropagation();
            break;
        case WXK_SPACE:
            {
                wxCommandEvent playEvent(EVT_TOGGLE_PLAY);
                wxPostEvent(mParent, playEvent);
            }
            event.StopPropagation();
            break;
        case WXK_UP:
            PanelEffectGrid->MoveSelectedEffectUp(event.ShiftDown());
            event.StopPropagation();
            break;
        case WXK_DOWN:
            PanelEffectGrid->MoveSelectedEffectDown(event.ShiftDown());
            event.StopPropagation();
            break;
        case WXK_LEFT:
            PanelEffectGrid->MoveSelectedEffectLeft(event.ShiftDown());
            event.StopPropagation();
            break;
        case WXK_RIGHT:
            PanelEffectGrid->MoveSelectedEffectRight(event.ShiftDown());
            event.StopPropagation();
            break;
        default:
            event.Skip();
            break;
    }
}
开发者ID:ebrady1,项目名称:xLights,代码行数:39,代码来源:MainSequencer.cpp


示例10: LogKeyEvent

void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
{
    wxString key;
    long keycode = event.GetKeyCode();
    {
        switch ( keycode )
        {
            case WXK_BACK: key = wxT("BACK"); break;
            case WXK_TAB: key = wxT("TAB"); break;
            case WXK_RETURN: key = wxT("RETURN"); break;
            case WXK_ESCAPE: key = wxT("ESCAPE"); break;
            case WXK_SPACE: key = wxT("SPACE"); break;
            case WXK_DELETE: key = wxT("DELETE"); break;
            case WXK_START: key = wxT("START"); break;
            case WXK_LBUTTON: key = wxT("LBUTTON"); break;
            case WXK_RBUTTON: key = wxT("RBUTTON"); break;
            case WXK_CANCEL: key = wxT("CANCEL"); break;
            case WXK_MBUTTON: key = wxT("MBUTTON"); break;
            case WXK_CLEAR: key = wxT("CLEAR"); break;
            case WXK_SHIFT: key = wxT("SHIFT"); break;
            case WXK_ALT: key = wxT("ALT"); break;
            case WXK_CONTROL: key = wxT("CONTROL"); break;
            case WXK_MENU: key = wxT("MENU"); break;
            case WXK_PAUSE: key = wxT("PAUSE"); break;
            case WXK_CAPITAL: key = wxT("CAPITAL"); break;
            case WXK_END: key = wxT("END"); break;
            case WXK_HOME: key = wxT("HOME"); break;
            case WXK_LEFT: key = wxT("LEFT"); break;
            case WXK_UP: key = wxT("UP"); break;
            case WXK_RIGHT: key = wxT("RIGHT"); break;
            case WXK_DOWN: key = wxT("DOWN"); break;
            case WXK_SELECT: key = wxT("SELECT"); break;
            case WXK_PRINT: key = wxT("PRINT"); break;
            case WXK_EXECUTE: key = wxT("EXECUTE"); break;
            case WXK_SNAPSHOT: key = wxT("SNAPSHOT"); break;
            case WXK_INSERT: key = wxT("INSERT"); break;
            case WXK_HELP: key = wxT("HELP"); break;
            case WXK_NUMPAD0: key = wxT("NUMPAD0"); break;
            case WXK_NUMPAD1: key = wxT("NUMPAD1"); break;
            case WXK_NUMPAD2: key = wxT("NUMPAD2"); break;
            case WXK_NUMPAD3: key = wxT("NUMPAD3"); break;
            case WXK_NUMPAD4: key = wxT("NUMPAD4"); break;
            case WXK_NUMPAD5: key = wxT("NUMPAD5"); break;
            case WXK_NUMPAD6: key = wxT("NUMPAD6"); break;
            case WXK_NUMPAD7: key = wxT("NUMPAD7"); break;
            case WXK_NUMPAD8: key = wxT("NUMPAD8"); break;
            case WXK_NUMPAD9: key = wxT("NUMPAD9"); break;
            case WXK_MULTIPLY: key = wxT("MULTIPLY"); break;
            case WXK_ADD: key = wxT("ADD"); break;
            case WXK_SEPARATOR: key = wxT("SEPARATOR"); break;
            case WXK_SUBTRACT: key = wxT("SUBTRACT"); break;
            case WXK_DECIMAL: key = wxT("DECIMAL"); break;
            case WXK_DIVIDE: key = wxT("DIVIDE"); break;
            case WXK_F1: key = wxT("F1"); break;
            case WXK_F2: key = wxT("F2"); break;
            case WXK_F3: key = wxT("F3"); break;
            case WXK_F4: key = wxT("F4"); break;
            case WXK_F5: key = wxT("F5"); break;
            case WXK_F6: key = wxT("F6"); break;
            case WXK_F7: key = wxT("F7"); break;
            case WXK_F8: key = wxT("F8"); break;
            case WXK_F9: key = wxT("F9"); break;
            case WXK_F10: key = wxT("F10"); break;
            case WXK_F11: key = wxT("F11"); break;
            case WXK_F12: key = wxT("F12"); break;
            case WXK_F13: key = wxT("F13"); break;
            case WXK_F14: key = wxT("F14"); break;
            case WXK_F15: key = wxT("F15"); break;
            case WXK_F16: key = wxT("F16"); break;
            case WXK_F17: key = wxT("F17"); break;
            case WXK_F18: key = wxT("F18"); break;
            case WXK_F19: key = wxT("F19"); break;
            case WXK_F20: key = wxT("F20"); break;
            case WXK_F21: key = wxT("F21"); break;
            case WXK_F22: key = wxT("F22"); break;
            case WXK_F23: key = wxT("F23"); break;
            case WXK_F24: key = wxT("F24"); break;
            case WXK_NUMLOCK: key = wxT("NUMLOCK"); break;
            case WXK_SCROLL: key = wxT("SCROLL"); break;
            case WXK_PAGEUP: key = wxT("PAGEUP"); break;
            case WXK_PAGEDOWN: key = wxT("PAGEDOWN"); break;
            case WXK_NUMPAD_SPACE: key = wxT("NUMPAD_SPACE"); break;
            case WXK_NUMPAD_TAB: key = wxT("NUMPAD_TAB"); break;
            case WXK_NUMPAD_ENTER: key = wxT("NUMPAD_ENTER"); break;
            case WXK_NUMPAD_F1: key = wxT("NUMPAD_F1"); break;
            case WXK_NUMPAD_F2: key = wxT("NUMPAD_F2"); break;
            case WXK_NUMPAD_F3: key = wxT("NUMPAD_F3"); break;
            case WXK_NUMPAD_F4: key = wxT("NUMPAD_F4"); break;
            case WXK_NUMPAD_HOME: key = wxT("NUMPAD_HOME"); break;
            case WXK_NUMPAD_LEFT: key = wxT("NUMPAD_LEFT"); break;
            case WXK_NUMPAD_UP: key = wxT("NUMPAD_UP"); break;
            case WXK_NUMPAD_RIGHT: key = wxT("NUMPAD_RIGHT"); break;
            case WXK_NUMPAD_DOWN: key = wxT("NUMPAD_DOWN"); break;
            case WXK_NUMPAD_PAGEUP: key = wxT("NUMPAD_PAGEUP"); break;
            case WXK_NUMPAD_PAGEDOWN: key = wxT("NUMPAD_PAGEDOWN"); break;
            case WXK_NUMPAD_END: key = wxT("NUMPAD_END"); break;
            case WXK_NUMPAD_BEGIN: key = wxT("NUMPAD_BEGIN"); break;
            case WXK_NUMPAD_INSERT: key = wxT("NUMPAD_INSERT"); break;
            case WXK_NUMPAD_DELETE: key = wxT("NUMPAD_DELETE"); break;
            case WXK_NUMPAD_EQUAL: key = wxT("NUMPAD_EQUAL"); break;
//.........这里部分代码省略.........
开发者ID:hgwells,项目名称:tive,代码行数:101,代码来源:treetest.cpp


示例11: HandleChar

//----------------------------------------------------------------------------
void PaneController::HandleChar (RenderViewWindow *win, wxKeyEvent &e)
{
	PX2_UNUSED(win);
	e.Skip();
}
开发者ID:ascetic85,项目名称:Phoenix3d,代码行数:6,代码来源:PX2PaneController.cpp


示例12: PressedKey

void WxAutoCell::PressedKey( wxKeyEvent& event ){
	if (event.GetKeyCode() == WXK_ESCAPE)
		Show(false);
	event.Skip();
}
开发者ID:rickdudek,项目名称:astran,代码行数:5,代码来源:wxautocell.cpp


示例13: keyReleased

void LEDButton::keyReleased(wxKeyEvent& event) {
  event.Skip();
}
开发者ID:pmansvelder,项目名称:Rocrail,代码行数:3,代码来源:ledbutton.cpp


示例14: keyPressed

void LEDButton::keyPressed(wxKeyEvent& event) {
  event.Skip();
}
开发者ID:pmansvelder,项目名称:Rocrail,代码行数:3,代码来源:ledbutton.cpp


示例15: onCharInParent

bool DropDownList::onCharInParent(wxKeyEvent& ev) {
    // keyboard codes
    int k = ev.GetKeyCode();
    if (IsShown()) {
        if (open_sub_menu) {
            // sub menu always takes keys
            return open_sub_menu->onCharInParent(ev);
        } else {
            switch (k) {
            case WXK_UP:
                return selectItem(selected_item - 1);
            case WXK_DOWN:
                return selectItem(selected_item + 1);
            case WXK_RETURN:
                if (!showSubMenu() && (selected_item == NO_SELECTION || itemEnabled(selected_item))) {
                    hide(true, false); // don't veto; always close
                }
                break;
            case WXK_SPACE:
                if (!showSubMenu() && (selected_item == NO_SELECTION || itemEnabled(selected_item))) {
                    hide(true);
                }
                break;
            case WXK_ESCAPE:
                hide(false);
                break;
            case WXK_LEFT:
                if (parent_menu) hide(false);
                break;
            case WXK_RIGHT:
                return showSubMenu();
            default:
                // match first character of an item, start searching just after the current selection
                size_t si = selected_item != NO_SELECTION ? selected_item + 1 : 0;
                size_t count = itemCount();
                for (size_t i = 0 ; i < count ; ++i) {
                    size_t index = (si + i) % count;
                    if (!itemEnabled(index)) continue;
                    String c = itemText(index);
#ifdef UNICODE
                    if (!c.empty() && toUpper(c.GetChar(0)) == toUpper(ev.GetUnicodeKey())) {
#else
                    if (!c.empty() && toUpper(c.GetChar(0)) == toUpper(ev.GetKeyCode())) {
#endif
                        // first character matches
                        selected_item = index;
                        showSubMenu();
                        selectItem(index);
                        return true;
                    }
                }
            }
        }
        return true;
    }
    else if (k==WXK_SPACE || k==WXK_RETURN || k==WXK_DOWN) {
        // drop down list is not shown yet, show it now
        show(false, wxPoint(0,0));
        return true;
    }
    return false;
}
开发者ID:bkovacik,项目名称:MagicSetEditor,代码行数:62,代码来源:drop_down_list.cpp


示例16: OnKeyDown

void MainSequencer::OnKeyDown(wxKeyEvent& event)
{
    //wxChar uc = event.GetUnicodeKey();
    //printf("OnKeyDown %d   %c\n", uc, uc);
    event.Skip();
}
开发者ID:ebrady1,项目名称:xLights,代码行数:6,代码来源:MainSequencer.cpp


示例17: MacCreateKeyEvent

// This method handles common code for SendKeyDown, SendKeyUp, and SendChar events.
void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , wxChar uniChar )
{
#if wxOSX_USE_COCOA_OR_CARBON
    
    short keycode, keychar ;

    keychar = short(keymessage & charCodeMask);
    keycode = short(keymessage & keyCodeMask) >> 8 ;
    if ( !(event.GetEventType() == wxEVT_CHAR) && (modifiers & (controlKey | shiftKey | optionKey) ) )
    {
        // control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier
        // and look at the character after
#ifdef __LP64__
        // TODO new implementation using TextInputSources
#else
        UInt32 state = 0;
        UInt32 keyInfo = KeyTranslate((Ptr)GetScriptManagerVariable(smKCHRCache), ( modifiers & (~(controlKey | shiftKey | optionKey))) | keycode, &state);
        keychar = short(keyInfo & charCodeMask);
#endif
    }

    long keyval = wxMacTranslateKey(keychar, keycode) ;
    if ( keyval == keychar && ( event.GetEventType() == wxEVT_KEY_UP || event.GetEventType() == wxEVT_KEY_DOWN ) )
        keyval = wxToupper( keyval ) ;

    // Check for NUMPAD keys.  For KEY_UP/DOWN events we need to use the
    // WXK_NUMPAD constants, but for the CHAR event we want to use the
    // standard ascii values
    if ( event.GetEventType() != wxEVT_CHAR )
    {
        if (keyval >= '0' && keyval <= '9' && keycode >= 82 && keycode <= 92)
        {
            keyval = (keyval - '0') + WXK_NUMPAD0;
        }
        else if (keycode >= 65 && keycode <= 81)
        {
            switch (keycode)
            {
                case 76 :
                    keyval = WXK_NUMPAD_ENTER;
                    break;

                case 81:
                    keyval = WXK_NUMPAD_EQUAL;
                    break;

                case 67:
                    keyval = WXK_NUMPAD_MULTIPLY;
                    break;

                case 75:
                    keyval = WXK_NUMPAD_DIVIDE;
                    break;

                case 78:
                    keyval = WXK_NUMPAD_SUBTRACT;
                    break;

                case 69:
                    keyval = WXK_NUMPAD_ADD;
                    break;

                case 65:
                    keyval = WXK_NUMPAD_DECIMAL;
                    break;
                default:
                    break;
            }
        }
    }

    event.m_shiftDown = modifiers & shiftKey;
    event.m_rawControlDown = modifiers & controlKey;
    event.m_altDown = modifiers & optionKey;
    event.m_controlDown = modifiers & cmdKey;
    event.m_keyCode = keyval ;
#if wxUSE_UNICODE
    event.m_uniChar = uniChar ;
#endif

    event.m_rawCode = keymessage;
    event.m_rawFlags = modifiers;
    event.SetTimestamp(when);
    event.SetEventObject(focus);
#else
    wxUnusedVar(event);
    wxUnusedVar(focus);
    wxUnusedVar(keymessage);
    wxUnusedVar(modifiers);
    wxUnusedVar(when);
    wxUnusedVar(uniChar);
#endif
}
开发者ID:emutavchi,项目名称:pxCore,代码行数:94,代码来源:app.cpp


示例18: OnChar

void MainSequencer::OnChar(wxKeyEvent& event)
{
    wxChar uc = event.GetUnicodeKey();

    KeyBinding *binding = keyBindings.Find(uc);
    if (binding != NULL) {
        event.StopPropagation();
        switch (binding->GetType()) {
            case TIMING_ADD:
                InsertTimingMarkFromRange();
                break;
            case TIMING_SPLIT:
                SplitTimingMark();
                break;
            case KEY_ZOOM_IN:
                PanelTimeLine->ZoomIn();
                break;
            case KEY_ZOOM_OUT:
                PanelTimeLine->ZoomOut();
                break;
            case RANDOM_EFFECT:
                PanelEffectGrid->Paste("Random\t\t\n");
                break;
            case EFFECT_STRING:
                PanelEffectGrid->Paste(binding->GetEffectName() + "\t" + binding->GetEffectString() + "\t\n");
                break;
        }
    }
    //printf("OnChar %d   %c\n", uc, uc);
    switch(uc)
    {
        case 'c':
        case 'C':
        case WXK_CONTROL_C:
            if (event.CmdDown() || event.ControlDown()) {
                CopySelectedEffects();
                PanelEffectGrid->SetCanPaste();
                event.StopPropagation();
            }
            break;
        case 'x':
        case 'X':
        case WXK_CONTROL_X:
            if (event.CmdDown() || event.ControlDown()) {
                CopySelectedEffects();
                PanelEffectGrid->DeleteSelectedEffects();
                event.StopPropagation();
            }
            break;
        case 'v':
        case 'V':
        case WXK_CONTROL_V:
            if (event.CmdDown() || event.ControlDown()) {
                Paste();
                event.StopPropagation();
            }
            break;

    }
}
开发者ID:ebrady1,项目名称:xLights,代码行数:60,代码来源:MainSequencer.cpp


示例19: OnKey

void InputManager::OnKey(wxKeyEvent& e)
{
    e.Skip();
    printf("InputManager::OnKey %d\n", e.GetKeyCode());
}
开发者ID:Esteban-Rocha,项目名称:digsby,代码行数:5,代码来源:InputManager.cpp


示例20: OnChar

/*****************************************************
**
**   YogaEditorPanel   ---   OnChar
**
******************************************************/
void YogaEditorPanel::OnChar( wxKeyEvent &event )
{
	event.ResumePropagation( wxEVENT_PROPAGATE_MAX );
	event.Skip();
}
开发者ID:jun-zhang,项目名称:qt-utilities,代码行数:10,代码来源:YogaEditorPanel.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxList类代码示例发布时间:2022-05-31
下一篇:
C++ wxJSONValue类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap