KiCad PCB EDA Suite
GRID_CELL_ESCAPED_TEXT_RENDERER Class Reference

A text renderer that can unescape text for display This is useful where it's desired to keep the underlying storage escaped. More...

#include <grid_text_helpers.h>

Inheritance diagram for GRID_CELL_ESCAPED_TEXT_RENDERER:

Public Member Functions

 GRID_CELL_ESCAPED_TEXT_RENDERER ()
 
void Draw (wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDC, const wxRect &aRect, int aRow, int aCol, bool isSelected) override
 
wxSize GetBestSize (wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col) override
 

Detailed Description

A text renderer that can unescape text for display This is useful where it's desired to keep the underlying storage escaped.

Definition at line 32 of file grid_text_helpers.h.

Constructor & Destructor Documentation

◆ GRID_CELL_ESCAPED_TEXT_RENDERER()

GRID_CELL_ESCAPED_TEXT_RENDERER::GRID_CELL_ESCAPED_TEXT_RENDERER ( )

Definition at line 25 of file grid_text_helpers.cpp.

25  :
26  wxGridCellStringRenderer()
27 {
28 }

Member Function Documentation

◆ Draw()

void GRID_CELL_ESCAPED_TEXT_RENDERER::Draw ( wxGrid &  aGrid,
wxGridCellAttr &  aAttr,
wxDC &  aDC,
const wxRect &  aRect,
int  aRow,
int  aCol,
bool  isSelected 
)
override

Definition at line 30 of file grid_text_helpers.cpp.

33 {
34  wxString unescaped = UnescapeString( aGrid.GetCellValue( aRow, aCol ) );
35 
36  wxRect rect = aRect;
37  rect.Inflate( -1 );
38 
39  // erase background
40  wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
41 
42  SetTextColoursAndFont( aGrid, aAttr, aDC, isSelected );
43  aGrid.DrawTextRectangle( aDC, unescaped, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
44 }
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152

References UnescapeString().

◆ GetBestSize()

wxSize GRID_CELL_ESCAPED_TEXT_RENDERER::GetBestSize ( wxGrid &  grid,
wxGridCellAttr &  attr,
wxDC &  dc,
int  row,
int  col 
)
override

Definition at line 47 of file grid_text_helpers.cpp.

49 {
50  wxString unescaped = UnescapeString( aGrid.GetCellValue( aRow, aCol ) );
51  return wxGridCellStringRenderer::DoGetBestSize( aAttr, aDC, unescaped );
52 }
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152

References UnescapeString().


The documentation for this class was generated from the following files: