/** * Render the event in the bitmap */ void CppCodeEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) { #if !defined(GD_NO_WX_GUI) gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get(); const int titleTextHeight = 20; //Draw header rectangle wxRect headerRect(x, y, width, GetRenderedHeight(width, platform)); renderingHelper->DrawNiceRectangle(dc, headerRect); //Header dc.SetFont( renderingHelper->GetNiceFont().Bold() ); if ( !IsDisabled() ) dc.SetTextForeground( wxColour( 0, 0, 0 ) ); else dc.SetTextForeground( wxColour( 160, 160, 160 ) ); dc.DrawText( (displayedName.empty() ? _("C++ code") : _("C++ code:")) + displayedName, x + 4, y + 3 ); if ( codeDisplayedInEditor ) { dc.SetFont( renderingHelper->GetFont() ); dc.SetBrush(renderingHelper->GetActionsRectangleFillBrush()); dc.SetPen(renderingHelper->GetActionsRectangleOutlinePen()); dc.DrawRectangle(wxRect(x + 4, y + 3 + titleTextHeight + 2, width-8, GetRenderedHeight(width, platform)-(3 + titleTextHeight + 5))); dc.DrawLabel( inlineCode, wxNullBitmap, wxRect(x + 4, y + 3 + titleTextHeight + 4, width-2, GetRenderedHeight(width, platform))); } #endif }
void wxBitmapComboBoxBase::DrawBackground(wxDC& dc, const wxRect& rect, int WXUNUSED(item), int flags) const { if ( flags & wxODCB_PAINTING_SELECTED ) { const int vSizeDec = 0; // Vertical size reduction of selection rectangle edges dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); wxColour selCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); dc.SetPen(selCol); dc.SetBrush(selCol); dc.DrawRectangle(rect.x, rect.y+vSizeDec, rect.width, rect.height-(vSizeDec*2)); } else { dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); wxColour selCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); dc.SetPen(selCol); dc.SetBrush(selCol); dc.DrawRectangle(rect); } }
void ScrubbingOverlay::Draw (wxDC &dc, TrackPanelCellIterator, TrackPanelCellIterator) { mLastScrubRect = mNextScrubRect; mLastScrubSpeedText = mNextScrubSpeedText; Scrubber &scrubber = GetScrubber(); if (!scrubber.ShouldDrawScrubSpeed()) return; static const wxFont labelFont(24, wxSWISS, wxNORMAL, wxNORMAL); dc.SetFont(labelFont); // These two colors were previously saturated red and green. However // we have a rule to try to only use red for reserved purposes of // (a) Recording // (b) Error alerts // So they were changed to 'orange' and 'lime'. static const wxColour clrNoScroll(215, 162, 0), clrScroll(0, 204, 153); #ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL if (scrubber.IsScrollScrubbing()) dc.SetTextForeground(clrScroll); else #endif dc.SetTextForeground(clrNoScroll); dc.DrawText(mLastScrubSpeedText, mLastScrubRect.GetX(), mLastScrubRect.GetY()); }
void ClueListBox::OnDrawItem(wxDC & dc, const wxRect & rect, size_t n) const { wxRect numRect(rect); numRect.SetWidth(m_numWidth); wxRect textRect(rect); textRect.SetX(numRect.GetRight() + GetMargins().x); textRect.SetWidth(rect.width - GetMargins().x); // Get fonts and colors dc.SetFont(GetFont()); if (IsSelected(n)) dc.SetTextForeground(GetSelectionForeground()); else dc.SetTextForeground(GetForegroundColour()); XPuzzle::Clue clue = GetItem(n); dc.DrawLabel(wxString::Format(_T("%d."), clue.Number()), numRect, wxALIGN_RIGHT|wxALIGN_TOP); wxASSERT(! m_cachedClues.at(n).empty()); dc.DrawLabel(m_cachedClues.at(n), textRect); //dc.DrawLine(textRect.x, textRect.y, textRect.x + textRect.width, textRect.y + textRect.height); }
void wxHtmlColourCell::DrawInvisible(wxDC& dc, int WXUNUSED(x), int WXUNUSED(y), wxHtmlRenderingInfo& info) { wxHtmlRenderingState& state = info.GetState(); if (m_Flags & wxHTML_CLR_FOREGROUND) { state.SetFgColour(m_Colour); if (state.GetSelectionState() != wxHTML_SEL_IN) dc.SetTextForeground(m_Colour); else dc.SetTextForeground( info.GetStyle().GetSelectedTextColour(m_Colour)); } if (m_Flags & wxHTML_CLR_BACKGROUND) { state.SetBgColour(m_Colour); if (state.GetSelectionState() != wxHTML_SEL_IN) { dc.SetTextBackground(m_Colour); dc.SetBackground(wxBrush(m_Colour, wxSOLID)); } else { wxColour c = info.GetStyle().GetSelectedTextBgColour(m_Colour); dc.SetTextBackground(c); dc.SetBackground(wxBrush(c, wxSOLID)); } } }
void wxSheetCellStringRendererRefData::SetTextColoursAndFont(wxSheet& sheet, const wxSheetCellAttr& attr, wxDC& dc, bool isSelected) { dc.SetBackgroundMode( wxTRANSPARENT ); // TODO some special colours for attr.IsReadOnly() case? // different coloured text when the sheet is disabled if ( sheet.IsEnabled() ) { if ( isSelected ) { dc.SetTextBackground( sheet.GetSelectionBackground() ); dc.SetTextForeground( sheet.GetSelectionForeground() ); } else { dc.SetTextBackground( attr.GetBackgroundColour() ); dc.SetTextForeground( attr.GetForegroundColour() ); } } else { dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); } dc.SetFont( attr.GetFont() ); }
void DrawMode(wxDC& dc, const CalChartConfiguration& config, const ShowMode& mode, HowToDraw howToDraw) { switch (howToDraw) { case ShowMode_kFieldView: case ShowMode_kAnimation: case ShowMode_kOmniView: dc.SetPen(config.Get_CalChartBrushAndPen(COLOR_FIELD_DETAIL).second); dc.SetTextForeground(config.Get_CalChartBrushAndPen(COLOR_FIELD_TEXT).second.GetColour()); break; case ShowMode_kPrinting: dc.SetPen(*wxBLACK_PEN); dc.SetTextForeground(*wxBLACK); break; } try { auto real_mode = dynamic_cast<const ShowModeStandard&>(mode); ShowModeStandard_DrawHelper(dc, config, real_mode, howToDraw); } catch (std::bad_cast&) { // now try as spring show auto real_mode = dynamic_cast<const ShowModeSprShow&>(mode); ShowModeSprShow_DrawHelper(dc, config, real_mode, howToDraw); } }
void DrawSheetPoints(wxDC& dc, const CalChartConfiguration& config, CC_coord origin, const SelectionList& selection_list, unsigned short numberPoints, const std::vector<std::string>& labels, const CC_sheet& sheet, unsigned ref, CalChartColors unselectedColor, CalChartColors selectedColor, CalChartColors unselectedTextColor, CalChartColors selectedTextColor) { SaveAndRestore_Font orig_font(dc); wxFont *pointLabelFont = wxTheFontList->FindOrCreateFont((int)Float2Coord(config.Get_DotRatio() * config.Get_NumRatio()), wxSWISS, wxNORMAL, wxNORMAL); dc.SetFont(*pointLabelFont); dc.SetTextForeground(config.Get_CalChartBrushAndPen(COLOR_POINT_TEXT).first.GetColour()); for (size_t i = 0; i < numberPoints; i++) { wxBrush fillBrush; if (selection_list.count(i)) { auto brushAndPen = config.Get_CalChartBrushAndPen(selectedColor); fillBrush = brushAndPen.first; dc.SetBrush(brushAndPen.first); dc.SetPen(brushAndPen.second); dc.SetTextForeground(config.Get_CalChartBrushAndPen(selectedTextColor).second.GetColour()); } else { auto brushAndPen = config.Get_CalChartBrushAndPen(unselectedColor); fillBrush = brushAndPen.first; dc.SetBrush(brushAndPen.first); dc.SetPen(brushAndPen.second); dc.SetTextForeground(config.Get_CalChartBrushAndPen(unselectedTextColor).second.GetColour()); } DrawPoint(dc, config, sheet.GetPoint(i), ref, origin, labels.at(i)); } }
/** * Render the event in the bitmap */ void LinkEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) { #if !defined(GD_NO_WX_GUI) gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get(); dc.SetBrush( wxBrush( wxColour( 255, 255, 255 ) ) ); dc.SetPen( wxPen( wxColour( 0, 0, 0 ), 1) ); wxRect rect(x+1, y, width-2, GetRenderedHeight(width, platform)-2); dc.DrawRectangle(rect); dc.DrawBitmap( gd::SkinHelper::GetIcon("events", 24), x+4, y + 1, true); dc.SetTextBackground( wxColour( 255, 255, 255 ) ); if ( !IsDisabled() ) dc.SetTextForeground( wxColour( 0, 0, 0 ) ); else dc.SetTextForeground( wxColour( 160, 160, 160 ) ); dc.SetFont(renderingHelper->GetNiceFont()); dc.DrawText( _("Link to ")+GetTarget(), x+32, y + 3 ); if ( GetIncludeConfig() == INCLUDE_BY_INDEX ) { wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget()); dc.DrawText( _("Include only events ")+gd::String::From(GetIncludeStart()+1)+_(" to ")+gd::String::From(GetIncludeEnd()+1), x+textRect.GetWidth()+32+10, y + 5 ); } else if ( GetIncludeConfig() == INCLUDE_EVENTS_GROUP ) { wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget()); dc.DrawText( _("Include only the events group named \"")+gd::String::From(GetEventsGroupName())+_("\""), x+textRect.GetWidth()+32+10, y + 5 ); } #endif }
/** * Render the event in the bitmap */ void LinkEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) { #if !defined(GD_NO_WX_GUI) dc.SetBrush( wxBrush( wxColour( 255, 255, 255 ) ) ); dc.SetPen( wxPen( wxColour( 0, 0, 0 ), 1) ); wxRect rect(x+1, y, width, GetRenderedHeight(width, platform)-2); dc.DrawRectangle(rect); dc.DrawBitmap( gd::SkinHelper::GetIcon("events", 24), x+4, y + 1, true); dc.SetTextBackground( wxColour( 255, 255, 255 ) ); if ( !IsDisabled() ) dc.SetTextForeground( wxColour( 0, 0, 0 ) ); else dc.SetTextForeground( wxColour( 160, 160, 160 ) ); dc.SetFont( wxFont( 12, wxDEFAULT, wxNORMAL, wxNORMAL ) ); dc.DrawText( _("Link to ")+GetTarget(), x+32, y + 3 ); wxRect lien = dc.GetTextExtent(_("Link to ")+GetTarget()); dc.SetFont( wxFont( 10, wxDEFAULT, wxNORMAL, wxNORMAL ) ); if ( IncludeAllEvents() ) dc.DrawText( _("Include all events"), x+lien.GetWidth()+32+10, y + 5 ); else dc.DrawText( _("Include events ")+ToString(GetIncludeStart()+1)+_(" to ")+ToString(GetIncludeEnd()+1), x+lien.GetWidth()+32+10, y + 5 ); #endif }
void wxCustomStatusBarArt::DrawText(wxDC& dc, wxCoord x, wxCoord y, const wxString& text) { dc.SetTextForeground(GetTextShadowColour()); dc.DrawText(text, x, y - 1); dc.SetTextForeground(GetTextColour()); dc.DrawText(text, x, y); }
void wxJigsawInputParameter::Draw(wxDC & dc, const wxPoint & pos, const wxSize & offset, double scale, wxColour color) { wxPoint realPosition( pos.x + offset.GetWidth(), pos.y /*+ offset.GetHeight()*/); /*wxLogTrace(wxTraceMask(), _("ParameterPos = %i,%i; Offset=%i, %i"), realPosition.x, realPosition.y, offset.x, offset.y);*/ wxSize labelSize; wxSize size = GetSize(dc, scale); dc.GetTextExtent(m_Label, &labelSize.x, &labelSize.y, 0, 0, (wxFont *)&dc.GetFont()); //Draw the text with bevel wxRect rectText(realPosition, size); rectText.x++; rectText.y++; dc.SetTextForeground(*wxBLACK); dc.DrawLabel(m_Label, rectText, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL); rectText.x--; rectText.y--; dc.SetTextForeground(*wxWHITE); dc.DrawLabel(m_Label, rectText, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL); wxPoint shapePos; wxSize shapeSize; if(m_Shape) { shapeSize = m_Shape->GetSize(dc, scale); shapePos = wxPoint( pos.x + labelSize.x + wxJigsawInputParameter::ParameterSpacing*scale, pos.y + (size.GetHeight()-shapeSize.GetHeight())/2); m_Shape->SetPosition(shapePos.x, shapePos.y + (size.GetHeight()-shapeSize.GetHeight())*scale/2 - offset.GetHeight()); m_Shape->Draw(dc, offset, scale); } else { dc.SetPen(*wxBLACK_PEN); wxBrush paramBrush(wxColour(color.Red()*.9,color.Green()*.9,color.Blue()*.9)); dc.SetBrush(paramBrush); //dc.SetBrush(*wxWHITE_BRUSH); shapeSize = wxJigsawInputParameter::GetDefaultParameterSize(); shapeSize.x *= scale; shapeSize.y *= scale; shapePos = wxPoint( realPosition.x + labelSize.x + wxJigsawInputParameter::ParameterSpacing*scale, realPosition.y + (size.GetHeight()-shapeSize.GetHeight())/2); wxJigsawShape::DrawShapeHeader(dc, shapePos, shapeSize, GetStyle()); } //dc.SetBrush(*wxTRANSPARENT_BRUSH); //dc.SetPen(*wxBLACK_PEN); //dc.DrawRectangle(realPosition, size); }
void TestScrollWinCanvas::PaintShapes(wxDC& dc) { TemplateCanvas::PaintShapes(dc); dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxRED_BRUSH); dc.SetTextForeground(*wxBLACK); dc.SetTextBackground(wxTransparentColor); // new const in wxWidgets 2.9.1 dc.SetFont(*wxSMALL_FONT); int y=10; int dy=20; int i=0; dc.DrawLine(30,30, 250,15); dc.DrawText("*wxSMALL_FONT", 10, y+(dy*i++)); dc.SetFont(*wxNORMAL_FONT); dc.DrawText("*wxNORMAL_FONT", 10, y+(dy*i++)); dc.SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_VAR_FONT)); dc.DrawText("GetFont(wxSYS_ANSI_VAR_FONT)", 10, y+(dy*i++)); dc.SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT)); dc.DrawText("GetFont(wxSYS_SYSTEM_FONT)", 10, y+(dy*i++)); wxFont f1(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); dc.SetFont(f1); dc.DrawText("8, wxFONTFAMILY_SWISS", 10, y+(dy*i++)); wxFont f1_1(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); dc.SetFont(f1_1); dc.DrawText("9, wxFONTFAMILY_SWISS", 10, y+(dy*i++)); wxFont f2(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); dc.SetFont(f2); dc.DrawText("10, wxFONTFAMILY_SWISS", 10, y+(dy*i++)); wxFont f3(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); dc.SetFont(f3); dc.DrawText("11, wxFONTFAMILY_SWISS", 10, y+(dy*i++)); wxFont f4(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); dc.SetFont(f4); dc.DrawText("12, wxFONTFAMILY_SWISS", 10, y+(dy*i++)); wxFont f5(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); dc.SetFont(f5); dc.DrawText("14, wxFONTFAMILY_SWISS", 10, y+(dy*i++)); f5.SetPointSize(16); dc.SetFont(f5); dc.DrawText("16, wxFONTFAMILY_SWISS", 10, y+(dy*i++)); f5.SetPixelSize(wxSize(0,15)); dc.SetFont(f5); dc.DrawText("SetPixelSize(0,15), wxFONTFAMILY_SWISS", 10, y+(dy*i++)); f5.SetPixelSize(wxSize(0,10)); dc.SetFont(f5); dc.DrawText("SetPixelSize(0,10), wxFONTFAMILY_SWISS", 10, y+(dy*i++)); f5.SetPixelSize(wxSize(0,20)); dc.SetFont(f5); dc.DrawText("SetPixelSize(0,20), wxFONTFAMILY_SWISS", 10, y+(dy*i++)); dc.SetFont(*GdaConst::small_font); dc.DrawText("*GdaConst::small_font", 10, y+(dy*i++)); dc.SetFont(*GdaConst::medium_font); dc.DrawText("*GdaConst::medium_font", 10, y+(dy*i++)); dc.SetTextForeground(GdaConst::selectable_fill_color); dc.SetFont(*GdaConst::large_font); dc.DrawText("*GdaConst::large_font", 10, y+(dy*i++)); }
void SearchListBox::DrawItemText(wxDC& dc, const wxRect& rect, const wxString& name, const vector<unsigned int>& hl, bool isCurrent) const { const unsigned int ypos = rect.y + m_topMargen; // Draw action name if (hl.empty()) { dc.SetFont(m_font); if (!isCurrent) dc.SetTextForeground(m_textColor); dc.DrawText(name, rect.x + m_leftMargen, ypos); } else { unsigned int lastxpos = rect.x + m_leftMargen; unsigned int lastchar = 0; const unsigned int len = name.length(); int w, h; // Draw the command name, highlighting chars from search for (vector<unsigned int>::const_iterator p = hl.begin(); p != hl.end(); ++p) { const unsigned int e = (*p > len-1) ? len-1 : *p; if (lastchar < e) { wxString str = name.substr(lastchar, e - lastchar); dc.SetFont(m_font); dc.GetTextExtent(str, &w, &h); if (!isCurrent) dc.SetTextForeground(m_textColor); dc.DrawText(str, lastxpos, ypos); // Move xpos lastxpos += w; } // highlight char if (e == *p) { const wxString charStr(name[e]); dc.SetFont(m_boldFont); if (!isCurrent) dc.SetTextForeground(*wxBLACK); dc.DrawText(charStr, lastxpos, ypos); // Move xpos dc.GetTextExtent(charStr, &w, &h); lastxpos += w; } lastchar = e + 1; if (lastchar == len) break; } if (lastchar < name.size()) { dc.SetFont(m_font); if (!isCurrent) dc.SetTextForeground(m_textColor); dc.DrawText(name.substr(lastchar), lastxpos, ypos); } } }
void wxStdRenderer::DrawTextLine(wxDC& dc, const wxString& text, const wxRect& rect, int selStart, int selEnd, int flags) { if ( (selStart == -1) || !(flags & wxCONTROL_FOCUSED) ) { // just draw it as is dc.DrawText(text, rect.x, rect.y); } else // we have selection { wxCoord width, x = rect.x; // draw the part before selection wxString s(text, (size_t)selStart); if ( !s.empty() ) { dc.DrawText(s, x, rect.y); dc.GetTextExtent(s, &width, NULL); x += width; } // draw the selection itself s = wxString(text.c_str() + selStart, text.c_str() + selEnd); if ( !s.empty() ) { wxColour colFg = dc.GetTextForeground(), colBg = dc.GetTextBackground(); dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT_TEXT)); dc.SetTextBackground(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT)); dc.SetBackgroundMode(wxSOLID); dc.DrawText(s, x, rect.y); dc.GetTextExtent(s, &width, NULL); x += width; dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextBackground(colBg); dc.SetTextForeground(colFg); } // draw the final part s = text.c_str() + selEnd; if ( !s.empty() ) { dc.DrawText(s, x, rect.y); } } }
/** * Render the event in the bitmap */ void WhileEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) { #if !defined(GD_NO_WX_GUI) gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get(); int border = renderingHelper->instructionsListBorder; const int repeatHeight = 20; //Draw header rectangle int whileConditionsHeight = renderingHelper->GetRenderedConditionsListHeight(whileConditions, width-80-border*2, platform)+border*2; if (!infiniteLoopWarning && whileConditionsHeight < 32 ) whileConditionsHeight = 32; wxRect headerRect(x, y, width, whileConditionsHeight+repeatHeight); renderingHelper->DrawNiceRectangle(dc, headerRect); //While text dc.SetFont( renderingHelper->GetNiceFont().Bold() ); if ( !IsDisabled() ) dc.SetTextForeground( wxColour( 0, 0, 0 ) ); else dc.SetTextForeground( wxColour( 160, 160, 160 ) ); dc.DrawText( _("While :"), x+5, y+5 ); //Draw icon if infinite loop warning is deactivated. if (!infiniteLoopWarning) { if ( gd::CommonBitmapProvider::Get()->noProtection.IsOk() ) dc.DrawBitmap(gd::CommonBitmapProvider::Get()->noProtection, wxPoint(x+5,y+5+18), /*useMask=*/true); } //Draw "while conditions" renderingHelper->DrawConditionsList(whileConditions, dc, x+80+border, y+border, width-80-border*2, this, areas, selection, platform); dc.SetFont( renderingHelper->GetNiceFont().Bold() ); if ( !IsDisabled() ) dc.SetTextForeground( wxColour( 0, 0, 0 ) ); else dc.SetTextForeground( wxColour( 160, 160, 160 ) ); dc.DrawText( _("Repeat :"), x+4, y+whileConditionsHeight+3); whileConditionsHeight += repeatHeight; //Draw conditions rectangle wxRect rect(x, y+whileConditionsHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-whileConditionsHeight); renderingHelper->DrawNiceRectangle(dc, rect); renderingHelper->DrawConditionsList(conditions, dc, x+border, y+whileConditionsHeight+border, renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform); renderingHelper->DrawActionsList(actions, dc, x+renderingHelper->GetConditionsColumnWidth()+border, y+whileConditionsHeight+border, width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform); #endif }
void wxVListBoxComboPopup::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const { // TODO: Maybe this code could be moved to wxVListBox::OnPaint? dc.SetFont(m_useFont); // Set correct text colour for selected items if ( wxVListBox::GetSelection() == (int) n ) dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) ); else dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) ); OnDrawItem(dc,rect,(int)n,0); }
void ClipboardHistoryPane::ActionList::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const { const bool isCurrent = IsCurrent(n); if (isCurrent) dc.SetTextForeground(m_hlTextColor); else dc.SetTextForeground(m_textColor); const aItem& ai = m_items[n]; const vector<unsigned int>& hl = ai.hlChars; const wxString& name = *ai.text; // Draw action name DrawItemText(dc, rect, name, hl, isCurrent); }
void BrushListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const { ASSERT(n < tileset->size()); Sprite* spr = gui.gfx.getSprite(tileset->brushlist[n]->getLookID()); if(spr) { spr->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()); } if(int(n) == GetSelection()) { dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF)); } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0x00)); } dc.DrawText(wxstr(tileset->brushlist[n]->getName()), rect.GetX() + 40, rect.GetY() + 6); }
void DatDebugViewListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const { SpriteMap::const_iterator spr_iter = sprites.find(int(n)); if(spr_iter != sprites.end()) spr_iter->second->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()); if(int(n) == GetSelection()) { dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF)); } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0x00)); } dc.DrawText(wxString() << n, rect.GetX() + 40, rect.GetY() + 6); }
void SliderBar::draw_area(wxDC & dc) { wxCoord w,h; int pixw; dc.SetBackground(_bgbrush); dc.Clear(); dc.SetBrush(_borderbrush); dc.SetPen(_borderpen); dc.DrawRectangle (0, 0, _width, _height); dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(_barbrush); if (_bar_style == FromLeftStyle) { pixw = (int) ((_value - _lower_bound) / _val_scale); dc.DrawRectangle (1, 1, pixw-1, _height-2); } else if (_bar_style == FromRightStyle) { pixw = (int) ((_upper_bound - _value) / _val_scale); dc.DrawRectangle (pixw, 1, _width - pixw - 1, _height-2); } if (_bar_style != HiddenStyle) { dc.SetBrush(_linebrush); pixw = (int) ((_value - _lower_bound) / _val_scale); dc.DrawRectangle (pixw - 1, 1, 2, _height-2); } dc.SetTextForeground(_textcolor); dc.GetTextExtent(_label_str, &w, &h); dc.DrawText (_label_str, 3, _height - h - 3); if (_showval_flag) { dc.SetTextForeground(_valuecolor); dc.GetTextExtent(_value_str, &w, &h); dc.DrawText (_value_str, _width - w - 3, _height - h - 3); } }
// draws a line of symbols void wxSymbolListCtrl::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const { wxColour oldTextColour = dc.GetTextForeground(); int startSymbol = n*m_symbolsPerLine; int i; for (i = 0; i < m_symbolsPerLine; i++) { bool resetColour = false; int symbol = startSymbol+i; if (symbol == m_current) { dc.SetBrush(wxBrush(m_colBgSel)); dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); resetColour = true; wxPen oldPen = dc.GetPen(); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(rect.x + i*m_cellSize.x, rect.y, m_cellSize.x, rect.y+rect.height); dc.SetPen(oldPen); } // Don't draw first line if (i != 0) dc.DrawLine(rect.x + i*m_cellSize.x, rect.y, i*m_cellSize.x, rect.y+rect.height); if (symbol >= m_minSymbolValue && symbol <= m_maxSymbolValue) { wxString text; text << (wxChar) symbol; wxCoord w, h; dc.GetTextExtent(text, & w, & h); int x = rect.x + i*m_cellSize.x + (m_cellSize.x - w)/2; int y = rect.y + (m_cellSize.y - h)/2; dc.DrawText(text, x, y); } if (resetColour) dc.SetTextForeground(oldTextColour); } // Draw horizontal separator line dc.DrawLine(rect.x, rect.y+rect.height-1, rect.x+rect.width, rect.y+rect.height-1); }
void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const { if ( flags & wxODCB_PAINTING_CONTROL ) { wxString text; if ( !ShouldUseHintText() ) { text = GetValue(); } else { text = GetHint(); wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); dc.SetTextForeground(col); } dc.DrawText( text, rect.x + GetMargins().x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } else { dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y ); } }
void wxStatusBarMac::DrawFieldText(wxDC& dc, int i) { int leftMargin = 2; wxRect rect; GetFieldRect(i, rect); if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) ) { dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ; } wxString text(GetStatusText(i)); long x, y; dc.GetTextExtent(text, &x, &y); int xpos = rect.x + leftMargin + 1 ; int ypos = 1 ; dc.SetClippingRegion(rect.x, 0, rect.width, m_height); dc.DrawText(text, xpos, ypos); dc.DestroyClippingRegion(); }
void ODIconCombo::OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const { int offset_x = bmpArray.Item(item).GetWidth(); int bmpHeight = bmpArray.Item(item).GetHeight(); dc.DrawBitmap(bmpArray.Item(item), rect.x, rect.y + (rect.height - bmpHeight)/2, true); if ( flags & wxODCB_PAINTING_CONTROL ) { wxString text = GetValue(); int margin_x = 2; #if wxCHECK_VERSION(2, 9, 0) if ( ShouldUseHintText() ) { text = GetHint(); wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); dc.SetTextForeground(col); } margin_x = GetMargins().x; #endif dc.DrawText( text, rect.x + margin_x + offset_x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } else { dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } }
void mpMarker::Plot(wxDC & dc, mpWindow & w) { wxCoord cx, cy, tw, th; wxColour cc; wxString ss; // setup dc.SetPen(m_pen); dc.SetFont(m_font); // part of setup is setting the text color cc = m_pen.GetColour(); dc.SetTextForeground(cc); // what to draw ss = GetName(); // where to draw dc.GetTextExtent(ss, &tw, &th); cx = (wxCoord) ((mX - w.GetPosX()) * w.GetScaleX()) - (tw / 2); cy = (wxCoord) ((w.GetPosY() - mY) * w.GetScaleY()) - (th / 2); // do it dc.DrawText( ss, cx, cy); }
/** * Render the event in the bitmap */ void TimedEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) { #if !defined(GD_NO_WX_GUI) gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get(); int border = renderingHelper->instructionsListBorder; const int functionTextHeight = 20; //Draw header rectangle wxRect headerRect(x, y, width, functionTextHeight); renderingHelper->DrawNiceRectangle(dc, headerRect); //Name dc.SetFont( renderingHelper->GetNiceFont().Bold() ); dc.SetTextForeground(wxColour(0,0,0)); gd::String nameTxt; if ( !name.empty() ) nameTxt = _(" (Name: ")+name + ")"; dc.DrawText( _("Delayed execution after ")+timeout.GetPlainString()+_(" seconds.")+" "+nameTxt, x + 4, y + 3 ); //Draw conditions rectangle wxRect rect(x, y+functionTextHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-functionTextHeight); renderingHelper->DrawNiceRectangle(dc, rect); //Draw actions and conditions renderingHelper->DrawConditionsList(conditions, dc, x+border, y+functionTextHeight+border, renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform); renderingHelper->DrawActionsList(actions, dc, x+renderingHelper->GetConditionsColumnWidth()+border, y+functionTextHeight+border, width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform); #endif }
/** * Render the event in the bitmap */ void FunctionEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) { #if !defined(GD_NO_WX_GUI) gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get(); int border = renderingHelper->instructionsListBorder; const int functionTextHeight = 20; //Draw header rectangle wxRect headerRect(x, y, width, functionTextHeight); renderingHelper->DrawNiceRectangle(dc, headerRect); //Name dc.SetFont( renderingHelper->GetNiceFont().Bold() ); dc.SetTextForeground(wxColour(0,0,0)); wxString caption = _("Function") + " " + name; if ( !objectsPassedAsArgument.empty() ) caption += " "+_("( Objects passed as parameters : ")+objectsPassedAsArgument+_(")"); dc.DrawText( caption, x + 4, y + 3 ); //Draw conditions rectangle wxRect rect(x, y+functionTextHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-functionTextHeight); renderingHelper->DrawNiceRectangle(dc, rect); //Draw actions and conditions renderingHelper->DrawConditionsList(conditions, dc, x+border, y+functionTextHeight+border, renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform); renderingHelper->DrawActionsList(actions, dc, x+renderingHelper->GetConditionsColumnWidth()+border, y+functionTextHeight+border, width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform); #endif }
/** * Render the event in the bitmap */ void ForEachEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) { #if !defined(GD_NO_WX_GUI) gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get(); int border = renderingHelper->instructionsListBorder; const int forEachTextHeight = 20; //Draw header rectangle wxRect headerRect(x, y, width, forEachTextHeight); renderingHelper->DrawNiceRectangle(dc, headerRect); //For Each text dc.SetFont( renderingHelper->GetNiceFont().Bold() ); dc.SetTextForeground(wxColour(0,0,0)); dc.DrawText( _("For each object") + " " + objectsToPick.GetPlainString() + _(", repeat :"), x + 4, y + 3 ); //Draw conditions rectangle wxRect rect(x, y+forEachTextHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-forEachTextHeight); renderingHelper->DrawNiceRectangle(dc, rect); //Draw actions and conditions renderingHelper->DrawConditionsList(conditions, dc, x+border, y+forEachTextHeight+border, renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform); renderingHelper->DrawActionsList(actions, dc, x+renderingHelper->GetConditionsColumnWidth()+border, y+forEachTextHeight+border, width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform); #endif }
/* * Here we do the actual rendering. I put it in a separate * method so that it can work no matter what type of DC * (e.g. wxPaintDC or wxClientDC) is used. */ void BasicDrawPane::Render(wxDC& dc) { int width, height; this->GetSize(&width, &height); if ( m_bgColor.IsOk() ) { dc.SetBrush(wxBrush(m_bgColor)); dc.DrawRectangle(0, 0, width, height); } if ( m_textForeGround.IsOk() ) { dc.SetTextForeground( m_textForeGround ); } if ( !m_text.IsEmpty() ) { dc.SetBackgroundMode(wxTRANSPARENT); dc.SetFont( m_font ); /* * ちょうど中央表示できるよう調整 */ const int cHeight = dc.GetCharHeight(); const int cWidth = dc.GetCharWidth(); const int textLen = m_text.Len(); const int textHalfSize = textLen * cWidth / 2; dc.DrawText( m_text, width / 2 - textHalfSize, height / 2 - cHeight / 2 ); } }