コード例 #1
0
ファイル: CustomGrid.cpp プロジェクト: OpenCPN/OpenCPN
void CustomGrid::DrawColLabel( wxDC& dc, int col )
{
    //init dc font and colours
	dc.SetFont(m_labelFont);
    if(col == m_gParent->m_pIndex){
        dc.SetBrush(wxBrush(m_greenColour, wxBRUSHSTYLE_SOLID));
        dc.SetPen(wxPen(m_greenColour, 1));
    }else {
        dc.SetBrush(wxBrush(m_labelBackgroundColour, wxBRUSHSTYLE_SOLID));
        dc.SetPen(wxPen(m_labelBackgroundColour, 1));
    }
    //draw retangle
	wxRect tRect( GetColLeft(col), 1, GetColWidth(col)-2,  m_colLabelHeight -2);
    dc.DrawRectangle(tRect);
    //draw lines aroud label
    dc.SetPen(GetDefaultGridLinePen());
    dc.DrawLine( GetColLeft(col) -1, 0, GetColRight(col), 0 );
    if( col > -1 && (col == 0 || GetColLabelValue( col ).BeforeFirst('-') != GetColLabelValue( col - 1 ).BeforeFirst('-')) )
        dc.SetPen(wxPen(*wxBLACK, 4));
    dc.DrawLine( GetColLeft(col) -1, 0, GetColLeft(col) - 1, m_colLabelHeight);
    if( col == m_numCols - 1 ){
        dc.SetPen(wxPen(*wxBLACK, 4));
        dc.DrawLine( GetColRight(col), 0, GetColRight(col), m_colLabelHeight);
    }
    //then draw label
    dc.DrawLabel(GetColLabelValue(col), tRect, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL);
}
コード例 #2
0
wxPen CGridAnalysis::GetColGridLinePen(int nCol)
{
  if(m_setColChannelChange.find(nCol) == m_setColChannelChange.end())
  {
    return GetDefaultGridLinePen();
  }
  return *wxBLACK_PEN;
}
コード例 #3
0
wxPen CGridAnalysis::GetRowGridLinePen(int nRow)
{
  nRow++;
  if(nRow == GetNumberRows())
  {
    return *wxBLACK_PEN;
  }
  return GetDefaultGridLinePen();
}
コード例 #4
0
ファイル: CustomGrid.cpp プロジェクト: OpenCPN/OpenCPN
void CustomGrid::DrawCornerLabel( wxDC& dc )
{
    dc.SetPen(GetDefaultGridLinePen());
	dc.SetBrush( wxBrush( m_labelBackgroundColour, wxBRUSHSTYLE_SOLID ) );
    wxRect rect( 0, 0, m_rowLabelWidth, m_colLabelHeight );
    dc.DrawRectangle(rect);
    ////scale bitmap to near col label height
    double hc = m_colLabelHeight;
    double hb = wxBitmap(now).GetHeight();
    double scfac = ((hc / hb) *4) /4;
    wxBitmap bmp = m_gParent->GetScaledBitmap(wxBitmap(now), _T("now"), scfac );
    //center bitmap
    int x = (m_rowLabelWidth - bmp.GetWidth()) / 2;
    int y = (m_colLabelHeight == bmp.GetHeight())? 0: wxMax( 0, (m_colLabelHeight - bmp.GetHeight()) / 2 );
    dc.DrawBitmap( bmp, x, y );
}
コード例 #5
0
ファイル: CustomGrid.cpp プロジェクト: OpenCPN/OpenCPN
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) );
}