Copy max width of wxGridCellTextEditor when cloning it.

Previously the max number of characters that could be entered into the editor
was lost when it was cloned, making it impossible to really limit the user
entry.

Closes #15175.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-05-01 20:53:26 +00:00
parent 951b385ad8
commit 4322906f97
4 changed files with 11 additions and 6 deletions

View File

@@ -639,6 +639,7 @@ All (GUI):
- Add wxEVT_GRID_COL_AUTO_SIZE event (Igor Korot).
- Add chainable wxWizardPageSimple::Chain() overload.
- Add wxTextEntryDialog::SetMaxLength() (derEine).
- Fix maximum width support in wxGridCellTextEditor (derEine).
- Add more convenient wxFont(wxFontInfo) ctor.
wxGTK:

View File

@@ -52,7 +52,7 @@ private:
class WXDLLIMPEXP_ADV wxGridCellTextEditor : public wxGridCellEditor
{
public:
wxGridCellTextEditor();
wxEXPLICIT wxGridCellTextEditor(size_t maxChars = 0);
virtual void Create(wxWindow* parent,
wxWindowID id,
@@ -77,7 +77,7 @@ public:
virtual void SetParameters(const wxString& params);
virtual wxGridCellEditor *Clone() const
{ return new wxGridCellTextEditor; }
{ return new wxGridCellTextEditor(m_maxChars); }
// added GetValue so we can get the value which is in the control
virtual wxString GetValue() const;

View File

@@ -625,9 +625,13 @@ class wxGridCellTextEditor : public wxGridCellEditor
{
public:
/**
Default constructor.
Text cell editor constructor.
@param maxChars
Maximum width of text (this parameter is supported starting since
wxWidgets 2.9.5).
*/
wxGridCellTextEditor();
explicit wxGridCellTextEditor(size_t maxChars = 0);
/**
The parameters string format is "n" where n is a number representing

View File

@@ -382,9 +382,9 @@ void wxGridCellEditor::StartingClick()
// wxGridCellTextEditor
// ----------------------------------------------------------------------------
wxGridCellTextEditor::wxGridCellTextEditor()
wxGridCellTextEditor::wxGridCellTextEditor(size_t maxChars)
{
m_maxChars = 0;
m_maxChars = maxChars;
}
void wxGridCellTextEditor::Create(wxWindow* parent,