SetButtonShortcut() merged with action system
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -421,6 +421,7 @@ enum wxPG_KEYBOARD_ACTIONS
|
|||||||
wxPG_ACTION_CUT,
|
wxPG_ACTION_CUT,
|
||||||
wxPG_ACTION_COPY,
|
wxPG_ACTION_COPY,
|
||||||
wxPG_ACTION_PASTE,
|
wxPG_ACTION_PASTE,
|
||||||
|
wxPG_ACTION_PRESS_BUTTON, // Causes editor button (if any) to be pressed
|
||||||
wxPG_ACTION_MAX
|
wxPG_ACTION_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -934,15 +935,6 @@ public:
|
|||||||
return DoSelectProperty(p,focus?wxPG_SEL_FOCUS:0);
|
return DoSelectProperty(p,focus?wxPG_SEL_FOCUS:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Changes keyboard shortcut to push the editor button.
|
|
||||||
@remarks
|
|
||||||
You can set default with keycode 0. Good value for the platform is
|
|
||||||
guessed, but don't expect it to be very accurate.
|
|
||||||
*/
|
|
||||||
void SetButtonShortcut( int keycode,
|
|
||||||
bool ctrlDown = false,
|
|
||||||
bool altDown = false );
|
|
||||||
|
|
||||||
/** Sets category caption background colour. */
|
/** Sets category caption background colour. */
|
||||||
void SetCaptionBackgroundColour(const wxColour& col);
|
void SetCaptionBackgroundColour(const wxColour& col);
|
||||||
|
|
||||||
@@ -1483,9 +1475,6 @@ protected:
|
|||||||
|
|
||||||
int m_fontHeight; // Height of the font.
|
int m_fontHeight; // Height of the font.
|
||||||
|
|
||||||
// Base keycode for triggering push button.
|
|
||||||
int m_pushButKeyCode;
|
|
||||||
|
|
||||||
/** m_splitterx when drag began. */
|
/** m_splitterx when drag began. */
|
||||||
int m_startingSplitterX;
|
int m_startingSplitterX;
|
||||||
|
|
||||||
@@ -1543,12 +1532,6 @@ protected:
|
|||||||
|
|
||||||
unsigned char m_vspacing;
|
unsigned char m_vspacing;
|
||||||
|
|
||||||
// Does triggering push button need Alt down?
|
|
||||||
unsigned char m_pushButKeyCodeNeedsAlt;
|
|
||||||
|
|
||||||
// Does triggering push button need Ctrl down?
|
|
||||||
unsigned char m_pushButKeyCodeNeedsCtrl;
|
|
||||||
|
|
||||||
// Used to track when Alt/Ctrl+Key was consumed.
|
// Used to track when Alt/Ctrl+Key was consumed.
|
||||||
unsigned char m_keyComboConsumed;
|
unsigned char m_keyComboConsumed;
|
||||||
|
|
||||||
@@ -1829,7 +1812,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool ButtonTriggerKeyTest( wxKeyEvent &event );
|
bool ButtonTriggerKeyTest( int action, wxKeyEvent& event );
|
||||||
|
|
||||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
|
@@ -592,6 +592,7 @@ void wxPropertyGrid::Init1()
|
|||||||
AddActionTrigger( wxPG_ACTION_COPY, WXK_INSERT, wxMOD_CONTROL );
|
AddActionTrigger( wxPG_ACTION_COPY, WXK_INSERT, wxMOD_CONTROL );
|
||||||
AddActionTrigger( wxPG_ACTION_PASTE, 'V', wxMOD_CONTROL );
|
AddActionTrigger( wxPG_ACTION_PASTE, 'V', wxMOD_CONTROL );
|
||||||
AddActionTrigger( wxPG_ACTION_PASTE, WXK_INSERT, wxMOD_SHIFT );
|
AddActionTrigger( wxPG_ACTION_PASTE, WXK_INSERT, wxMOD_SHIFT );
|
||||||
|
AddActionTrigger( wxPG_ACTION_PRESS_BUTTON, WXK_DOWN, wxMOD_ALT );
|
||||||
|
|
||||||
m_coloursCustomized = 0;
|
m_coloursCustomized = 0;
|
||||||
m_frozen = 0;
|
m_frozen = 0;
|
||||||
@@ -620,10 +621,6 @@ void wxPropertyGrid::Init1()
|
|||||||
|
|
||||||
m_width = m_height = 0;
|
m_width = m_height = 0;
|
||||||
|
|
||||||
SetButtonShortcut(0);
|
|
||||||
|
|
||||||
m_keyComboConsumed = 0;
|
|
||||||
|
|
||||||
m_commonValues.push_back(new wxPGCommonValue(_("Unspecified"), wxPGGlobalVars->m_defaultRenderer) );
|
m_commonValues.push_back(new wxPGCommonValue(_("Unspecified"), wxPGGlobalVars->m_defaultRenderer) );
|
||||||
m_cvUnspecified = 0;
|
m_cvUnspecified = 0;
|
||||||
|
|
||||||
@@ -2644,24 +2641,6 @@ wxPGProperty* wxPropertyGrid::GetNearestPaintVisible( wxPGProperty* p ) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
|
|
||||||
void wxPropertyGrid::SetButtonShortcut( int keycode, bool ctrlDown, bool altDown )
|
|
||||||
{
|
|
||||||
if ( keycode )
|
|
||||||
{
|
|
||||||
m_pushButKeyCode = keycode;
|
|
||||||
m_pushButKeyCodeNeedsCtrl = ctrlDown ? 1 : 0;
|
|
||||||
m_pushButKeyCodeNeedsAlt = altDown ? 1 : 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_pushButKeyCode = WXK_DOWN;
|
|
||||||
m_pushButKeyCodeNeedsCtrl = 0;
|
|
||||||
m_pushButKeyCodeNeedsAlt = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// Methods related to change in value, value modification and sending events
|
// Methods related to change in value, value modification and sending events
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -4999,7 +4978,7 @@ void wxPropertyGrid::HandleKeyEvent(wxKeyEvent &event)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Show dialog?
|
// Show dialog?
|
||||||
if ( ButtonTriggerKeyTest(event) )
|
if ( ButtonTriggerKeyTest(action, event) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPGProperty* p = m_selected;
|
wxPGProperty* p = m_selected;
|
||||||
@@ -5196,8 +5175,6 @@ void wxPropertyGrid::OnKey( wxKeyEvent &event )
|
|||||||
|
|
||||||
void wxPropertyGrid::OnKeyUp(wxKeyEvent &event)
|
void wxPropertyGrid::OnKeyUp(wxKeyEvent &event)
|
||||||
{
|
{
|
||||||
m_keyComboConsumed = 0;
|
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5285,19 +5262,19 @@ void wxPropertyGrid::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxPropertyGrid::ButtonTriggerKeyTest( wxKeyEvent &event )
|
bool wxPropertyGrid::ButtonTriggerKeyTest( int action, wxKeyEvent& event )
|
||||||
{
|
{
|
||||||
int keycode = event.GetKeyCode();
|
if ( action == -1 )
|
||||||
|
{
|
||||||
|
int secondAction;
|
||||||
|
action = KeyEventToActions(event, &secondAction);
|
||||||
|
}
|
||||||
|
|
||||||
// Does the keycode trigger button?
|
// Does the keycode trigger button?
|
||||||
if ( keycode == m_pushButKeyCode &&
|
if ( action == wxPG_ACTION_PRESS_BUTTON &&
|
||||||
m_wndEditor2 &&
|
m_wndEditor2 )
|
||||||
(!m_pushButKeyCodeNeedsAlt || event.AltDown()) &&
|
|
||||||
(!m_pushButKeyCodeNeedsCtrl || event.ControlDown()) )
|
|
||||||
{
|
{
|
||||||
m_keyComboConsumed = 1;
|
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, m_wndEditor2->GetId());
|
||||||
|
|
||||||
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED,m_wndEditor2->GetId());
|
|
||||||
GetEventHandler()->AddPendingEvent(evt);
|
GetEventHandler()->AddPendingEvent(evt);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5319,7 +5296,7 @@ void wxPropertyGrid::OnChildKeyDown( wxKeyEvent &event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ButtonTriggerKeyTest(event) )
|
if ( ButtonTriggerKeyTest(-1, event) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( HandleChildKey(event) == true )
|
if ( HandleChildKey(event) == true )
|
||||||
@@ -5330,8 +5307,6 @@ void wxPropertyGrid::OnChildKeyDown( wxKeyEvent &event )
|
|||||||
|
|
||||||
void wxPropertyGrid::OnChildKeyUp( wxKeyEvent &event )
|
void wxPropertyGrid::OnChildKeyUp( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
m_keyComboConsumed = 0;
|
|
||||||
|
|
||||||
GetEventHandler()->AddPendingEvent(event);
|
GetEventHandler()->AddPendingEvent(event);
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
Reference in New Issue
Block a user