Exemplo n.º 1
0
Arquivo: accel.cpp Projeto: EdgarTx/wx
void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
{
    AllocExclusive();

    wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
    while ( node )
    {
        const wxAcceleratorEntry *entryCur = node->GetData();

        // given entry contains only the information of the accelerator key
        // because it was set that way during creation so do not use the
        // comparison operator which also checks the command field
        if ((entryCur->GetKeyCode() == entry.GetKeyCode()) &&
            (entryCur->GetFlags() == entry.GetFlags()))
        {
            delete node->GetData();
            M_ACCELDATA->m_accels.Erase(node);

            return;
        }

        node = node->GetNext();
    }

    wxFAIL_MSG(_T("deleting inexistent accel from wxAcceleratorTable"));
}
Exemplo n.º 2
0
void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
{
    AllocExclusive();

    wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    while ( node )
    {
        const wxAcceleratorEntry *entryCur = node->GetData();

        // given entry contains only the information of the accelerator key
        // because it was set that way during creation so do not use the
        // comparison operator which also checks the command field
        if ((entryCur->GetKeyCode() == entry.GetKeyCode()) &&
                (entryCur->GetFlags() == entry.GetFlags()))
        {
            delete node->GetData();
            M_ACCELDATA->m_accels.Erase(node);

            return;
        }

        node = node->GetNext();
    }

    wxFAIL_MSG(wxT("deleting inexistent accel from wxAcceleratorTable"));
}
Exemplo n.º 3
0
int wxGISAcceleratorTable::Add(wxAcceleratorEntry entry)
{
	int cmd(wxID_ANY);
	bool bAdd(true);
	for(size_t i = 0; i < m_AccelEntryArray.size(); ++i)
	{
		if(m_AccelEntryArray[i].GetKeyCode() == entry.GetKeyCode() && m_AccelEntryArray[i].GetFlags() == entry.GetFlags())
		{
			cmd = m_AccelEntryArray[i].GetCommand();
			m_AccelEntryArray[i] = entry;
			bAdd = false;
		}
		if(m_AccelEntryArray[i].GetCommand() == entry.GetCommand())
		{
			m_AccelEntryArray[i] = entry;
			bAdd = false;
		}
	}
	if(bAdd)
		m_AccelEntryArray.push_back(entry);
	bHasChanges = true;
	return cmd;
}
Exemplo n.º 4
0
static wxString wxGetAccelText(const wxAcceleratorEntry& accel)
{
   return wxGetAccelText(accel.GetFlags(), (wxKeyCode)accel.GetKeyCode());
}
void WXMSearchReplaceDialog::WXMSearchReplaceDialogKeyDown(wxKeyEvent& event)
{
	int key=event.GetKeyCode();

	//g_SearchReplaceDialog->SetTitle(wxString()<<key);

	switch(key)
	{
	case WXK_ESCAPE:
		g_SearchReplaceDialog->Show(false);
		return;
	case WXK_RETURN:
	case WXK_NUMPAD_ENTER:
		if(this->GetClassInfo()->GetClassName()!=wxString(wxT("wxButton")))
		{
			wxCommandEvent e;
			wxButton* default_btn = static_cast<wxButton*>(g_SearchReplaceDialog->GetDefaultItem());
			if(default_btn == g_SearchReplaceDialog->WxButtonReplace)
				return g_SearchReplaceDialog->WxButtonReplaceClick(e); // no skip

			return g_SearchReplaceDialog->WxButtonFindNextClick(e); // no skip
		}
		break;
	case WXK_DOWN:
		if((MadEdit*)this==g_SearchReplaceDialog->m_FindText)
		{
			int x,y,w,h;
			g_SearchReplaceDialog->m_FindText->GetPosition(&x, &y);
			g_SearchReplaceDialog->m_FindText->GetSize(&w, &h);
			g_SearchReplaceDialog->PopupMenu(&g_SearchReplaceDialog->WxPopupMenuRecentFindText, x, y+h);
			return;
		}
		else if((MadEdit*)this==g_SearchReplaceDialog->m_ReplaceText)
		{
			int x,y,w,h;
			g_SearchReplaceDialog->m_ReplaceText->GetPosition(&x, &y);
			g_SearchReplaceDialog->m_ReplaceText->GetSize(&w, &h);
			g_SearchReplaceDialog->PopupMenu(&g_SearchReplaceDialog->WxPopupMenuRecentReplaceText, x, y+h);
			return;
		}
		break;
	}

	extern wxAcceleratorEntry g_AccelFindNext, g_AccelFindPrev;
	int flags=wxACCEL_NORMAL;
	if(event.m_altDown) flags|=wxACCEL_ALT;
	if(event.m_shiftDown) flags|=wxACCEL_SHIFT;
	if(event.m_controlDown) flags|=wxACCEL_CTRL;

	if(g_AccelFindNext.GetKeyCode()==key && g_AccelFindNext.GetFlags()==flags)
	{
		wxCommandEvent e;
		g_SearchReplaceDialog->WxButtonFindNextClick(e);
		return; // no skip
	}

	if(g_AccelFindPrev.GetKeyCode()==key && g_AccelFindPrev.GetFlags()==flags)
	{
		wxCommandEvent e;
		g_SearchReplaceDialog->WxButtonFindPrevClick(e);
		return; // no skip
	}

	event.Skip();
}