Removed wxNavigationKey code, new keyboard navigation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56073 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -483,8 +483,6 @@ enum wxPG_KEYBOARD_ACTIONS
|
|||||||
#define wxPG_FL_IN_MANAGER 0x00020000
|
#define wxPG_FL_IN_MANAGER 0x00020000
|
||||||
// Set after wxPropertyGrid is shown in its initial good size
|
// Set after wxPropertyGrid is shown in its initial good size
|
||||||
#define wxPG_FL_GOOD_SIZE_SET 0x00040000
|
#define wxPG_FL_GOOD_SIZE_SET 0x00040000
|
||||||
// Next navigation key event will get ignored
|
|
||||||
#define wxPG_FL_IGNORE_NEXT_NAVKEY 0x00080000
|
|
||||||
// Set when in SelectProperty.
|
// Set when in SelectProperty.
|
||||||
#define wxPG_FL_IN_SELECT_PROPERTY 0x00100000
|
#define wxPG_FL_IN_SELECT_PROPERTY 0x00100000
|
||||||
// Set when help string is shown in status bar
|
// Set when help string is shown in status bar
|
||||||
@@ -1225,9 +1223,6 @@ public:
|
|||||||
void OnComboItemPaint( wxPGCustomComboControl* pCb,int item,wxDC& dc,
|
void OnComboItemPaint( wxPGCustomComboControl* pCb,int item,wxDC& dc,
|
||||||
wxRect& rect,int flags );
|
wxRect& rect,int flags );
|
||||||
|
|
||||||
// Used by simple check box for keyboard navigation
|
|
||||||
void SendNavigationKeyEvent( int dir );
|
|
||||||
|
|
||||||
/** Standardized double-to-string conversion.
|
/** Standardized double-to-string conversion.
|
||||||
*/
|
*/
|
||||||
static void DoubleToString( wxString& target,
|
static void DoubleToString( wxString& target,
|
||||||
@@ -1633,7 +1628,6 @@ protected:
|
|||||||
void OnMouseUp( wxMouseEvent &event );
|
void OnMouseUp( wxMouseEvent &event );
|
||||||
void OnKey( wxKeyEvent &event );
|
void OnKey( wxKeyEvent &event );
|
||||||
void OnKeyUp( wxKeyEvent &event );
|
void OnKeyUp( wxKeyEvent &event );
|
||||||
void OnNavigationKey( wxNavigationKeyEvent& event );
|
|
||||||
void OnResize( wxSizeEvent &event );
|
void OnResize( wxSizeEvent &event );
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
|
@@ -1283,14 +1283,6 @@ bool wxSimpleCheckBox::ProcessEvent(wxEvent& event)
|
|||||||
wxPropertyGrid* propGrid = (wxPropertyGrid*) GetParent()->GetParent();
|
wxPropertyGrid* propGrid = (wxPropertyGrid*) GetParent()->GetParent();
|
||||||
wxASSERT( propGrid->IsKindOf(CLASSINFO(wxPropertyGrid)) );
|
wxASSERT( propGrid->IsKindOf(CLASSINFO(wxPropertyGrid)) );
|
||||||
|
|
||||||
if ( event.GetEventType() == wxEVT_NAVIGATION_KEY )
|
|
||||||
{
|
|
||||||
//wxLogDebug(wxT("wxEVT_NAVIGATION_KEY"));
|
|
||||||
//SetFocusFromKbd();
|
|
||||||
//event.Skip();
|
|
||||||
//return wxControl::ProcessEvent(event);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ( ( (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK)
|
if ( ( (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK)
|
||||||
&& ((wxMouseEvent&)event).m_x > (wxPG_XBEFORETEXT-2)
|
&& ((wxMouseEvent&)event).m_x > (wxPG_XBEFORETEXT-2)
|
||||||
&& ((wxMouseEvent&)event).m_x <= (wxPG_XBEFORETEXT-2+m_boxHeight) )
|
&& ((wxMouseEvent&)event).m_x <= (wxPG_XBEFORETEXT-2+m_boxHeight) )
|
||||||
@@ -1361,12 +1353,6 @@ bool wxSimpleCheckBox::ProcessEvent(wxEvent& event)
|
|||||||
{
|
{
|
||||||
wxKeyEvent& keyEv = (wxKeyEvent&) event;
|
wxKeyEvent& keyEv = (wxKeyEvent&) event;
|
||||||
|
|
||||||
if ( keyEv.GetKeyCode() == WXK_TAB )
|
|
||||||
{
|
|
||||||
propGrid->SendNavigationKeyEvent( keyEv.ShiftDown()?0:1 );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ( keyEv.GetKeyCode() == WXK_SPACE )
|
if ( keyEv.GetKeyCode() == WXK_SPACE )
|
||||||
{
|
{
|
||||||
SetValue(2);
|
SetValue(2);
|
||||||
|
@@ -414,12 +414,6 @@ protected:
|
|||||||
pg->OnKeyUp( event );
|
pg->OnKeyUp( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnNavigationKey( wxNavigationKeyEvent& event )
|
|
||||||
{
|
|
||||||
wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
|
|
||||||
pg->OnNavigationKey( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnPaint( wxPaintEvent& event );
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
|
||||||
// Always be focussable, even with child windows
|
// Always be focussable, even with child windows
|
||||||
@@ -445,7 +439,6 @@ BEGIN_EVENT_TABLE(wxPGCanvas, wxPanel)
|
|||||||
EVT_KEY_DOWN(wxPGCanvas::OnKey)
|
EVT_KEY_DOWN(wxPGCanvas::OnKey)
|
||||||
EVT_KEY_UP(wxPGCanvas::OnKeyUp)
|
EVT_KEY_UP(wxPGCanvas::OnKeyUp)
|
||||||
EVT_CHAR(wxPGCanvas::OnKey)
|
EVT_CHAR(wxPGCanvas::OnKey)
|
||||||
EVT_NAVIGATION_KEY(wxPGCanvas::OnNavigationKey)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
@@ -3128,7 +3121,6 @@ void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event )
|
|||||||
{
|
{
|
||||||
wxPGProperty* selected = m_selected;
|
wxPGProperty* selected = m_selected;
|
||||||
|
|
||||||
//
|
|
||||||
// Somehow, event is handled after property has been deselected.
|
// Somehow, event is handled after property has been deselected.
|
||||||
// Possibly, but very rare.
|
// Possibly, but very rare.
|
||||||
if ( !selected )
|
if ( !selected )
|
||||||
@@ -3238,7 +3230,6 @@ void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event )
|
|||||||
DoPropertyChanged(selected, selFlags);
|
DoPropertyChanged(selected, selFlags);
|
||||||
EditorsValueWasNotModified();
|
EditorsValueWasNotModified();
|
||||||
|
|
||||||
//
|
|
||||||
// Regardless of editor type, unfocus editor on
|
// Regardless of editor type, unfocus editor on
|
||||||
// text-editing related enter press.
|
// text-editing related enter press.
|
||||||
if ( event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER )
|
if ( event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER )
|
||||||
@@ -3250,6 +3241,13 @@ void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event )
|
|||||||
{
|
{
|
||||||
// No value after all
|
// No value after all
|
||||||
|
|
||||||
|
// Regardless of editor type, unfocus editor on
|
||||||
|
// text-editing related enter press.
|
||||||
|
if ( event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER )
|
||||||
|
{
|
||||||
|
SetFocusOnCanvas();
|
||||||
|
}
|
||||||
|
|
||||||
// Let unhandled button click events go to the parent
|
// Let unhandled button click events go to the parent
|
||||||
if ( !buttonWasHandled && event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
|
if ( !buttonWasHandled && event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
|
||||||
{
|
{
|
||||||
@@ -3411,23 +3409,11 @@ void wxPropertyGrid::SetupChildEventHandling( wxWindow* argWnd )
|
|||||||
argWnd->Connect(id, wxEVT_LEAVE_WINDOW,
|
argWnd->Connect(id, wxEVT_LEAVE_WINDOW,
|
||||||
wxMouseEventHandler(wxPropertyGrid::OnMouseEntry),
|
wxMouseEventHandler(wxPropertyGrid::OnMouseEntry),
|
||||||
NULL, this);
|
NULL, this);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
argWnd->Connect(id, wxEVT_NAVIGATION_KEY,
|
|
||||||
wxNavigationKeyEventHandler(wxPropertyGrid::OnNavigationKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
argWnd->Connect(id, wxEVT_KEY_DOWN,
|
argWnd->Connect(id, wxEVT_KEY_DOWN,
|
||||||
wxKeyEventHandler(wxPropertyGrid::OnChildKeyDown),
|
wxCharEventHandler(wxPropertyGrid::OnChildKeyDown),
|
||||||
NULL, this);
|
|
||||||
argWnd->Connect(id, wxEVT_KEY_UP,
|
|
||||||
wxKeyEventHandler(wxPropertyGrid::OnChildKeyUp),
|
|
||||||
NULL, this);
|
|
||||||
argWnd->Connect(id, wxEVT_KILL_FOCUS,
|
|
||||||
wxFocusEventHandler(wxPropertyGrid::OnFocusEvent),
|
|
||||||
NULL, this);
|
NULL, this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxPropertyGrid::FreeEditors()
|
void wxPropertyGrid::FreeEditors()
|
||||||
{
|
{
|
||||||
@@ -3473,7 +3459,18 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
|
if (m_selected)
|
||||||
|
wxPrintf( "Selected %s\n", m_selected->GetClassInfo()->GetClassName() );
|
||||||
|
else
|
||||||
|
wxPrintf( "None selected\n" );
|
||||||
|
|
||||||
|
if (p)
|
||||||
|
wxPrintf( "P = %s\n", p->GetClassInfo()->GetClassName() );
|
||||||
|
else
|
||||||
|
wxPrintf( "P = NULL\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
// If we are frozen, then just set the values.
|
// If we are frozen, then just set the values.
|
||||||
if ( m_frozen )
|
if ( m_frozen )
|
||||||
{
|
{
|
||||||
@@ -4853,17 +4850,6 @@ void wxPropertyGrid::OnMouseUpChild( wxMouseEvent &event )
|
|||||||
// wxPropertyGrid keyboard event handling
|
// wxPropertyGrid keyboard event handling
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
void wxPropertyGrid::SendNavigationKeyEvent( int dir )
|
|
||||||
{
|
|
||||||
wxNavigationKeyEvent evt;
|
|
||||||
evt.SetFlags(wxNavigationKeyEvent::FromTab|
|
|
||||||
(dir?wxNavigationKeyEvent::IsForward:
|
|
||||||
wxNavigationKeyEvent::IsBackward));
|
|
||||||
evt.SetEventObject(this);
|
|
||||||
m_canvas->GetEventHandler()->AddPendingEvent(evt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int wxPropertyGrid::KeyEventToActions(wxKeyEvent &event, int* pSecond) const
|
int wxPropertyGrid::KeyEventToActions(wxKeyEvent &event, int* pSecond) const
|
||||||
{
|
{
|
||||||
// Translates wxKeyEvent to wxPG_ACTION_XXX
|
// Translates wxKeyEvent to wxPG_ACTION_XXX
|
||||||
@@ -4950,10 +4936,8 @@ void wxPropertyGrid::HandleKeyEvent(wxKeyEvent &event)
|
|||||||
|
|
||||||
if ( keycode == WXK_TAB )
|
if ( keycode == WXK_TAB )
|
||||||
{
|
{
|
||||||
if ( HasFlag(wxTAB_TRAVERSAL) )
|
if (m_selected)
|
||||||
SendNavigationKeyEvent( event.ShiftDown()?0:1 );
|
DoSelectProperty( m_selected, wxPG_SEL_FOCUS );
|
||||||
else
|
|
||||||
event.Skip();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5075,7 +5059,6 @@ bool wxPropertyGrid::HandleChildKey( wxKeyEvent& event )
|
|||||||
OnValidationFailureReset(m_selected);
|
OnValidationFailureReset(m_selected);
|
||||||
|
|
||||||
res = false;
|
res = false;
|
||||||
|
|
||||||
UnfocusEditor();
|
UnfocusEditor();
|
||||||
}
|
}
|
||||||
else if ( action == wxPG_ACTION_COPY )
|
else if ( action == wxPG_ACTION_COPY )
|
||||||
@@ -5144,24 +5127,6 @@ bool wxPropertyGrid::HandleChildKey( wxKeyEvent& event )
|
|||||||
|
|
||||||
void wxPropertyGrid::OnKey( wxKeyEvent &event )
|
void wxPropertyGrid::OnKey( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
|
||||||
// Events to editor controls should get relayed here.
|
|
||||||
//
|
|
||||||
wxWindow* focused = wxWindow::FindFocus();
|
|
||||||
|
|
||||||
wxWindow* primaryCtrl = GetEditorControl();
|
|
||||||
|
|
||||||
if ( primaryCtrl &&
|
|
||||||
(focused==primaryCtrl
|
|
||||||
|| m_editorFocused) )
|
|
||||||
{
|
|
||||||
// Child key must be processed here, since it can
|
|
||||||
// destroy the control which is referred by its own
|
|
||||||
// event handling.
|
|
||||||
HandleChildKey( event );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
HandleKeyEvent( event );
|
HandleKeyEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5174,88 +5139,6 @@ void wxPropertyGrid::OnKeyUp(wxKeyEvent &event)
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
void wxPropertyGrid::OnNavigationKey( wxNavigationKeyEvent& event )
|
|
||||||
{
|
|
||||||
// Ignore events that occur very close to focus set
|
|
||||||
if ( m_iFlags & wxPG_FL_IGNORE_NEXT_NAVKEY )
|
|
||||||
{
|
|
||||||
m_iFlags &= ~(wxPG_FL_IGNORE_NEXT_NAVKEY);
|
|
||||||
event.Skip();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPGProperty* next = (wxPGProperty*) NULL;
|
|
||||||
|
|
||||||
int dir = event.GetDirection()?1:-1;
|
|
||||||
|
|
||||||
if ( m_selected )
|
|
||||||
{
|
|
||||||
if ( dir == 1 && (m_wndEditor || m_wndEditor2) )
|
|
||||||
{
|
|
||||||
wxWindow* focused = wxWindow::FindFocus();
|
|
||||||
|
|
||||||
wxWindow* wndToCheck = GetEditorControl();
|
|
||||||
|
|
||||||
// ODComboBox focus goes to its text ctrl, so we need to use it instead
|
|
||||||
if ( wndToCheck && wndToCheck->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)) )
|
|
||||||
{
|
|
||||||
wxTextCtrl* comboTextCtrl = ((wxOwnerDrawnComboBox*)wndToCheck)->GetTextCtrl();
|
|
||||||
if ( comboTextCtrl )
|
|
||||||
wndToCheck = comboTextCtrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Because of problems navigating from wxButton, do not go to it.
|
|
||||||
if ( !wndToCheck )
|
|
||||||
{
|
|
||||||
// No primary, use secondary
|
|
||||||
wndToCheck = m_wndEditor2;
|
|
||||||
}
|
|
||||||
// If it has editor button, focus to it after the primary editor.
|
|
||||||
// NB: Doesn't work since wxButton on wxMSW doesn't seem to propagate
|
|
||||||
// key events (yes, I'm using wxWANTS_CHARS with it, and yes I
|
|
||||||
// have somewhat debugged in window.cpp itself).
|
|
||||||
else if ( focused == wndToCheck &&
|
|
||||||
m_wndEditor2 &&
|
|
||||||
!(GetExtraStyle() & wxPG_EX_NO_TAB_TO_BUTTON) )
|
|
||||||
{
|
|
||||||
wndToCheck = m_wndEditor2;
|
|
||||||
wxLogDebug(wxT("Exp1"));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( focused != wndToCheck &&
|
|
||||||
wndToCheck )
|
|
||||||
{
|
|
||||||
wndToCheck->SetFocus();
|
|
||||||
|
|
||||||
// Select all text in wxTextCtrl etc.
|
|
||||||
if ( m_wndEditor && wndToCheck == m_wndEditor )
|
|
||||||
m_selected->GetEditorClass()->OnFocus(m_selected,wndToCheck);
|
|
||||||
|
|
||||||
m_editorFocused = 1;
|
|
||||||
next = m_selected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !next )
|
|
||||||
{
|
|
||||||
next = wxPropertyGridIterator::OneStep(m_pState, wxPG_ITERATE_VISIBLE, m_selected, dir);
|
|
||||||
|
|
||||||
if ( next )
|
|
||||||
{
|
|
||||||
// This allows preventing NavigateOut to occur
|
|
||||||
DoSelectProperty( next, wxPG_SEL_FOCUS );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !next )
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool wxPropertyGrid::ButtonTriggerKeyTest( int action, wxKeyEvent& event )
|
bool wxPropertyGrid::ButtonTriggerKeyTest( int action, wxKeyEvent& event )
|
||||||
{
|
{
|
||||||
if ( action == -1 )
|
if ( action == -1 )
|
||||||
@@ -5347,13 +5230,8 @@ void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused )
|
|||||||
if ( (m_iFlags & wxPG_FL_FOCUSED) !=
|
if ( (m_iFlags & wxPG_FL_FOCUSED) !=
|
||||||
(oldFlags & wxPG_FL_FOCUSED) )
|
(oldFlags & wxPG_FL_FOCUSED) )
|
||||||
{
|
{
|
||||||
// On each focus kill, mark the next nav key event
|
|
||||||
// to be ignored (can't do on set focus since the
|
|
||||||
// event would occur before it).
|
|
||||||
if ( !(m_iFlags & wxPG_FL_FOCUSED) )
|
if ( !(m_iFlags & wxPG_FL_FOCUSED) )
|
||||||
{
|
{
|
||||||
m_iFlags |= wxPG_FL_IGNORE_NEXT_NAVKEY;
|
|
||||||
|
|
||||||
// Need to store changed value
|
// Need to store changed value
|
||||||
CommitChangesFromEditor();
|
CommitChangesFromEditor();
|
||||||
}
|
}
|
||||||
@@ -5386,8 +5264,6 @@ void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused )
|
|||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
m_iFlags &= ~(wxPG_FL_IGNORE_NEXT_NAVKEY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redraw selected
|
// Redraw selected
|
||||||
|
Reference in New Issue
Block a user