• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ wxColour类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxColour的典型用法代码示例。如果您正苦于以下问题:C++ wxColour类的具体用法?C++ wxColour怎么用?C++ wxColour使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxColour类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetBackgroundColour

WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
{
    HDC hdc = (HDC)pDC;

    WXHBRUSH hbr = 0;
    if ( !colBg.IsOk() )
    {
        if ( wxWindow *win = wxFindWinFromHandle(hWnd) )
            hbr = win->MSWGetBgBrush(pDC);

        // 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: this is
    // used when the control is disabled to grey it out and also if colBg was
    // set just above
    if ( colBg.IsOk() )
    {
        wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg);
        hbr = (WXHBRUSH)brush->GetResourceHandle();
    }

    // always set the foreground colour if we changed the background, whether
    // m_hasFgCol is true or not: if it true, we must do it, of course, but
    // even if it isn't, we must set the default foreground explicitly as by
    // default just the simple black is used
    if ( hbr )
    {
        ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
    }

    // finally also set the background colour for text drawing: without this,
    // the text in an edit control is drawn using the default background even
    // if we return a valid brush
    if ( colBg.IsOk() || m_hasBgCol )
    {
        if ( !colBg.IsOk() )
            colBg = GetBackgroundColour();

        ::SetBkColor(hdc, wxColourToRGB(colBg));
    }

    return hbr;
}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:48,代码来源:control.cpp


示例2: selector

void colorPatternArea::OnMouse(wxMouseEvent &event) {
	if (mID < kNumPatterns && event.LeftDClick()) {
		patternSelectDlg selector(this);

		if (selector.ShowModal() == wxOK) {

		}
	}

	if (mID >= ID_BITMAP_SLT && mID < ID_BITMAP_SLT + kNumPatterns)  //exclude color areas in the left panel
	{

		if ( mID >= ID_BITMAP_SLT && (event.Entering() || mID == dynamic_cast<patternSelectDlg*>(mParent)->getSltId()) ) {
			//"distance" of two colors
			if ( pow((float)(mCurrentColor.Red()-defaultColor.Red()),2.0f) + pow((float)(mCurrentColor.Green()-defaultColor.Green()),2.0f) + pow((float)(mCurrentColor.Blue()-defaultColor.Blue()),2.0f) < 500)
				SetBackgroundColour(wxColour(68,68,68));
			else
				SetBackgroundColour(defaultColor);
		}

		if ( event.Leaving() && mID >= ID_BITMAP_SLT && mPatID != dynamic_cast<patternSelectDlg*>(mParent)->getSltPatId() )
			SetBackgroundColour(mCurrentColor);

		if (event.LeftDown() && mID >= ID_BITMAP_SLT) {
			dynamic_cast<patternSelectDlg*>(mParent)->setSltId(mID);
		}
	}
}
开发者ID:Reinis,项目名称:wxmacmolplt,代码行数:28,代码来源:colorArea.cpp


示例3: SetDefaultFgColour

void LexerConf::SetDefaultFgColour(const wxColour& colour)
{
    StyleProperty& style = GetProperty(0);
    if(!style.IsNull()) {
        style.SetFgColour(colour.GetAsString(wxC2S_HTML_SYNTAX));
    }
}
开发者ID:HelloWangCheng,项目名称:codelite,代码行数:7,代码来源:lexer_configuration.cpp


示例4: RGB_2_HSL

wxColor DrawingUtils::DarkColour(const wxColour& color, float percent)
{
    if(percent == 0) {
        return color;
    }

    float h, s, l, r, g, b;
    RGB_2_HSL(color.Red(), color.Green(), color.Blue(), &h, &s, &l);

    // reduce the Lum value
    l -= (float)((percent * 5.0)/100.0);
    if (l < 0) l = 0.0;

    HSL_2_RGB(h, s, l, &r, &g, &b);
    return wxColour((unsigned char)r, (unsigned char)g, (unsigned char)b);
}
开发者ID:Hmaal,项目名称:codelite,代码行数:16,代码来源:drawingutils.cpp


示例5: IsSelected

bool
wxVListBox::DoDrawSolidBackground(const wxColour& col,
                                  wxDC& dc,
                                  const wxRect& rect,
                                  size_t n) const
{
    if ( !col.IsOk() )
        return false;

    // we need to render selected and current items differently
    const bool isSelected = IsSelected(n),
               isCurrent = IsCurrent(n);
    if ( isSelected || isCurrent )
    {
        if ( isSelected )
        {
            dc.SetBrush(wxBrush(col, wxBRUSHSTYLE_SOLID));
        }
        else // !selected
        {
            dc.SetBrush(*wxTRANSPARENT_BRUSH);
        }
        dc.SetPen(*(isCurrent ? wxBLACK_PEN : wxTRANSPARENT_PEN));
        dc.DrawRectangle(rect);
    }
    //else: do nothing for the normal items

    return true;
}
开发者ID:chromylei,项目名称:third_party,代码行数:29,代码来源:vlbox.cpp


