本文整理汇总了C++中wxColour::Ok方法的典型用法代码示例。如果您正苦于以下问题:C++ wxColour::Ok方法的具体用法?C++ wxColour::Ok怎么用?C++ wxColour::Ok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxColour
的用法示例。
在下文中一共展示了wxColour::Ok方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetForegroundColour
bool wxCheckBox::SetForegroundColour(const wxColour& colour)
{
if ( !wxCheckBoxBase::SetForegroundColour(colour) )
return false;
// the only way to change the checkbox foreground colour under Windows XP
// is to owner draw it
if ( wxUxThemeEngine::GetIfActive() )
MakeOwnerDrawn(colour.Ok());
return true;
}
示例2: DoMSWControlColor
WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
{
HDC hdc = (HDC)pDC;
if ( m_hasFgCol )
{
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
}
WXHBRUSH hbr = 0;
if ( !colBg.Ok() )
{
hbr = MSWGetBgBrush(pDC, hWnd);
// if the control doesn't have any bg colour, foreground colour will be
// ignored as the return value would be 0 -- so forcefully give it a
// non default background brush in this case
if ( !hbr && m_hasFgCol )
colBg = GetBackgroundColour();
}
// use the background colour override if a valid colour is given
if ( colBg.Ok() )
{
::SetBkColor(hdc, wxColourToRGB(colBg));
// draw children with the same colour as the parent
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg, wxSOLID);
hbr = (WXHBRUSH)brush->GetResourceHandle();
// if we use custom background, we should set foreground ourselves too
if ( !m_hasFgCol )
{
::SetTextColor(hdc, ::GetSysColor(COLOR_WINDOWTEXT));
}
//else: already set above
}
return hbr;
}
示例3: Init
void wxsMyColourPropertyClass::Init( int type, const wxColour& colour )
{
wxColourPropertyValue cpv;
if ( colour.Ok() )
cpv.Init( type, colour );
else
cpv.Init( type, *wxWHITE );
m_flags |= wxPG_PROP_STATIC_CHOICES; // Colour selection cannot be changed.
m_value = wxColourPropertyValueToVariant(cpv);
OnSetValue();
}
示例4: SetForegroundColour
bool wxMenuBar::SetForegroundColour(const wxColour& col)
{
if (!wxWindowBase::SetForegroundColour(col))
return false;
if (!col.Ok())
return false;
if (m_mainWidget)
wxDoChangeForegroundColour(m_mainWidget, (wxColour&) col);
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
m_menus.Item(i)->GetData()->SetForegroundColour((wxColour&) col);
return true;
}
示例5: wxGetColourFromUser
wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit, const wxString& caption)
{
static wxColourData data;
data.SetChooseFull(true);
if ( colInit.Ok() )
{
data.SetColour((wxColour &)colInit); // const_cast
}
wxColour colRet;
wxColourDialog dialog(parent, &data);
if (!caption.empty())
dialog.SetTitle(caption);
if ( dialog.ShowModal() == wxID_OK )
{
colRet = dialog.GetColourData().GetColour();
}
//else: leave it invalid
return colRet;
}
示例6: DrawBackground
void wxStdRenderer::DrawBackground(wxDC& dc,
const wxColour& col,
const wxRect& rect,
int WXUNUSED(flags),
wxWindow *window)
{
wxColour colBg;
if (col.Ok())
{
colBg = col;
}
else if (window)
{
colBg = m_scheme->GetBackground(window);
}
else
{
colBg = wxSCHEME_COLOUR(m_scheme, CONTROL);
}
DrawSolidRect(dc, colBg, rect);
}
示例7: GetColourFromUser
wxColour GetColourFromUser(wxWindow *parent, const wxColour& colInit, const wxString& caption, const wxString& palette)
{
wxColourData data;
data = sett().GetCustomColors( palette );
data.SetChooseFull(true);
if ( colInit.Ok() )
{
data.SetColour((wxColour &)colInit); // const_cast
}
wxColour colRet;
wxColourDialog dialog(parent, &data);
if (!caption.empty())
dialog.SetTitle(caption);
if ( dialog.ShowModal() == wxID_OK )
{
colRet = dialog.GetColourData().GetColour();
}
//else: leave it invalid
sett().SaveCustomColors( dialog.GetColourData(), palette );
return colRet;
}
示例8: draw_data
void FPlot::draw_data (wxDC& dc,
double (*compute_y)(vector<Point>::const_iterator,
Model const*),
fityk::Data const* data,
Model const* model,
wxColour const& color, wxColour const& inactive_color,
int Y_offset,
bool cumulative)
{
if (data->is_empty())
return;
vector<Point>::const_iterator first = data->get_point_at(ftk->view.left()),
last = data->get_point_at(ftk->view.right());
if (first > data->points().begin())
--first;
if (last < data->points().end())
++last;
// prepare coordinates
int len = last - first;
if (len <= 0)
return;
wxPoint2DDouble *pp = new wxPoint2DDouble[len];
vector<bool> aa(len);
vector<double> yy(len);
Y_offset *= (get_pixel_height(dc) / 100);
for (int i = 0; i != len; ++i) {
const Point& p = *(first + i);
pp[i].m_x = xs.px_d(p.x);
yy[i] = (*compute_y)((first+i), model);
if (cumulative && i > 0)
yy[i] += yy[i-1];
pp[i].m_y = ys.px_d(yy[i]) - Y_offset;
aa[i] = p.is_active;
}
// draw inactive
wxColour icol = inactive_color.Ok() ? inactive_color : inactiveDataCol;
dc.SetPen(wxPen(icol, pen_width));
dc.SetBrush(wxBrush(icol, wxSOLID));
draw_data_by_activity(dc, pp, aa, false);
if (draw_sigma)
for (int i = 0; i != len; ++i)
if (!aa[i]) {
double sigma = (first + i)->sigma;
dc.DrawLine(iround(pp[i].m_x), ys.px(yy[i] - sigma) - Y_offset,
iround(pp[i].m_x), ys.px(yy[i] + sigma) - Y_offset);
}
// draw active
wxColour acol = color.Ok() ? color : activeDataCol;
dc.SetPen(wxPen(acol, pen_width));
dc.SetBrush(wxBrush(acol, wxSOLID));
draw_data_by_activity(dc, pp, aa, true);
if (draw_sigma)
for (int i = 0; i != len; ++i)
if (aa[i]) {
double sigma = (first + i)->sigma;
dc.DrawLine(iround(pp[i].m_x), ys.px(yy[i] - sigma) - Y_offset,
iround(pp[i].m_x), ys.px(yy[i] + sigma) - Y_offset);
}
delete [] pp;
}