]> git.saurik.com Git - wxWidgets.git/commitdiff
extract setting max length in wxGridCellTextEditor::DoCreate() and call it from wxGri...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 1 Jun 2007 22:05:12 +0000 (22:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 1 Jun 2007 22:05:12 +0000 (22:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/grid.h
src/generic/grid.cpp
src/generic/gridctrl.cpp

index bb8a5b3d0fb35ab4241076e02c77cd044c2fa547..293b11ff84bd4a2f8af30dc52bdf67cd37f53248 100644 (file)
@@ -423,6 +423,8 @@ protected:
     wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; }
 
     // parts of our virtual functions reused by the derived classes
     wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; }
 
     // parts of our virtual functions reused by the derived classes
+    void DoCreate(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler,
+                  long style = 0);
     void DoBeginEdit(const wxString& startValue);
     void DoReset(const wxString& startValue);
 
     void DoBeginEdit(const wxString& startValue);
     void DoReset(const wxString& startValue);
 
index d700d5b2a752b4d883d6946bc5315682dc314752..945a7914bc43a2076602ac37ce35b51a8fff18cb 100644 (file)
@@ -642,21 +642,29 @@ void wxGridCellTextEditor::Create(wxWindow* parent,
                                   wxWindowID id,
                                   wxEvtHandler* evtHandler)
 {
                                   wxWindowID id,
                                   wxEvtHandler* evtHandler)
 {
-    m_control = new wxTextCtrl(parent, id, wxEmptyString,
-                               wxDefaultPosition, wxDefaultSize
+    DoCreate(parent, id, evtHandler);
+}
+
+void wxGridCellTextEditor::DoCreate(wxWindow* parent,
+                                    wxWindowID id,
+                                    wxEvtHandler* evtHandler,
+                                    long style)
+{
 #if defined(__WXMSW__)
 #if defined(__WXMSW__)
-                               ,
-                               wxTE_PROCESS_ENTER |
-                               wxTE_PROCESS_TAB |
-                               wxTE_AUTO_SCROLL |
-                               wxNO_BORDER
+    style |= wxTE_PROCESS_ENTER |
+             wxTE_PROCESS_TAB |
+             wxTE_AUTO_SCROLL |
+             wxNO_BORDER;
 #endif
 #endif
-                              );
+
+    m_control = new wxTextCtrl(parent, id, wxEmptyString,
+                               wxDefaultPosition, wxDefaultSize,
+                               style);
 
     // set max length allowed in the textctrl, if the parameter was set
 
     // set max length allowed in the textctrl, if the parameter was set
-    if (m_maxChars != 0)
+    if ( m_maxChars != 0 )
     {
     {
-        ((wxTextCtrl*)m_control)->SetMaxLength(m_maxChars);
+        Text()->SetMaxLength(m_maxChars);
     }
 
     wxGridCellEditor::Create(parent, id, evtHandler);
     }
 
     wxGridCellEditor::Create(parent, id, evtHandler);
index 27c709e3ab0ea017d2e8d5c4fd5835a5f7d581d5..1dd5e68813fb18a0f7e44b5a0a0dc64db7deb35a 100644 (file)
@@ -292,12 +292,8 @@ wxGridCellAutoWrapStringEditor::Create(wxWindow* parent,
                                        wxWindowID id,
                                        wxEvtHandler* evtHandler)
 {
                                        wxWindowID id,
                                        wxEvtHandler* evtHandler)
 {
-  m_control = new wxTextCtrl(parent, id, wxEmptyString,
-                             wxDefaultPosition, wxDefaultSize,
-                             wxTE_MULTILINE | wxTE_RICH);
-
-
-  wxGridCellEditor::Create(parent, id, evtHandler);
+  wxGridCellTextEditor::DoCreate(parent, id, evtHandler,
+                                 wxTE_MULTILINE | wxTE_RICH);
 }
 
 void
 }
 
 void