Minor GTK fixes for wxGrid.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -347,6 +347,7 @@ private:
|
|||||||
|
|
||||||
void OnMouseEvent( wxMouseEvent& event );
|
void OnMouseEvent( wxMouseEvent& event );
|
||||||
void OnKeyDown( wxKeyEvent& event );
|
void OnKeyDown( wxKeyEvent& event );
|
||||||
|
void OnPaint( wxPaintEvent& event );
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxGridCornerLabelWindow)
|
DECLARE_DYNAMIC_CLASS(wxGridCornerLabelWindow)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -789,17 +789,35 @@ IMPLEMENT_DYNAMIC_CLASS( wxGridCornerLabelWindow, wxWindow )
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE( wxGridCornerLabelWindow, wxWindow )
|
BEGIN_EVENT_TABLE( wxGridCornerLabelWindow, wxWindow )
|
||||||
EVT_MOUSE_EVENTS( wxGridCornerLabelWindow::OnMouseEvent )
|
EVT_MOUSE_EVENTS( wxGridCornerLabelWindow::OnMouseEvent )
|
||||||
|
EVT_PAINT( wxGridCornerLabelWindow::OnPaint)
|
||||||
EVT_KEY_DOWN( wxGridCornerLabelWindow::OnKeyDown )
|
EVT_KEY_DOWN( wxGridCornerLabelWindow::OnKeyDown )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxGridCornerLabelWindow::wxGridCornerLabelWindow( wxGrid *parent,
|
wxGridCornerLabelWindow::wxGridCornerLabelWindow( wxGrid *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint &pos, const wxSize &size )
|
const wxPoint &pos, const wxSize &size )
|
||||||
: wxWindow( parent, id, pos, size, wxRAISED_BORDER )
|
: wxWindow( parent, id, pos, size )
|
||||||
{
|
{
|
||||||
m_owner = parent;
|
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 )
|
void wxGridCornerLabelWindow::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
@@ -1021,7 +1039,7 @@ void wxGrid::Init()
|
|||||||
m_defaultColWidth = WXGRID_DEFAULT_COL_WIDTH;
|
m_defaultColWidth = WXGRID_DEFAULT_COL_WIDTH;
|
||||||
m_defaultRowHeight = m_gridWin->GetCharHeight();
|
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;
|
m_defaultRowHeight += 8;
|
||||||
#else
|
#else
|
||||||
m_defaultRowHeight += 4;
|
m_defaultRowHeight += 4;
|
||||||
@@ -1081,7 +1099,7 @@ void wxGrid::Init()
|
|||||||
"",
|
"",
|
||||||
wxPoint(1,1),
|
wxPoint(1,1),
|
||||||
wxSize(1,1)
|
wxSize(1,1)
|
||||||
#ifdef __WXMSW__
|
#if defined(__WXMSW__)
|
||||||
, wxTE_MULTILINE | wxTE_NO_VSCROLL
|
, wxTE_MULTILINE | wxTE_NO_VSCROLL
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -1475,8 +1493,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
|
|||||||
|
|
||||||
wxClientDC dc( m_gridWin );
|
wxClientDC dc( m_gridWin );
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
dc.SetPen(*wxRED_PEN); // FIXME should be bg col dependent
|
dc.SetLogicalFunction(wxINVERT);
|
||||||
dc.SetLogicalFunction(wxXOR);
|
|
||||||
if ( m_dragLastPos >= 0 )
|
if ( m_dragLastPos >= 0 )
|
||||||
{
|
{
|
||||||
dc.DrawLine( left, m_dragLastPos, left+cw, m_dragLastPos );
|
dc.DrawLine( left, m_dragLastPos, left+cw, m_dragLastPos );
|
||||||
@@ -1657,8 +1674,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
|
|||||||
|
|
||||||
wxClientDC dc( m_gridWin );
|
wxClientDC dc( m_gridWin );
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
dc.SetPen(*wxRED_PEN); // FIXME should be bg col dependent
|
dc.SetLogicalFunction(wxINVERT);
|
||||||
dc.SetLogicalFunction(wxXOR);
|
|
||||||
if ( m_dragLastPos >= 0 )
|
if ( m_dragLastPos >= 0 )
|
||||||
{
|
{
|
||||||
dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch );
|
dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch );
|
||||||
@@ -3039,11 +3055,22 @@ void wxGrid::ShowCellEditControl()
|
|||||||
extra = 2;
|
extra = 2;
|
||||||
}
|
}
|
||||||
#endif
|
#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.SetLeft( wxMax(0, left - extra) );
|
||||||
rect.SetTop( wxMax(0, top - extra) );
|
rect.SetTop( wxMax(0, top - extra) );
|
||||||
rect.SetRight( rect.GetRight() + 2*extra );
|
rect.SetRight( rect.GetRight() + 2*extra );
|
||||||
rect.SetBottom( rect.GetBottom() + 2*extra );
|
rect.SetBottom( rect.GetBottom() + 2*extra );
|
||||||
|
#endif
|
||||||
|
|
||||||
m_cellEditCtrl->SetSize( rect );
|
m_cellEditCtrl->SetSize( rect );
|
||||||
m_cellEditCtrl->Show( TRUE );
|
m_cellEditCtrl->Show( TRUE );
|
||||||
|
Reference in New Issue
Block a user