Have the new incarnation of wxPGArrayEditorDialog support the old-style 'custom button' event as something that happens when the wxEditableListBox's 'New Item' button is pressed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-07-11 16:06:03 +00:00
parent 6dc6bcd8ab
commit 895e26a04b
2 changed files with 44 additions and 25 deletions

View File

@@ -867,6 +867,11 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize );
void EnableCustomNewAction()
{
m_hasCustomNewAction = true;
}
/** Set value modified by dialog.
*/
virtual void SetDialogValue( const wxVariant& WXUNUSED(value) )
@@ -901,8 +906,6 @@ public:
// wxEditableListBox utilities
int GetSelection() const;
//const wxArrayString& GetStrings() const { return m_array; }
// implementation from now on
void OnAddClick(wxCommandEvent& event);
void OnDeleteClick(wxCommandEvent& event);
@@ -913,21 +916,17 @@ public:
protected:
wxEditableListBox* m_elb;
wxButton* m_butCustom; // required for disabling/enabling changing.
wxButton* m_butUp;
wxButton* m_butDown;
// These are used for focus repair
wxWindow* m_elbSubPanel;
wxWindow* m_lastFocused;
const wxChar* m_custBtText;
// A new item, edited by user, is pending at this index.
// It will be committed once list ctrl item editing is done.
int m_itemPendingAtIndex;
bool m_modified;
bool m_hasCustomNewAction;
// These must be overridden - must return true on success.
virtual wxString ArrayGet( size_t index ) = 0;
@@ -936,6 +935,10 @@ protected:
virtual bool ArraySet( size_t index, const wxString& str ) = 0;
virtual void ArrayRemoveAt( int index ) = 0;
virtual void ArraySwap( size_t first, size_t second ) = 0;
virtual bool OnCustomNewAction(wxString* WXUNUSED(resString))
{
return false;
}
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPGArrayEditorDialog)
@@ -967,13 +970,17 @@ public:
return m_array;
}
void SetCustomButton( const wxChar* custBtText, wxArrayStringProperty* pcc )
void SetCustomButton( const wxString& custBtText,
wxArrayStringProperty* pcc )
{
m_custBtText = custBtText;
m_pCallingClass = pcc;
if ( custBtText.length() )
{
EnableCustomNewAction();
m_pCallingClass = pcc;
}
}
void OnCustomEditClick(wxCommandEvent& event);
virtual bool OnCustomNewAction(wxString* resString);
protected:
wxArrayString m_array;