Exemplo n.º 1
0
void wxGridCtrl::DrawRowLabel(wxDC& dc, int row)
{
    if (GetRowHeight(row) <= 0 || m_rowLabelWidth <= 0)
        return;
    wxRect rect;
#ifdef __WXGTK20__
    rect.SetX(1);
    rect.SetY(GetRowTop(row) + 1);
    rect.SetWidth(m_rowLabelWidth - 2);
    rect.SetHeight(GetRowHeight(row) - 2);
    CalcScrolledPosition(0, rect.y, NULL, &rect.y);
    wxWindowDC *win_dc = (wxWindowDC*)&dc;
    wxRendererNative::Get().DrawHeaderButton(win_dc->m_owner, dc, rect, 0);
#else
    int rowTop = GetRowTop(row), rowBottom = GetRowBottom(row) - 1;
    dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID));
    dc.DrawLine(m_rowLabelWidth - 1, rowTop, m_rowLabelWidth - 1, rowBottom);
    dc.DrawLine(0, rowTop, 0, rowBottom);
    dc.DrawLine(0, rowBottom, m_rowLabelWidth, rowBottom);
    dc.SetPen(*wxWHITE_PEN);
    dc.DrawLine(1, rowTop, 1, rowBottom);
    dc.DrawLine(1, rowTop, m_rowLabelWidth - 1, rowTop);
#endif
    if (row == GetGridCursorRow())
    {
        dc.DrawBitmap(m_pImageList->GetBitmap(4), 0, GetRowTop(row), true);
    }
}
Exemplo n.º 2
0
void CustomGrid::DrawRowLabel( wxDC& dc, int row )
{
    //init dc font and colours
    dc.SetFont( m_labelFont );
    dc.SetPen(GetDefaultGridLinePen());
	dc.SetBrush( wxBrush( m_labelBackgroundColour, wxBRUSHSTYLE_SOLID ) );
    int w = dc.GetTextExtent(_T("Speed")).x;
    wxString label1,label2;
    label1 = GetRowLabelValue(row).BeforeFirst(',', &label2);
    bool pline = true;
    //row is the first of 3 for the same parameter (wind ... waves ...)
    if(GetNumberRows() > row + 2 && label1 == GetRowLabelValue(row + 2).BeforeFirst(',')){
        pline = false;
        if(IsRowVisible(row + 2))
            label1 = _T(" ");
    }
    //row is the second of 3 or the first of 2
    else if(GetNumberRows() > row + 1 && label1 == GetRowLabelValue(row + 1).BeforeFirst(',')){
        pline = false;
        if(row > 0 && label1 == GetRowLabelValue(row - 1).BeforeFirst(',')){    //second of 3
            if(!IsRowVisible(row + 1))
                label1 = _T(" ");
        }
    }
    //row is the last of 3
    else if(row > 1 && label1 == GetRowLabelValue(row - 2).BeforeFirst(',')){
        if(IsRowVisible(row - 1))
            label1 = _T(" ");
    }
    //row is the last of 2
    else if(row > 0 && label1 == GetRowLabelValue(row - 1).BeforeFirst(',')){
        if(IsRowVisible(row - 1))
            label1 = _T(" ");
    }
    //draw first part of the label
    wxRect aRect(5, GetRowTop(row), m_rowLabelWidth - w, GetRowHeight(row));
    dc.DrawLabel(label1, aRect, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
    //draw second part of the label
    wxRect bRect(m_rowLabelWidth - w, GetRowTop(row), w, GetRowHeight(row));
    dc.SetFont( wxFont(m_labelFont).Scale(0.85) );
    dc.DrawLabel(label2 , bRect, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
    //draw row lines around labels
    if(pline)
        dc.DrawLine(0, GetRowBottom(row) - 1, m_rowLabelWidth, GetRowBottom(row) - 1);
    dc.DrawLine(0, GetRowTop(row), 0, GetRowBottom(row) );
    dc.DrawLine(m_rowLabelWidth - 1, GetRowTop(row), m_rowLabelWidth - 1, GetRowBottom(row) );
}
Exemplo n.º 3
0
void wxGridCtrl::DrawRowLabel(wxDC& dc, int row)
{
    if (GetRowHeight(row) <= 0 || m_rowLabelWidth <= 0)
        return;
    wxRect rect;
    int rowTop = GetRowTop(row), rowBottom = GetRowBottom(row) - 1;
    dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID));
    dc.DrawLine(m_rowLabelWidth - 1, rowTop, m_rowLabelWidth - 1, rowBottom);
    dc.DrawLine(0, rowTop, 0, rowBottom);
    dc.DrawLine(0, rowBottom, m_rowLabelWidth, rowBottom);
    dc.SetPen(*wxWHITE_PEN);
    dc.DrawLine(1, rowTop, 1, rowBottom);
    dc.DrawLine(1, rowTop, m_rowLabelWidth - 1, rowTop);
    if (row == GetGridCursorRow())
	{
		dc.DrawBitmap(wxBitmap(small_arrow_xpm), 0, GetRowTop(row), true);
    }
}