39 #include "wx/tokenzr.h"
41 #include <wx/settings.h>
50 const wxGridCellAttr& attr,
54 dc.SetBackgroundMode( wxBRUSHSTYLE_TRANSPARENT );
59 if (
grid.IsThisEnabled() )
64 if (
grid.HasFocus() )
65 clr =
grid.GetSelectionBackground();
67 clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW);
68 dc.SetTextBackground( clr );
69 dc.SetTextForeground(
grid.GetSelectionForeground() );
73 dc.SetTextBackground( attr.GetBackgroundColour() );
74 dc.SetTextForeground( attr.GetTextColour() );
79 dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
80 dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
83 dc.SetFont( attr.GetFont() );
91 wxCoord width = 0, height = 0;
93 wxFont linkFont = attr.GetFont();
94 linkFont.SetUnderlined(
true);
102 dc.SetFont(attr.GetFont());
104 wxCoord x = 0, y = 0;
105 dc.GetTextExtent((*it)->GetText(), &x, &y);
107 height = wxMax(height, y);
111 dc.SetFont(attr.GetFont());
113 return wxSize(width, height);
118 const wxString&
text)
120 wxCoord max_x = 0, max_y = 0;
123 unique_ptr<wxObject>
result(parser.Parse(
text));
126 ITERATE(vector<CStrWithUrlContainer::TLine>, it, container->
GetLines()) {
129 max_x = wxMax(max_x,
size.x);
130 max_y = wxMax(max_y,
size.y);
133 max_y *= container->
GetLines().size();
135 return wxSize(max_x, max_y);
139 wxGridCellAttr& attr,
147 wxGridCellAttr& attr,
149 const wxRect& rectCell,
153 wxRect rect = rectCell;
157 wxGridCellRenderer::Draw(
grid, attr, dc, rectCell,
row, col, isSelected);
165 attr.GetAlignment(&hAlign, &vAlign);
171 wxDCClipper clip(dc, rect);
173 wxFont linkFont = attr.GetFont();
174 linkFont.SetUnderlined(
true);
176 wxCoord y = rect.GetTop();
180 wxColour textColor = dc.GetTextForeground();
182 ITERATE(vector<CStrWithUrlContainer::TLine>, it, container->
GetLines()) {
183 if (y > rect.GetBottom())
188 wxCoord x = rect.GetLeft();
190 if (hAlign&wxALIGN_RIGHT) {
191 x = rect.GetRight() -
size.x;
193 else if (hAlign&wxALIGN_CENTER_HORIZONTAL) {
194 x += (rect.GetWidth() -
size.x)/2;
199 if (x > rect.GetRight())
201 if (x + widths[
i] >= rect.GetLeft()) {
205 dc.SetFont(linkFont);
206 dc.SetTextForeground(*wxBLUE);
209 dc.SetFont(attr.GetFont());
210 dc.SetTextForeground(textColor);
213 dc.DrawText( (*it2)->GetText(), x, y );
216 wxRect linkRect(x, y + 2, widths[
i],
size.y - 2);
217 linkRect.Intersect(rect);
227 dc.SetTextForeground(textColor);
228 dc.SetFont(attr.GetFont());
236 if (links->
Empty()) {
238 g->GetHyperlinks().SetLink(col,
row, 0);
240 g->GetHyperlinks().SetLink(col,
row, links);
void Add(const wxRect &rect, const wxString &url)
virtual wxSize GetBestSize(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col)
void SetTextColoursAndFont(const wxGrid &grid, const wxGridCellAttr &attr, wxDC &dc, bool isSelected)
wxString x_GetHtmlValue(wxGrid &grid, int row, int col)
wxSize DoGetBestSize(const wxGridCellAttr &attr, wxDC &dc, const wxString &text)
virtual void Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected)
const vector< TLine > & GetLines() const
vector< CStrWithUrlText * > TLine
wxString GetHtmlValue(int row, int col)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
static wxSize GetLineSize(const wxGridCellAttr &attr, wxDC &dc, const CStrWithUrlContainer::TLine &line, vector< int > &widths)
#define row(bind, expected)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)