示例6: CallParseInnerWithBg

        // Call ParseInner() preserving background colour and mode after any
        // changes done by it.
        void CallParseInnerWithBg(const wxHtmlTag& tag, const wxColour& colBg)
        {
            const wxColour oldbackclr = m_WParser->GetActualBackgroundColor();
            const int oldbackmode = m_WParser->GetActualBackgroundMode();
            if ( colBg.IsOk() )
            {
                m_WParser->SetActualBackgroundColor(colBg);
                m_WParser->SetActualBackgroundMode(wxBRUSHSTYLE_SOLID);
                m_WParser->GetContainer()->InsertCell(
                        new wxHtmlColourCell(colBg, wxHTML_CLR_BACKGROUND)
                    );
            }

            ParseInner(tag);

            if ( oldbackmode != m_WParser->GetActualBackgroundMode() ||
                    oldbackclr != m_WParser->GetActualBackgroundColor() )
            {
               m_WParser->SetActualBackgroundMode(oldbackmode);
               m_WParser->SetActualBackgroundColor(oldbackclr);
               m_WParser->GetContainer()->InsertCell(
                      new wxHtmlColourCell(oldbackclr,
                                        oldbackmode == wxBRUSHSTYLE_TRANSPARENT
                                            ? wxHTML_CLR_TRANSPARENT_BACKGROUND
                                            : wxHTML_CLR_BACKGROUND)
                );
            }
        }
开发者ID:idobatter,项目名称:wxWidgets,代码行数:30,代码来源:m_tables.cpp


示例7: wxDoChangeForegroundColour

void wxMenu::SetForegroundColour(const wxColour& col)
{
    m_foregroundColour = col;
    if (!col.IsOk())
        return;
    if (m_menuWidget)
        wxDoChangeForegroundColour(m_menuWidget, (wxColour&) col);
    if (m_buttonWidget)
        wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
          node;
          node = node->GetNext() )
    {
        wxMenuItem* item = node->GetData();
        if (item->GetButtonWidget())
        {
            // This crashes because it uses gadgets
            //            wxDoChangeForegroundColour(item->GetButtonWidget(), (wxColour&) col);
        }
        if (item->GetSubMenu())
            item->GetSubMenu()->SetForegroundColour((wxColour&) col);
    }
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:33,代码来源:menu.cpp


示例8: GetColourFromUser

wxColour GetColourFromUser(wxWindow* parent, const wxColour& colInit)
{
	#ifdef __WXMSW__
	const wxString caption = _("Choose color");
	#else
	const wxString caption = _("Choose color (only first 16 will be saved)");
	#endif
	const wxString palette = _T("Default");
	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;
}
开发者ID:spike-spb,项目名称:springlobby,代码行数:27,代码来源:uiutils.cpp


示例9: SetLineNumbersFgColour

void LexerConf::SetLineNumbersFgColour(const wxColour& colour)
{
    StyleProperty& style = GetProperty(LINE_NUMBERS_ATTR_ID);
    if(!style.IsNull()) {
        style.SetFgColour(colour.GetAsString(wxC2S_HTML_SYNTAX));
    }
}
开发者ID:HelloWangCheng,项目名称:codelite,代码行数:7,代码来源:lexer_configuration.cpp


示例10: ChannelBlend

void PixelBufferClass::Get2ColorBlend(int layer, int coloridx1, int coloridx2, double ratio, wxColour &color)
{
    wxColour c1,c2;
    palette[layer].GetColor(coloridx1,c1);
    palette[layer].GetColor(coloridx2,c2);
    color.Set(ChannelBlend(c1.Red(),c2.Red(),ratio), ChannelBlend(c1.Green(),c2.Green(),ratio), ChannelBlend(c1.Blue(),c2.Blue(),ratio));
}
开发者ID:Materdaddy,项目名称:xLights,代码行数:7,代码来源:PixelBuffer.cpp


示例11: wxColourPickerWidget

