]> git.saurik.com Git - wxWidgets.git/commitdiff
Minor GTK fixes for wxGrid.
authorRobert Roebling <robert@roebling.de>
Fri, 4 Feb 2000 17:01:47 +0000 (17:01 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 4 Feb 2000 17:01:47 +0000 (17:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index ba851d41a7c7077e9d0f713ea461632b4f774520..d2805a00c800ec297099cb4cbac1b2752a0bbf97 100644 (file)
@@ -347,6 +347,7 @@ private:
 
     void OnMouseEvent( wxMouseEvent& event );
     void OnKeyDown( wxKeyEvent& event );
+    void OnPaint( wxPaintEvent& event );
 
     DECLARE_DYNAMIC_CLASS(wxGridCornerLabelWindow)
     DECLARE_EVENT_TABLE()
index db1971b12b2530f20a45a1b69ad42c42cef4871e..6eec2392e051370f948f384b6fac8c23385ddc0c 100644 (file)
@@ -789,17 +789,35 @@ IMPLEMENT_DYNAMIC_CLASS( wxGridCornerLabelWindow, wxWindow )
 
 BEGIN_EVENT_TABLE( wxGridCornerLabelWindow, wxWindow )
     EVT_MOUSE_EVENTS( wxGridCornerLabelWindow::OnMouseEvent )
+    EVT_PAINT( wxGridCornerLabelWindow::OnPaint)
     EVT_KEY_DOWN( wxGridCornerLabelWindow::OnKeyDown )
 END_EVENT_TABLE()
 
 wxGridCornerLabelWindow::wxGridCornerLabelWindow( wxGrid *parent,
                                                   wxWindowID id,
                                                   const wxPoint &pos, const wxSize &size )
-  : wxWindow( parent, id, pos, size, wxRAISED_BORDER )
+  : wxWindow( parent, id, pos, size )
 {
     m_owner = parent;
 }
 
+void wxGridCornerLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
+{
+    wxPaintDC dc(this);
+    
+    int client_height = 0;
+    int client_width = 0;
+    GetClientSize( &client_width, &client_height );
+    
+    dc.SetPen( *wxBLACK_PEN );
+    dc.DrawLine( client_width-1, client_height-1, client_width-1, 0 );
+    dc.DrawLine( client_width-1, client_height-1, 0, client_height-1 );
+    
+    dc.SetPen( *wxWHITE_PEN );
+    dc.DrawLine( 0, 0, client_width, 0 );
+    dc.DrawLine( 0, 0, 0, client_height );
+}
+
 
 void wxGridCornerLabelWindow::OnMouseEvent( wxMouseEvent& event )
 {
@@ -1021,7 +1039,7 @@ void wxGrid::Init()
     m_defaultColWidth  = WXGRID_DEFAULT_COL_WIDTH;
     m_defaultRowHeight = m_gridWin->GetCharHeight();
 
-#if defined (__WXMOTIF__)  // see also text ctrl sizing in ShowCellEditControl()
+#if defined(__WXMOTIF__) || defined(__WXGTK__)  // see also text ctrl sizing in ShowCellEditControl()
     m_defaultRowHeight += 8;
 #else
     m_defaultRowHeight += 4;
@@ -1081,7 +1099,7 @@ void wxGrid::Init()
                                          "",
                                          wxPoint(1,1),
                                          wxSize(1,1)
-#ifdef __WXMSW__
+#if defined(__WXMSW__)
                                          , wxTE_MULTILINE | wxTE_NO_VSCROLL
 #endif
                                          );
@@ -1475,8 +1493,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
 
                     wxClientDC dc( m_gridWin );
                     PrepareDC( dc );
-                    dc.SetPen(*wxRED_PEN);  // FIXME should be bg col dependent
-                    dc.SetLogicalFunction(wxXOR);
+                    dc.SetLogicalFunction(wxINVERT);
                     if ( m_dragLastPos >= 0 )
                     {
                         dc.DrawLine( left, m_dragLastPos, left+cw, m_dragLastPos );
@@ -1657,8 +1674,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
 
                     wxClientDC dc( m_gridWin );
                     PrepareDC( dc );
-                    dc.SetPen(*wxRED_PEN);  // FIXME should be bg col dependent
-                    dc.SetLogicalFunction(wxXOR);
+                    dc.SetLogicalFunction(wxINVERT);
                     if ( m_dragLastPos >= 0 )
                     {
                         dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch );
@@ -3018,7 +3034,7 @@ void wxGrid::ShowCellEditControl()
             // TODO: remove this if the text ctrl sizing is improved esp. for unix
             //
             int extra;
-#if defined (__WXMOTIF__)
+#if defined(__WXMOTIF__)
             if ( m_currentCellCoords.GetRow() == 0  ||
                  m_currentCellCoords.GetCol() == 0 )
             {
@@ -3039,11 +3055,22 @@ void wxGrid::ShowCellEditControl()
                 extra = 2;
             }
 #endif
+
+#if defined(__WXGTK__)
+            int top_diff = 0;
+            int left_diff = 0;
+            if (left != 0) left_diff++;
+            if (top != 0) top_diff++;
+            rect.SetLeft( left + left_diff );
+            rect.SetTop( top + top_diff );
+            rect.SetRight( rect.GetRight() - left_diff );
+            rect.SetBottom( rect.GetBottom() - top_diff );
+#else
             rect.SetLeft( wxMax(0, left - extra) );
             rect.SetTop( wxMax(0, top - extra) );
             rect.SetRight( rect.GetRight() + 2*extra );
             rect.SetBottom( rect.GetBottom() + 2*extra );
-
+#endif
 
             m_cellEditCtrl->SetSize( rect );
             m_cellEditCtrl->Show( TRUE );