]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
reorganize deferred show logic a bit, to reset m_deferShow properly and avoid realizi...
[wxWidgets.git] / src / generic / grid.cpp
index ecadf47f4283623f034e7eb88977aff1889f966b..4416eded169024b02fd6afb5848533bb64d6030c 100644 (file)
@@ -1515,12 +1515,16 @@ void wxGridCellChoiceEditor::Create(wxWindow* parent,
                                     wxWindowID id,
                                     wxEvtHandler* evtHandler)
 {
-    int style = wxBORDER_NONE;
-    if (!m_allowOthers)
+    int style = wxTE_PROCESS_ENTER |
+                wxTE_PROCESS_TAB |
+                wxBORDER_NONE;
+
+    if ( !m_allowOthers )
         style |= wxCB_READONLY;
     m_control = new wxComboBox(parent, id, wxEmptyString,
                                wxDefaultPosition, wxDefaultSize,
-                               m_choices, style );
+                               m_choices,
+                               style);
 
     wxGridCellEditor::Create(parent, id, evtHandler);
 }
@@ -4131,12 +4135,7 @@ END_EVENT_TABLE()
 
 wxGrid::wxGrid()
 {
-    // in order to make sure that a size event is not
-    // trigerred in a unfinished state
-    m_cornerLabelWin = NULL;
-    m_rowLabelWin = NULL;
-    m_colLabelWin = NULL;
-    m_gridWin = NULL;
+    InitVars();
 }
 
 wxGrid::wxGrid( wxWindow *parent,
@@ -4146,6 +4145,7 @@ wxGrid::wxGrid( wxWindow *parent,
                  long style,
                  const wxString& name )
 {
+    InitVars();
     Create(parent, id, pos, size, style, name);
 }
 
@@ -4203,15 +4203,8 @@ wxGrid::~wxGrid()
 
 void wxGrid::Create()
 {
-    // set to true by CreateGrid
-    m_created = false;
-
     // create the type registry
     m_typeRegistry = new wxGridTypeRegistry;
-    m_selection = NULL;
-
-    m_table = (wxGridTableBase *) NULL;
-    m_ownTable = false;
 
     m_cellEditCtrlEnabled = false;
 
@@ -4405,6 +4398,24 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
     return m_created;
 }
 
+void wxGrid::InitVars()
+{
+    m_created = false;
+
+    m_cornerLabelWin = NULL;
+    m_rowLabelWin = NULL;
+    m_colLabelWin = NULL;
+    m_gridWin = NULL;
+
+    m_table = NULL;
+    m_ownTable = false;
+
+    m_selection = NULL;
+    m_defaultCellAttr = NULL;
+    m_typeRegistry = NULL;
+    m_winCapture = NULL;
+}
+
 void wxGrid::Init()
 {
     m_rowLabelWidth  = WXGRID_DEFAULT_ROW_LABEL_WIDTH;
@@ -6818,7 +6829,7 @@ void wxGrid::Refresh(bool eraseb, const wxRect* rect)
 {
     // Don't do anything if between Begin/EndBatch...
     // EndBatch() will do all this on the last nested one anyway.
-    if (! GetBatchCount())
+    if ( m_created && !GetBatchCount() )
     {
         // Refresh to get correct scrolled position:
         wxScrolledWindow::Refresh(eraseb, rect);
@@ -8133,7 +8144,7 @@ void wxGrid::StringToLines( const wxString& value, wxArrayString& lines ) const
         startPos += pos + 1;
     }
 
-    if ( startPos < (int)value.length() )
+    if ( startPos < (int)tVal.length() )
     {
         lines.Add( tVal.Mid( startPos ) );
     }
@@ -11103,6 +11114,20 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
     return rect;
 }
 
+// ----------------------------------------------------------------------------
+// drop target
+// ----------------------------------------------------------------------------
+
+#if wxUSE_DRAG_AND_DROP
+
+// this allow setting drop target directly on wxGrid
+void wxGrid::SetDropTarget(wxDropTarget *dropTarget)
+{
+    GetGridWindow()->SetDropTarget(dropTarget);
+}
+
+#endif // wxUSE_DRAG_AND_DROP
+
 // ----------------------------------------------------------------------------
 // grid event classes
 // ----------------------------------------------------------------------------