42 #include <wx/settings.h>
43 #include <wx/dcclient.h>
65 : wxPanel(parent,
id, pos,
size, style, name),
70 m_Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
77 int text_h =
abs(
m_Font.GetPixelSize().y);
89 wxRect rc = GetClientRect();
94 int left = rc.GetLeft();
95 int top = rc.GetTop();
96 int width = rc.GetWidth();
98 int right = left + width - 1;
110 norm_start =
max(0.0, norm_start);
111 norm_end =
min(1.0, norm_end);
113 dc.SetPen(*wxTRANSPARENT_PEN);
115 double d = ((double) (norm_end - norm_start) * width) /
n;
116 int grad_x = left + (
int)(norm_start * width);
117 for(
int i = 0;
i <
n ;
i++) {
118 int x1 = (
int) floor(d *
i);
119 int x2 = (
int) ceil(d * (
i + 1));
120 float k = ((float)
i) / (
n - 1);
125 dc.DrawRectangle(grad_x + x1, top, x2 - x1,
kGradH);
129 wxColour cl_text = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
130 dc.SetTextForeground(cl_text);
136 int clip_left = left;
137 int clip_right = right;
142 clip_left = clip_right +
kSpace;
146 dc.SetPen(wxPen(cl_text));
149 double d_value = value_range / 4;
150 for(
int i = 0;
i < 5;
i++ ) {
153 int line_x = left + (
int) (norm * (width - 1));
154 dc.DrawLine(line_x, tick_y, line_x, tick_y +
kTickH);
162 int& clip_left,
int& clip_right,
int y, wxAlignment align)
165 int x = left + (
int)(norm * (right - left));
166 int text_w = 0, text_h = 0;
169 dc.GetTextExtent(
str, &text_w, &text_h);
183 if(x + text_w > right) {
190 if(x >= left && (x + text_w - 1) <= right) {
191 dc.DrawText(
str, x, y);
194 clip_right = x + text_w - 1;
196 clip_left = clip_right = left;
void SetParams(const SHitColoringParams *params)
void OnPaint(wxPaintEvent &event)
void x_DrawNumber(wxDC &dc, double value, int left, int right, int &clip_left, int &clip_right, int y, wxAlignment align)
virtual wxSize DoGetBestSize() const
const SHitColoringParams * m_Params
class CRgbaColor provides a simple abstraction for managing colors.
static CRgbaColor Interpolate(const CRgbaColor &color1, const CRgbaColor &color2, float alpha)
Interpolate two colors.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * str(char *buf, int n)
double GetColorNorm(double value, bool precise=true) const
const char * GetPrecisionFormat() const
wxColour ConvertColor(const CRgbaColor &color)
wxString ToWxString(const string &s)