bool wxColourPickerCtrl::Create( wxWindow *parent, wxWindowID id,
                        const wxColour &col,
                        const wxPoint &pos, const wxSize &size,
                        long style, const wxValidator& validator,
                        const wxString &name )
{
    if (!wxPickerBase::CreateBase(parent, id, col.GetAsString(), pos, size,
                                  style, validator, name))
        return false;

    // we are not interested to the ID of our picker as we connect
    // to its "changed" event dynamically...
    m_picker = new wxColourPickerWidget(this, wxID_ANY, col,
                                        wxDefaultPosition, wxDefaultSize,
                                        GetPickerStyle(style));

    // complete sizer creation
    wxPickerBase::PostCreation();

    m_picker->Connect(wxEVT_COMMAND_COLOURPICKER_CHANGED,
            wxColourPickerEventHandler(wxColourPickerCtrl::OnColourChange),
            NULL, this);

    return true;
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:25,代码来源:clrpickercmn.cpp


示例12: wxPenRefData

wxPen::wxPen(const wxColour& col, int width, int style)
{
    m_refData = new wxPenRefData();
    M_PENDATA.setWidth(width);
    M_PENDATA.setStyle(ConvertPenStyle((wxPenStyle)style));
    M_PENDATA.setColor(col.GetHandle());
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:7,代码来源:pen.cpp


示例13: ChannelBlend

void RgbEffects::Get2ColorBlend(int coloridx1, int coloridx2, double ratio, wxColour &color)
{
    wxColour c1,c2;
    palette.GetColor(coloridx1,c1);
    palette.GetColor(coloridx2,c2);
    color.Set(ChannelBlend(c1.Red(),c2.Red(),ratio), ChannelBlend(c1.Green(),c2.Green(),ratio), ChannelBlend(c1.Blue(),c2.Blue(),ratio));
}
开发者ID:JonB256,项目名称:xLights,代码行数:7,代码来源:RgbEffectscopy.cpp


示例14: blend50

wxColour blend50(const wxColour& c1, const wxColour& c2)
{
	unsigned char r,g,b,a;
	r = c1.Red()/2   + c2.Red()/2;
	g = c1.Green()/2 + c2.Green()/2;
	b = c1.Blue()/2  + c2.Blue()/2;
	a = c1.Alpha()/2 + c2.Alpha()/2;
	return a << 24 | b << 16 | g << 8 | r;
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:9,代码来源:GameListCtrl.cpp


示例15: wxColour

wxColour Drawing::darkColour(const wxColour& colour, float percent)
{
	if(percent == 0)
	{
		return colour;
	}

	// Convert to HSL
	hsl_t hsl = Misc::rgbToHsl(rgba_t(colour.Red(), colour.Green(), colour.Blue()));

	// Decrease luminance
	hsl.l -= (float)((percent * 5.0)/100.0);
	if (hsl.l < 0) hsl.l = 0;

	rgba_t rgb = Misc::hslToRgb(hsl);
	return wxColour(rgb.r, rgb.g, rgb.b);
}
开发者ID:Monsterovich,项目名称:SLADE,代码行数:17,代码来源:Drawing.cpp


示例16: MSWMakeOwnerDrawn

void
wxMSWOwnerDrawnButtonBase::MSWMakeOwnerDrawnIfNecessary(const wxColour& colFg)
{
    // The only way to change the checkbox foreground colour when using
    // themes is to owner draw it.
    if ( wxUxThemeEngine::GetIfActive() )
        MSWMakeOwnerDrawn(colFg.IsOk());
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:8,代码来源:control.cpp


示例17: SetBookmarkBgColour

void OptionsConfig::SetBookmarkBgColour(wxColour c, size_t index)
{
    wxArrayString arr = wxSplit(m_bookmarkBgColours, ';');
    if(index < arr.GetCount()) {
        arr.Item(index) = c.GetAsString(wxC2S_HTML_SYNTAX);
        m_bookmarkBgColours = wxJoin(arr, ';');
    }
}
开发者ID:05storm26,项目名称:codelite,代码行数:8,代码来源:optionsconfig.cpp


示例18: wxDoChangeForegroundColour

// Change a widget's foreground and background colours.
void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
{
    if (!foregroundColour.IsOk())
        return;

    // When should we specify the foreground, if it's calculated
    // by wxComputeColours?
    // Solution: say we start with the default (computed) foreground colour.
    // If we call SetForegroundColour explicitly for a control or window,
    // then the foreground is changed.
    // Therefore SetBackgroundColour computes the foreground colour, and
    // SetForegroundColour changes the foreground colour. The ordering is
    // important.

    XtVaSetValues ((Widget) widget,
        XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
        NULL);
}
开发者ID:Richard-Ni,项目名称:wxWidgets,代码行数:19,代码来源:utils.cpp


示例19:

void
wxMoColour::UpdateColour( wxColour p_Colour ) {

  ///internal RGB values
  m_RGBValue.red = p_Colour.Red();
  m_RGBValue.green = p_Colour.Green();
  m_RGBValue.blue = p_Colour.Blue();

  m_RGBDouble.red = m_RGBValue.red / 255.0;
  m_RGBDouble.green = m_RGBValue.green / 255.0;
  m_RGBDouble.blue = m_RGBValue.blue / 255.0;

  ///internal HSV values
  m_HSVValue = wxImage::RGBtoHSV( m_RGBValue );

  ///assign now
  m_ColourValue = p_Colour;
}
开发者ID:inaes-tic,项目名称:tv-moldeo,代码行数:18,代码来源:wxMoColour.cpp


示例20: PaintRectangle

void uwHexCtrl::PaintRectangle( wxDC& dc, wxColour& colour, const wxRect& rect )
{
    if( !colour.Ok() )
        colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);

    dc.SetBrush(wxBrush(colour));
    dc.SetPen(wxPen(colour, 1));
    dc.DrawRectangle( rect );
}
开发者ID:roman-dzieciol,项目名称:wxUnrilities_XML,代码行数:9,代码来源:uwHexCtrl.cpp



注:本文中的wxColour类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxColourPickerEvent类代码示例发布时间:2022-05-31
下一篇:
C++ wxColor类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap