本文整理汇总了C++中wxBrush函数的典型用法代码示例。如果您正苦于以下问题:C++ wxBrush函数的具体用法?C++ wxBrush怎么用?C++ wxBrush使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxBrush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxGCDCImpl
wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )
: wxGCDCImpl( owner )
{
m_window = window;
m_ok = true ;
m_window->GetSize( &m_width , &m_height);
if ( !m_window->IsShownOnScreen() )
m_width = m_height = 0;
CGContextRef cg = (CGContextRef) window->MacGetCGContextRef();
m_release = false;
if ( cg == NULL )
{
SetGraphicsContext( wxGraphicsContext::Create( window ) ) ;
m_contentScaleFactor = window->GetContentScaleFactor();
SetDeviceOrigin(-window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize());
}
else
{
// determine content scale
CGRect userrect = CGRectMake(0, 0, 10, 10);
CGRect devicerect;
devicerect = CGContextConvertRectToDeviceSpace(cg, userrect);
m_contentScaleFactor = devicerect.size.height / userrect.size.height;
CGContextSaveGState( cg );
m_release = true ;
// make sure the context is having its origin at the wx-window coordinates of the
// view (read at the top of window.cpp about the differences)
if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 )
CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() );
wxGraphicsContext* context = wxGraphicsContext::CreateFromNative( cg );
context->EnableOffset(true);
SetGraphicsContext( context );
}
DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
SetBackground(wxBrush(window->GetBackgroundColour(),wxSOLID));
SetFont( window->GetFont() ) ;
}
示例2: wxLogDebug
void wxQtDCImpl::QtPreparePainter( )
{
//Do here all QPainter initialization (called after each begin())
if ( m_qtPainter == NULL )
{
wxLogDebug(wxT("wxQtDCImpl::QtPreparePainter is NULL!!!"));
}
else if ( m_qtPainter->isActive() )
{
m_qtPainter->setPen( wxPen().GetHandle() );
m_qtPainter->setBrush( wxBrush().GetHandle() );
m_qtPainter->setFont( wxFont().GetHandle() );
}
else
{
wxLogDebug(wxT("wxQtDCImpl::QtPreparePainter not active!"));
}
}
示例3: Draw
//----------------------------------------------------------------------------
// STISpectrumGridCellColoredRectRenderer implementation
//----------------------------------------------------------------------------
void STISpectrumGridCellColoredRectRenderer::Draw(wxGrid &grid, wxGridCellAttr& attr, wxDC &dc,
const wxRect& rect, int nRow, int nCol, bool bIsSelected)
{
wxGridCellStringRenderer::Draw(grid, attr, dc, rect, nRow, nCol, bIsSelected);
wxColour col;
::AuroraChooseColour(col, nRow);
wxRect r = rect;
r.SetWidth(r.width/2);
r.SetHeight(r.height/2);
r.x += (rect.width - r.width)/2;
r.y += (rect.height - r.height)/2;
dc.SetPen(*wxBLACK);
dc.SetBrush(wxBrush(col));
dc.DrawRectangle(r);
}
示例4: DrawButton
void DrawButton(unsigned int* const bitmasks, unsigned int buttons, unsigned int n, wxDC& dc, ControlGroupBox* g, unsigned int row)
{
if (buttons & bitmasks[(row * 8) + n])
{
dc.SetBrush(*wxRED_BRUSH);
}
else
{
unsigned char amt = 255 - g->control_group->controls[(row * 8) + n]->control_ref->State() * 128;
dc.SetBrush(wxBrush(wxColour(amt, amt, amt)));
}
dc.DrawRectangle(n * 12, (row == 0) ? 0 : (row * 12 - 1), 14, 12);
// text
const std::string name = g->control_group->controls[(row * 8) + n]->name;
// bit of hax so ZL, ZR show up as L, R
dc.DrawText(StrToWxStr(std::string(1, (name[1] && name[1] < 'a') ? name[1] : name[0])), n * 12 + 2, 1 + ((row == 0) ? 0 : (row * 12 - 1)));
}
示例5: render
/*
* Here we do the actual rendering. I put it in a separate
* method so that it can work no matter what type of DC
* (e.g. wxPaintDC or wxClientDC) is used.
*/
void wxStateButton::render(wxDC& dc) {
int w;
int h;
dc.GetSize(&w,&h);
if (m_bChecked) {
dc.SetBrush(*wxGREY_BRUSH);
dc.SetTextForeground(wxColor(255, 255, 255));
} else {
dc.SetBrush(wxBrush(wxColor(64, 64, 64)));
dc.SetTextForeground(*wxLIGHT_GREY);
}
dc.SetPen(*wxGREY_PEN);
wxRect r = GetClientRect();
dc.DrawRectangle(0, 0, w, h);
dc.SetFont(wxSystemSettings::GetFont(wxSystemFont::wxSYS_DEFAULT_GUI_FONT));
dc.DrawLabel(GetLabel(), r, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL);
}
示例6: dc
void ToggleBitmap::OnPaint(wxPaintEvent &) {
wxAutoBufferedPaintDC dc(this);
// Get background color
wxColour bgColor = command.IsActive(context) ? wxColour(0,255,0) : wxColour(255,0,0);
wxColor sysCol = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT);
bgColor.Set(
(sysCol.Red() + bgColor.Red()) / 2,
(sysCol.Green() + bgColor.Green()) / 2,
(sysCol.Blue() + bgColor.Blue()) / 2);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(bgColor));
dc.DrawRectangle(wxPoint(0, 0), GetClientSize());
wxSize excess = (GetClientSize() - img.GetSize()) / 2;
dc.DrawBitmap(img, excess.GetX(), excess.GetY(), true);
}
示例7:
void TLView::Draw3dRect(wxDC *dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxColour colour)
{
/* wxBrush b1=dc->GetBrush();
b1.SetColour(colour);*/
dc->SetBrush(wxBrush(colour, wxSOLID));
dc->SetPen(*wxTRANSPARENT_PEN);
dc->DrawRectangle(x,y,width,height);
/* wxPen pen1=dc->GetPen();
pen1.SetColour(GetLightColour(colour));*/
dc->SetPen(wxPen(GetLightColour(colour), 1, wxSOLID ));
dc->DrawLine(x,y,x+width-1,y);
dc->DrawLine(x,y,x,y+height-1);
/* pen1=dc->GetPen();
pen1.SetColour(GetDarkColour(colour));*/
dc->SetPen(wxPen(GetDarkColour(colour), 1, wxSOLID ));
dc->DrawLine(x,y+height-1,x+width-1,y+height-1);
dc->DrawLine(x+width-1,y,x+width-1,y+height);
}
示例8: line
void AudioWaveformRenderer::RenderBlank(wxDC &dc, const wxRect &rect, AudioRenderingStyle style)
{
const AudioColorScheme *pal = &colors[style];
wxColor line(pal->get(1.0));
wxColor bg(pal->get(0.0));
// Draw the line as background above and below, and line in the middle, to avoid
// overdraw flicker (the common theme in all of audio display direct drawing).
int halfheight = rect.height / 2;
dc.SetBrush(wxBrush(bg));
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(rect.x, rect.y, rect.width, halfheight);
dc.DrawRectangle(rect.x, rect.y + halfheight + 1, rect.width, rect.height - halfheight - 1);
dc.SetPen(wxPen(line));
dc.DrawLine(rect.x, rect.y+halfheight, rect.x+rect.width, rect.y+halfheight);
}
示例9: frameBmp
wxBitmap TexturePackPanel::GetFrameBitmap(const Frame& frame, int zoom)
{
wxSize imgSize = frame.GetSize();
imgSize *= zoom;
wxMemoryDC srcDC;
srcDC.SelectObject(m_bitmap);
wxBitmap frameBmp(imgSize, m_bitmap.GetDepth());
wxMemoryDC dstDC;
dstDC.SelectObject(frameBmp);
dstDC.SetBackground(wxBrush(m_colourPicker->GetColour()));
dstDC.Clear();
dstDC.StretchBlit(wxPoint(0, 0), imgSize, &srcDC, frame.GetOffset(), frame.GetSize(), wxCOPY, true);
return frameBmp;
}
示例10: dc
void wxGenericColourButton::UpdateColour()
{
wxMemoryDC dc(m_bitmap);
dc.SetPen( *wxTRANSPARENT_PEN );
dc.SetBrush( wxBrush(m_colour) );
dc.DrawRectangle( 0,0,m_bitmap.GetWidth(),m_bitmap.GetHeight() );
if ( HasFlag(wxCLRP_SHOW_LABEL) )
{
wxColour col( ~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue() );
dc.SetTextForeground( col );
dc.SetFont( GetFont() );
dc.DrawText( m_colour.GetAsString(wxC2S_HTML_SYNTAX), 0, 0 );
}
dc.SelectObject( wxNullBitmap );
SetBitmapLabel( m_bitmap );
}
示例11: bgCol
void PenStyleComboBox::OnDrawBackground( wxDC& dc, const wxRect& rect,
int item, int flags ) const
{
// If item is selected or even, or we are painting the
// combo control itself, use the default rendering.
if ( (flags & (wxODCB_PAINTING_CONTROL|wxODCB_PAINTING_SELECTED)) ||
(item & 1) == 0 )
{
wxOwnerDrawnComboBox::OnDrawBackground(dc,rect,item,flags);
return;
}
// Otherwise, draw every other background with different colour.
wxColour bgCol(240,240,250);
dc.SetBrush(wxBrush(bgCol));
dc.SetPen(wxPen(bgCol));
dc.DrawRectangle(rect);
}
示例12: wxColor
SAuiDockArt::SAuiDockArt()
{
captionBackColour = Drawing::darkColour(Drawing::getPanelBGColour(), 0.0f);
wxColour textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
float r = ((float)textColour.Red() * 0.2f) + ((float)captionBackColour.Red() * 0.8f);
float g = ((float)textColour.Green() * 0.2f) + ((float)captionBackColour.Green() * 0.8f);
float b = ((float)textColour.Blue() * 0.2f) + ((float)captionBackColour.Blue() * 0.8f);
captionAccentColour = wxColor(r, g, b);
m_activeCloseBitmap = bitmapFromBits(close_bits, 16, 16, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
m_inactiveCloseBitmap = bitmapFromBits(close_bits, 16, 16, wxColour(128, 128, 128));
if (Global::win_version_major >= 10)
m_sashBrush = wxBrush(col_w10_bg);
m_captionSize = 19;
m_sashSize = 4;
}
示例13: GetSize
void wxTabbedCtrl::DrawMenu(bool active, wxDC &dc) {
const int SIZE = 8;
wxSize size = GetSize();
wxBrush back_brush = wxBrush(GetBackgroundColour());
wxPen back_pen = wxPen(GetBackgroundColour());
wxPen x_pen = wxPen(active ? *wxBLACK : wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
x_pen.SetWidth(2);
int posx = size.x-(SIZE*8), posy = (size.y-SIZE)/2;
Menu_rect = wxRect(posx, posy, SIZE, SIZE);
dc.SetPen(back_pen);
dc.SetBrush(back_brush);
dc.DrawRectangle(posx-SIZE+1, 1, SIZE*3-2, size.y-2);
dc.SetPen(x_pen);
dc.DrawLine(posx, posy+4, posx+4, posy+8);
dc.DrawLine(posx+4, posy+8, posx+8, posy+4);
}
示例14: dc
void BaseEditor::OnPaintEvt(wxPaintEvent& event)
{
wxBufferedPaintDC dc(this);
// get client size
wxSize maxSize = CalculateMaxSize();
// fill background
dc.SetBackground(*wxLIGHT_GREY_BRUSH);
dc.Clear();
// draw cross
dc.SetBrush(wxBrush(*wxWHITE, wxBRUSHSTYLE_CROSSDIAG_HATCH));
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(wxPoint(0, 0), maxSize*m_nZoom);
// custom draw
Draw(dc);
}
示例15: wxDUMMY_INITIALIZE
void wxEmulatorContainer::OnEraseBackground(wxEraseEvent& event)
{
wxDC* dc wxDUMMY_INITIALIZE(NULL);
if (event.GetDC())
{
dc = event.GetDC();
}
else
{
dc = new wxClientDC(this);
}
dc->SetBackground(wxBrush(wxGetApp().m_emulatorInfo.m_emulatorBackgroundColour, wxSOLID));
dc->Clear();
if (!event.GetDC())
delete dc;
}