| 67 | } |
| 68 | |
| 69 | void wxDividedShape::OnDrawContents(wxDC& dc) |
| 70 | { |
| 71 | double defaultProportion = (double)(GetRegions().GetCount() > 0 ? (1.0/((double)(GetRegions().GetCount()))) : 0.0); |
| 72 | double currentY = (double)(m_ypos - (m_height / 2.0)); |
| 73 | double maxY = (double)(m_ypos + (m_height / 2.0)); |
| 74 | |
| 75 | double leftX = (double)(m_xpos - (m_width / 2.0)); |
| 76 | double rightX = (double)(m_xpos + (m_width / 2.0)); |
| 77 | |
| 78 | if (m_pen) dc.SetPen(* m_pen); |
| 79 | |
| 80 | dc.SetTextForeground(m_textColour); |
| 81 | |
| 82 | #ifdef __WXMSW__ |
| 83 | // For efficiency, don't do this under X - doesn't make |
| 84 | // any visible difference for our purposes. |
| 85 | if (m_brush) |
| 86 | dc.SetTextBackground(m_brush->GetColour()); |
| 87 | #endif |
| 88 | /* |
| 89 | if (!formatted) |
| 90 | { |
| 91 | FormatRegionText(); |
| 92 | formatted = true; |
| 93 | } |
| 94 | */ |
| 95 | if (GetDisableLabel()) return; |
| 96 | |
| 97 | double xMargin = 2; |
| 98 | double yMargin = 2; |
| 99 | dc.SetBackgroundMode(wxTRANSPARENT); |
| 100 | |
| 101 | wxObjectList::compatibility_iterator node = GetRegions().GetFirst(); |
| 102 | while (node) |
| 103 | { |
| 104 | wxShapeRegion *region = (wxShapeRegion *)node->GetData(); |
| 105 | dc.SetFont(* region->GetFont()); |
| 106 | dc.SetTextForeground(region->GetActualColourObject()); |
| 107 | |
| 108 | double proportion = |
| 109 | region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY; |
| 110 | |
| 111 | double y = currentY + m_height*proportion; |
| 112 | double actualY = maxY < y ? maxY : y; |
| 113 | |
| 114 | double centreX = m_xpos; |
| 115 | double centreY = (double)(currentY + (actualY - currentY)/2.0); |
| 116 | |
| 117 | oglDrawFormattedText(dc, ®ion->m_formattedText, |
| 118 | (double)(centreX), (double)(centreY), (double)(m_width-2*xMargin), (double)(actualY - currentY - 2*yMargin), |
| 119 | region->m_formatMode); |
| 120 | if ((y <= maxY) && (node->GetNext())) |
| 121 | { |
| 122 | wxPen *regionPen = region->GetActualPen(); |
| 123 | if (regionPen) |
| 124 | { |
| 125 | dc.SetPen(* regionPen); |
| 126 | dc.DrawLine(WXROUND(leftX), WXROUND(y), WXROUND(rightX), WXROUND(y)); |
nothing calls this directly
no test coverage detected