Allow setting custom tooltip text for "New" button in wxPGArrayEditorDialog
Ability to change the tooltip can be useful if standard text "New item" is not descriptive enough.
This commit is contained in:
@@ -796,8 +796,7 @@ wxValidator* PROPNAME::DoGetValidator () const \
|
||||
|
||||
#if wxUSE_EDITABLELISTBOX
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxEditableListBox;
|
||||
class WXDLLIMPEXP_FWD_CORE wxListEvent;
|
||||
#include "wx/editlbox.h"
|
||||
|
||||
#define wxAEDIALOG_STYLE \
|
||||
(wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE)
|
||||
@@ -829,6 +828,15 @@ public:
|
||||
m_hasCustomNewAction = true;
|
||||
}
|
||||
|
||||
void SetNewButtonText(const wxString& text)
|
||||
{
|
||||
m_customNewButtonText = text;
|
||||
if ( m_elb && m_elb->GetNewButton() )
|
||||
{
|
||||
m_elb->GetNewButton()->SetToolTip(text);
|
||||
}
|
||||
}
|
||||
|
||||
// Set value modified by dialog.
|
||||
virtual void SetDialogValue( const wxVariant& WXUNUSED(value) )
|
||||
{
|
||||
@@ -880,6 +888,7 @@ protected:
|
||||
|
||||
bool m_modified;
|
||||
bool m_hasCustomNewAction;
|
||||
wxString m_customNewButtonText;
|
||||
|
||||
// These must be overridden - must return true on success.
|
||||
virtual wxString ArrayGet( size_t index ) = 0;
|
||||
@@ -929,6 +938,7 @@ public:
|
||||
if ( !custBtText.empty() )
|
||||
{
|
||||
EnableCustomNewAction();
|
||||
SetNewButtonText(custBtText);
|
||||
m_pCallingClass = pcc;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user