m_Separator(separator),
116i_width =
m_Icon.GetWidth();
117i_height =
m_Icon.GetHeight();
120 catch(std::exception&)
122 _TRACE(
"CMapItem::Layout - unable to determine icon size (platform has no support)");
143 inticon_off_y = center ? ((h1 - i_height) / 2) : 0;
150 intlabel_off_y = center ? ((h1 -
m_LabelPrefH) / 2) : 0;
151wxRect rc_text(x, y + label_off_y, 0, rc_back.height);
152rc_text.SetRight(rc_back.GetRight());
200pref_h =
max(icon_h, text_h);
221dc.SetFont(props.
m_Font);
223vector<int> line_lens;
226label_h = (
int)(line_lens.size() *
abs(props.
m_Font.GetPixelSize().y));
242 inttext_bottom = rc.GetBottom() - props.
m_VertMargin;;
244 intd_h =
abs(dc.GetFont().GetPixelSize().y);
248vector<int> line_lens;
251 intmax_lines =
max(0, rc.GetHeight() / d_h);
252max_lines =
min(max_lines, (
int) line_lens.size());
255 booltext_truncated = (max_lines < (
int) line_lens.size());
257 for(
int i= 0;
i< max_lines && y + d_h < text_bottom;
i++ ) {
258 int len= line_lens[
i];
259 const char* line_s =
text.c_str() + pos;
261 boollast_line = (y + 2 * d_h > text_bottom);
263 if(text_truncated && last_line) {
269wxSize
size= dc.GetTextExtent(wx_text);
313wxRect rc_sep(rc_back);
329dc.SetPen(*wxTRANSPARENT_PEN);
333dc.DrawRectangle(rc_sel.x, rc_sel.y, rc_sel.width, rc_sel.height);
336dc.SetFont(props.
m_Font);
345 constwxBrush& old_brush = dc.GetBrush();
346wxBrush brush(props.
m_TextColor, wxBRUSHSTYLE_STIPPLE);
349dc.SetBrush(old_brush);
356 #if defined(NCBI_OS_DARWIN) & 0 367dc.DrawRectangle( rc.x, rc.y, rc.width, rc.height );
375wxPen pen(sep_color);
383dc.DrawLine(left, y_line, right, y_line);
385dc.DrawLine(left, y_line, right, y_line);
387dc.DrawLine(left, y_line, right, y_line);
395 intx = rc.GetLeft() + x_off;
397 inttext_bottom = rc.GetBottom() - props.
m_VertMargin;
399 intd_h =
abs(dc.GetFont().GetPixelSize().y);
401 intw = rc.GetWidth()- 2 * x_off;
404vector<int> line_lens;
407 intmax_lines =
max(0, rc.GetHeight() / d_h);
408max_lines =
min(max_lines, (
int) line_lens.size());
412 if(selected && focused)
414 else if(highlighted) {
419dc.SetTextForeground(color_text);
422 booltext_truncated = (max_lines < (
int) line_lens.size());
424 for(
int i= 0;
i< max_lines && y + d_h < text_bottom;
i++ ) {
425 int len= line_lens[
i];
426 const char* line_s =
text.c_str() + pos;
428 boollast_line = (y + 2 * d_h > text_bottom);
430 if(text_truncated && last_line) {
433dc.DrawText(wx_s, x, y);
437dc.GetTextExtent(wx_s, &w, &h);
438dc.DrawLine(x, y + h - 1, x + w - 1, y + h - 1);
446dc.SetPen(*wxTRANSPARENT_PEN);
virtual void SetCommand(TCmdID cmd, wxEvtHandler *target)
enables sending commands on default action; set target to NULL to disable
void SetIcon(wxBitmap &image)
virtual void Layout(wxDC &dc, SwxMapItemProperties &props)
virtual bool IsGroupSeparator() const
virtual int x_PreferredSeparatorHeight(wxDC &dc) const
virtual int PreferredHeight(wxDC &dc, SwxMapItemProperties &props, int width)
virtual void x_DrawFocusRect(wxDC &dc, const wxRect &rc, int state, SwxMapItemProperties &props)
virtual void x_DrawText(wxDC &dc, const string &text, const wxRect &rc, bool selected, bool focused, bool highlighted, SwxMapItemProperties &props)
virtual void GetRect(wxRect &rc) const
virtual void x_DrawBackground(wxDC &dc, const wxRect &rc, int state, SwxMapItemProperties &props)
virtual int x_PreferredLabelHeight(wxDC &dc, SwxMapItemProperties &props, int text_w) const
virtual void Draw(wxDC &dc, int state, SwxMapItemProperties &props)
Draws item in the given rectangle, state is a combination of EItemState flags.
virtual void OnDefaultAction()
a callback to perform a default action associated with the item
wxEvtHandler * m_CmdTarget
virtual int x_GetItemShift() const
virtual void x_UpdatePreferredHeights(wxDC &dc, SwxMapItemProperties &props, int width)
virtual void SetRect(const wxRect &rc)
virtual int x_CalculateRealTextWidth(wxDC &dc, SwxMapItemProperties &props)
virtual void x_DrawSeparator(wxDC &dc, const wxRect &rc, SwxMapItemProperties &props)
virtual int x_GetTextAreaWidth(SwxMapItemProperties &props, int width) const
GUI command routing and handling framework.
Include a standard set of the NCBI C++ Toolkit most basic headers.
@ eCmdInvalid
marks menu end in array initializers
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
unsigned int
A callback function used to compare two keys in a database.
static const int kSepHorzOffset
static const int kDefIconWidth
static const int kSeparatorH
static const int kSepVertOffset
static const int kDefIconHeight
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
SwxMapItemProperties - properties of the IwxMapItem.
bool m_CenterLabelAndIcon
wxString ToWxString(const string &s)
wxString TruncateText(wxDC &dc, const wxString &s, int w, Ewx_Truncate trunc=ewxTruncate_Ellipsis)
truncates given string so that its length is less or equal "w" "trunc" controls truncation,...
@ ewxTruncate_EllipsisAlways
truncate text if needed, add "..." if truncated
void WrapText(wxDC &dc, const string &text, int w, vector< int > &line_lens)
divides given "text" into lines, so that every line has width less or equal to "w".
wxColour GetAverage(const wxColor &c1, const wxColor &c2, double ratio)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4