]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
switch to cf implementation
[wxWidgets.git] / src / generic / grid.cpp
index 0c7b85e417e96b5309db9c3cdcd254ff5f7b61e3..57cab57ad9974fff20829e0950e44394a507622f 100644 (file)
@@ -650,12 +650,10 @@ void wxGridCellTextEditor::DoCreate(wxWindow* parent,
                                     wxEvtHandler* evtHandler,
                                     long style)
 {
-#if defined(__WXMSW__)
     style |= wxTE_PROCESS_ENTER |
              wxTE_PROCESS_TAB |
              wxTE_AUTO_SCROLL |
              wxNO_BORDER;
-#endif
 
     m_control = new wxTextCtrl(parent, id, wxEmptyString,
                                wxDefaultPosition, wxDefaultSize,
@@ -1522,10 +1520,12 @@ void wxGridCellChoiceEditor::Create(wxWindow* parent,
                                     wxWindowID id,
                                     wxEvtHandler* evtHandler)
 {
+    int style = wxBORDER_NONE;
+    if (!m_allowOthers)
+        style |= wxCB_READONLY;
     m_control = new wxComboBox(parent, id, wxEmptyString,
                                wxDefaultPosition, wxDefaultSize,
-                               m_choices,
-                               m_allowOthers ? 0 : wxCB_READONLY);
+                               m_choices, style );
 
     wxGridCellEditor::Create(parent, id, evtHandler);
 }
@@ -1560,8 +1560,9 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid)
     if (m_allowOthers)
     {
         Combo()->SetValue(m_startValue);
+        Combo()->SetInsertionPointEnd();
     }
-    else
+    else // the combobox is read-only
     {
         // find the right position, or default to the first if not found
         int pos = Combo()->FindString(m_startValue);
@@ -1570,7 +1571,6 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid)
         Combo()->SetSelection(pos);
     }
 
-    Combo()->SetInsertionPointEnd();
     Combo()->SetFocus();
 
     if (evtHandler)
@@ -2206,8 +2206,7 @@ wxSize wxGridCellBoolRenderer::GetBestSize(wxGrid& grid,
         wxSize size = checkbox->GetBestSize();
         wxCoord checkSize = size.y + 2 * wxGRID_CHECKMARK_MARGIN;
 
-        // FIXME wxGTK::wxCheckBox::GetBestSize() gives "wrong" result
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#if defined(__WXMOTIF__)
         checkSize -= size.y / 2;
 #endif
 
@@ -2236,7 +2235,7 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
     if ( size.x >= minSize || size.y >= minSize )
     {
         // and even leave (at least) 1 pixel margin
-        size.x = size.y = minSize - 2;
+        size.x = size.y = minSize;
     }
 
     // draw a border around checkmark
@@ -2277,26 +2276,11 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
         value = wxGridCellBoolEditor::IsTrueValue(cellval);
     }
 
-    if ( value )
-    {
-        wxRect rectMark = rectBorder;
-
-#ifdef __WXMSW__
-        // MSW DrawCheckMark() is weird (and should probably be changed...)
-        rectMark.Inflate(-wxGRID_CHECKMARK_MARGIN / 2);
-        rectMark.x++;
-        rectMark.y++;
-#else
-        rectMark.Inflate(-wxGRID_CHECKMARK_MARGIN);
-#endif
-
-        dc.SetTextForeground(attr.GetTextColour());
-        dc.DrawCheckMark(rectMark);
-    }
-
-    dc.SetBrush(*wxTRANSPARENT_BRUSH);
-    dc.SetPen(wxPen(attr.GetTextColour(), 1, wxSOLID));
-    dc.DrawRectangle(rectBorder);
+    int flags = 0;
+    if (value)
+        flags |= wxCONTROL_CHECKED; 
+        
+    wxRendererNative::Get().DrawCheckBox( &grid, dc, rectBorder, flags );
 }
 
 // ----------------------------------------------------------------------------
@@ -6298,7 +6282,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
             if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
             {
                 if ( CanDragRowSize() && CanDragGridSize() )
-                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW);
+                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, NULL, false);
             }
         }
         else if ( dragCol >= 0 )
@@ -6308,7 +6292,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
             if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
             {
                 if ( CanDragColSize() && CanDragGridSize() )
-                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL);
+                    ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, NULL, false);
             }
         }
         else // Neither on a row or col edge
@@ -8475,7 +8459,7 @@ void wxGrid::ShowCellEditControl()
                 if (rect.GetRight() > client_right)
                     rect.SetRight( client_right - 1 );
             }
-
+            
             editor->SetCellAttr( attr );
             editor->SetSize( rect );
             if (nXMove != 0)