本文整理汇总了C++中wxDC::SetBrush方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::SetBrush方法的具体用法?C++ wxDC::SetBrush怎么用?C++ wxDC::SetBrush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::SetBrush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void Rectangle::draw(wxDC& dc) const {
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(wxBrush(color));
dc.DrawRectangle(left, top, width, height);
}
示例2: DrawTab
void wxAuiSimpleTabArt::DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& page,
const wxRect& in_rect,
int close_button_state,
wxRect* out_tab_rect,
wxRect* out_button_rect,
int* x_extent)
{
wxCoord normal_textx, normal_texty;
wxCoord selected_textx, selected_texty;
wxCoord textx, texty;
// if the caption is empty, measure some temporary text
wxString caption = page.caption;
if (caption.empty())
caption = wxT("Xj");
dc.SetFont(m_selectedFont);
dc.GetTextExtent(caption, &selected_textx, &selected_texty);
dc.SetFont(m_normalFont);
dc.GetTextExtent(caption, &normal_textx, &normal_texty);
// figure out the size of the tab
wxSize tab_size = GetTabSize(dc,
wnd,
page.caption,
page.bitmap,
page.active,
close_button_state,
x_extent);
wxCoord tab_height = tab_size.y;
wxCoord tab_width = tab_size.x;
wxCoord tab_x = in_rect.x;
wxCoord tab_y = in_rect.y + in_rect.height - tab_height;
caption = page.caption;
// select pen, brush and font for the tab to be drawn
if (page.active)
{
dc.SetPen(m_selectedBkPen);
dc.SetBrush(m_selectedBkBrush);
dc.SetFont(m_selectedFont);
textx = selected_textx;
texty = selected_texty;
}
else
{
dc.SetPen(m_normalBkPen);
dc.SetBrush(m_normalBkBrush);
dc.SetFont(m_normalFont);
textx = normal_textx;
texty = normal_texty;
}
// -- draw line --
wxPoint points[7];
points[0].x = tab_x;
points[0].y = tab_y + tab_height - 1;
points[1].x = tab_x + tab_height - 3;
points[1].y = tab_y + 2;
points[2].x = tab_x + tab_height + 3;
points[2].y = tab_y;
points[3].x = tab_x + tab_width - 2;
points[3].y = tab_y;
points[4].x = tab_x + tab_width;
points[4].y = tab_y + 2;
points[5].x = tab_x + tab_width;
points[5].y = tab_y + tab_height - 1;
points[6] = points[0];
dc.SetClippingRegion(in_rect);
dc.DrawPolygon(WXSIZEOF(points) - 1, points);
dc.SetPen(*wxGREY_PEN);
//dc.DrawLines(active ? WXSIZEOF(points) - 1 : WXSIZEOF(points), points);
dc.DrawLines(WXSIZEOF(points), points);
int text_offset;
int close_button_width = 0;
if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
{
close_button_width = m_activeCloseBmp.GetWidth();
text_offset = tab_x + (tab_height/2) + ((tab_width-close_button_width)/2) - (textx/2);
}
else
{
text_offset = tab_x + (tab_height/3) + (tab_width/2) - (textx/2);
}
//.........这里部分代码省略.........
示例3: 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, wxBRUSHSTYLE_SOLID));
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, wxBRUSHSTYLE_SOLID));
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;
}
示例4: Paint
void wxCustomButton::Paint( wxDC &dc )
{
dc.BeginDrawing();
int w, h;
GetSize(&w,&h);
wxColour foreColour = GetForegroundColour();
wxColour backColour = GetBackgroundColour();
if (m_focused)
{
backColour.Set( wxMin(backColour.Red() + 20, 255),
wxMin(backColour.Green() + 20, 255),
wxMin(backColour.Blue() + 20, 255) );
}
wxBitmap bitmap;
if (IsEnabled())
{
if (GetValue() && m_bmpSelected.Ok())
bitmap = m_bmpSelected;
else if (m_focused && m_bmpFocus.Ok())
bitmap = m_bmpFocus;
else if (m_bmpLabel.Ok())
bitmap = m_bmpLabel;
}
else
{
// try to create disabled if it doesn't exist
if (!m_bmpDisabled.Ok() && m_bmpLabel.Ok())
m_bmpDisabled = CreateBitmapDisabled(m_bmpLabel);
if (m_bmpDisabled.Ok())
bitmap = m_bmpDisabled;
else if (m_bmpLabel.Ok())
bitmap = m_bmpLabel;
foreColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
}
wxBrush brush(backColour, wxSOLID);
dc.SetBackground(brush);
dc.SetBrush(brush);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(0, 0, w, h);
if (bitmap.Ok())
dc.DrawBitmap(bitmap, m_bitmapPos.x, m_bitmapPos.y, true );
if (!GetLabel().IsEmpty())
{
dc.SetFont(GetFont());
dc.SetTextBackground(backColour);
dc.SetTextForeground(foreColour);
dc.DrawText(GetLabel(), m_labelPos.x, m_labelPos.y);
}
if (GetValue()) // draw sunken border
{
dc.SetPen(*wxGREY_PEN);
dc.DrawLine(0,h-1,0,0); dc.DrawLine(0,0,w,0);
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine(w-1,1,w-1,h-1); dc.DrawLine(w-1,h-1,0,h-1);
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(1,h-2,1,1); dc.DrawLine(1,1,w-1,1);
}
else if (((m_button_style & wxCUSTBUT_FLAT) == 0) || m_focused) // draw raised border
{
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine(0,h-2,0,0); dc.DrawLine(0,0,w-1,0);
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(w-1,0,w-1,h-1); dc.DrawLine(w-1,h-1,-1,h-1);
dc.SetPen(*wxGREY_PEN);
dc.DrawLine(2,h-2,w-2,h-2); dc.DrawLine(w-2,h-2,w-2,1);
}
dc.SetBackground(wxNullBrush);
dc.SetBrush(wxNullBrush);
dc.SetPen(wxNullPen);
dc.EndDrawing();
}
示例5: show_direct
void SeqAA::show_direct ( wxDC& dc )
{
myass ( itemsperline , "AA:show_direct_ipl" ) ;
if ( !itemsperline ) return ;
mylog ( "SeqAA::show_direct" , "0" ) ;
can->SetFont(*can->font);
dc.SetFont(*can->font);
int a , b , w , h , n , bo = can->border ;
int csgc = can->NumberOfLines() , cbs = can->blocksize ;
int cih = can->isHorizontal() ;
int xa , xb , ya , yb ;
for ( n = 0 ; n < csgc && can->seq[n] != this ; n++ ) ;
if ( n == csgc ) return ;
mylog ( "SeqAA::show_direct" , "1" ) ;
// Setting basic values
int cw = can->charwidth , ch = can->charheight ;
int ox = bo + cw + cw * endnumberlength ;
int oy = n*ch+bo ;
can->MyGetClientSize ( &w , &h ) ;
xb = w ;
yb = h ;
wxColour tbg = dc.GetTextBackground () ;
wxColour tfg = dc.GetTextForeground () ;
int bm = dc.GetBackgroundMode () ;
wxColour tf ;
if ( primaryMode ) tf = *wxBLACK ;
else tf = myapp()->frame->aa_color ;; // wxColour ( 130 , 130 , 130 ) ;//*wxLIGHT_GREY ;
dc.SetTextForeground ( tf ) ;
dc.SetBackgroundMode ( wxTRANSPARENT ) ;
dc.GetDeviceOrigin ( &xa , &ya ) ;
xa = -xa ;
xb += xa ;
ya = -ya ;
yb += ya ;
mylog ( "SeqAA::show_direct" , "2" ) ;
b = ( ya - ch - oy ) / ( ch * csgc ) * itemsperline ;
mylog ( "SeqAA::show_direct" , "3" ) ;
for ( a = 0 ; a < b && a < s.length() ; a += itemsperline ) ;
for ( ; a < s.length() ; a++ )
{
int px = a % itemsperline , py = a / itemsperline ;
bool showNumber = ( px == 0 ) ;
px = px * cw + ( px / cbs ) * ( cw - 1 ) + ox ;
py = py * ch * csgc + oy ;
if ( !can->getDrawAll() )
{
if ( py + ch < ya ) continue ;
if ( py > yb ) break ;
if ( cih )
{
if ( px + cw < xa ) continue ;
if ( px > xb ) continue ;
}
}
int pm = getMark ( a ) ;
if ( pm == 1 ) // Marked (light gray background)
{
dc.SetBackgroundMode ( wxSOLID ) ;
dc.SetTextBackground ( *wxLIGHT_GREY ) ;
dc.SetTextForeground ( getHighlightColor ( a , tf ) ) ;
}
else if ( pm == 2 && can->doOverwrite() ) // Overwrite cursor
{
dc.SetBackgroundMode ( wxSOLID ) ;
dc.SetTextBackground ( *wxBLACK ) ;
}
if ( pm == 2 && can->doOverwrite() ) dc.SetTextForeground ( *wxWHITE ) ;
else dc.SetTextForeground ( getHighlightColor ( a , tf ) ) ;
if ( can->isPrinting() && pm == 1 )
{
dc.SetBrush ( *MYBRUSH ( wxColour ( 230 , 230 , 230 ) ) ) ;
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle ( px , py , cw , ch ) ;
}
if ( can->isPrinting() && !can->getPrintToColor() )
{
dc.SetBackgroundMode ( wxTRANSPARENT ) ;
dc.SetTextForeground ( *wxBLACK ) ;
}
// Show the char
wxChar ch2 = s.GetChar(a) ;
if ( ch2 == '|' ) ch2 = myapp()->frame->stopcodon ;
dc.DrawText ( wxString ( ch2 ) , px , py ) ;
int pz = py + ch ;
if ( pm == 2 && !can->doOverwrite() ) // Insert cursor
{
dc.SetPen(*wxBLACK_PEN);
//.........这里部分代码省略.........
示例6: render
void CtrlRegisterList::render(wxDC& dc)
{
wxFont font = wxFont(wxSize(charWidth,rowHeight-2),wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,L"Lucida Console");
dc.SetFont(font);
// clear background
wxColor white = wxColor(0xFFFFFFFF);
dc.SetBrush(wxBrush(white));
dc.SetPen(wxPen(white));
wxSize size = GetSize();
dc.DrawRectangle(0,0,size.x,size.y);
refreshChangedRegs();
wxColor colorChanged = wxColor(0xFF0000FF);
wxColor colorUnchanged = wxColor(0xFF004000);
wxColor colorNormal = wxColor(0xFF600000);
// draw categories
int piece = size.x/cpu->getRegisterCategoryCount();
for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)
{
const char* name = cpu->getRegisterCategoryName(i);
int x = i*piece;
if (i == category)
{
dc.SetBrush(wxBrush(wxColor(0xFF70FF70)));
dc.SetPen(wxPen(wxColor(0xFF000000)));
} else {
dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));
dc.SetPen(wxPen(wxColor(0xFF000000)));
}
dc.DrawRectangle(x-1,-1,piece+1,rowHeight+1);
// center text
x += (piece-strlen(name)*charWidth)/2;
dc.DrawText(wxString(name,wxConvUTF8),x,1);
}
int nameStart = 17;
int valueStart = startPositions[category];
ChangedReg* changedRegs = changedCategories[category];
int registerBits = cpu->getRegisterSize(category);
DebugInterface::RegisterType type = cpu->getRegisterType(category);
for (int i = 0; i < cpu->getRegisterCount(category); i++)
{
int x = valueStart;
int y = rowHeight*(i+1);
if (currentRows[category] == i)
{
dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));
dc.SetPen(wxPen(wxColor(0xFFFFEFE8)));
dc.DrawRectangle(0,y,size.x,rowHeight);
}
const char* name = cpu->getRegisterName(category,i);
dc.SetTextForeground(colorNormal);
dc.DrawText(wxString(name,wxConvUTF8),nameStart,y+2);
u128 value = cpu->getRegister(category,i);
ChangedReg& changed = changedRegs[i];
switch (type)
{
case DebugInterface::NORMAL: // display them in 32 bit parts
switch (registerBits)
{
case 128:
{
int startIndex = std::min<int>(3,maxBits/32-1);
int actualX = size.x-4-(startIndex+1)*(8*charWidth+2);
x = std::max<int>(actualX,x);
if (startIndex != 3)
{
bool c = false;
for (int i = 3; i > startIndex; i--)
c = c || changed.changed[i];
if (c)
{
dc.SetTextForeground(colorChanged);
dc.DrawText(L"+",x-charWidth,y+2);
}
}
for (int i = startIndex; i >= 0; i--)
{
if (changed.changed[i])
dc.SetTextForeground(colorChanged);
else
dc.SetTextForeground(colorUnchanged);
//.........这里部分代码省略.........
示例7: Draw
void wxHtmlWordCell::Draw(wxDC& dc, int x, int y,
int WXUNUSED(view_y1), int WXUNUSED(view_y2),
wxHtmlRenderingInfo& info)
{
#if 0 // useful for debugging
dc.SetPen(*wxBLACK_PEN);
dc.DrawRectangle(x+m_PosX,y+m_PosY,m_Width /* VZ: +1? */ ,m_Height);
#endif
bool drawSelectionAfterCell = false;
if ( info.GetState().GetSelectionState() == wxHTML_SEL_CHANGING )
{
// Selection changing, we must draw the word piecewise:
wxHtmlSelection *s = info.GetSelection();
wxString txt;
int w, h;
int ofs = 0;
wxPoint priv = (this == s->GetFromCell()) ?
s->GetFromPrivPos() : s->GetToPrivPos();
// NB: this is quite a hack: in order to compute selection boundaries
// (in word's characters) we must know current font, which is only
// possible inside rendering code. Therefore we update the
// information here and store it in wxHtmlSelection so that
// ConvertToText can use it later:
if ( priv == wxDefaultPosition )
{
SetSelectionPrivPos(dc, s);
priv = (this == s->GetFromCell()) ?
s->GetFromPrivPos() : s->GetToPrivPos();
}
int part1 = priv.x;
int part2 = priv.y;
if ( part1 > 0 )
{
txt = m_Word.Mid(0, part1);
dc.DrawText(txt, x + m_PosX, y + m_PosY);
dc.GetTextExtent(txt, &w, &h);
ofs += w;
}
SwitchSelState(dc, info, true);
txt = m_Word.Mid(part1, part2-part1);
dc.DrawText(txt, ofs + x + m_PosX, y + m_PosY);
if ( (size_t)part2 < m_Word.length() )
{
dc.GetTextExtent(txt, &w, &h);
ofs += w;
SwitchSelState(dc, info, false);
txt = m_Word.Mid(part2);
dc.DrawText(txt, ofs + x + m_PosX, y + m_PosY);
}
else
drawSelectionAfterCell = true;
}
else
{
wxHtmlSelectionState selstate = info.GetState().GetSelectionState();
// Not changing selection state, draw the word in single mode:
if ( selstate != wxHTML_SEL_OUT &&
dc.GetBackgroundMode() != wxSOLID )
{
SwitchSelState(dc, info, true);
}
else if ( selstate == wxHTML_SEL_OUT &&
dc.GetBackgroundMode() == wxSOLID )
{
SwitchSelState(dc, info, false);
}
dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
drawSelectionAfterCell = (selstate != wxHTML_SEL_OUT);
}
// NB: If the text is justified then there is usually some free space
// between adjacent cells and drawing the selection only onto cells
// would result in ugly unselected spaces. The code below detects
// this special case and renders the selection *outside* the sell,
// too.
if ( m_Parent->GetAlignHor() == wxHTML_ALIGN_JUSTIFY &&
drawSelectionAfterCell )
{
wxHtmlCell *nextCell = m_Next;
while ( nextCell && nextCell->IsFormattingCell() )
nextCell = nextCell->GetNext();
if ( nextCell )
{
int nextX = nextCell->GetPosX();
if ( m_PosX + m_Width < nextX )
{
dc.SetBrush(dc.GetBackground());
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(x + m_PosX + m_Width, y + m_PosY,
nextX - m_PosX - m_Width, m_Height);
}
//.........这里部分代码省略.........
示例8: Draw
void wxSheetCellBoolRendererRefData::Draw(wxSheet& sheet,
const wxSheetCellAttr& attr,
wxDC& dc, const wxRect& rect,
const wxSheetCoords& coords,
bool isSelected)
{
wxSheetCellRendererRefData::Draw(sheet, attr, dc, rect, coords, isSelected);
// draw a check mark in the centre (ignoring alignment - TODO)
wxSize size = GetBestSize(sheet, attr, dc, coords);
// don't draw outside the cell
wxCoord minSize = wxMin(rect.width, rect.height) - 1;
if ((size.x >= minSize) || (size.y >= minSize))
size.x = size.y = minSize - 2; // leave (at least) 1 pixel margin
// draw a border around checkmark
int align = attr.GetAlignment();
wxRect rectBorder(rect.GetPosition(), size);
if ((align & wxALIGN_RIGHT) != 0)
rectBorder.x += rect.width - size.x - 2;
else if ((align & wxALIGN_CENTRE_HORIZONTAL) != 0)
rectBorder.x += rect.width/2 - size.x/2;
else // wxALIGN_LEFT
rectBorder.x += 2;
if ((align & wxALIGN_BOTTOM) != 0)
rectBorder.y += rect.height - size.y - 2;
else if ((align & wxALIGN_CENTRE_VERTICAL) != 0)
rectBorder.y += rect.height/2 - size.y/2;
else // wxALIGN_TOP
rectBorder.y += 2;
bool value = false;
if ( sheet.GetTable() && sheet.GetTable()->CanGetValueAs(coords, wxSHEET_VALUE_BOOL) )
value = sheet.GetTable()->GetValueAsBool(coords);
else
{
wxString strValue( sheet.GetCellValue(coords) );
value = !( strValue.IsEmpty() || (strValue == wxT("0")) ||
(strValue.Lower() == wxT("f")) || (strValue.Lower() == wxT("false")));
}
if ( value )
{
wxRect rectMark = rectBorder;
#ifdef __WXMSW__
// MSW DrawCheckMark() is weird (and should probably be changed...)
rectMark.Inflate(-wxSHEET_CHECKMARK_MARGIN/2);
rectMark.x++;
rectMark.y++;
#else // !MSW
rectMark.Inflate(-wxSHEET_CHECKMARK_MARGIN);
#endif // MSW/!MSW
dc.SetTextForeground(attr.GetForegroundColour());
dc.DrawCheckMark(rectMark);
}
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(wxPen(attr.GetForegroundColour(), 1, wxSOLID));
dc.DrawRectangle(rectBorder);
}
示例9: Draw
void FillAreaDraw::Draw(wxDC &dc, wxRect rc)
{
dc.SetPen(m_borderPen);
dc.SetBrush(m_fillBrush);
dc.DrawRectangle(rc);
}
示例10: Draw
void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
wxHtmlRenderingInfo& info)
{
#if 0 // useful for debugging
dc.SetPen(*wxRED_PEN);
dc.DrawRectangle(x+m_PosX,y+m_PosY,m_Width,m_Height);
#endif
int xlocal = x + m_PosX;
int ylocal = y + m_PosY;
if (m_UseBkColour)
{
wxBrush myb = wxBrush(m_BkColour, wxBRUSHSTYLE_SOLID);
int real_y1 = mMax(ylocal, view_y1);
int real_y2 = mMin(ylocal + m_Height - 1, view_y2);
dc.SetBrush(myb);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(xlocal, real_y1, m_Width, real_y2 - real_y1 + 1);
}
if (m_Border == 1)
{
// draw thin border using lines
wxPen mypen1(m_BorderColour1, 1, wxPENSTYLE_SOLID);
wxPen mypen2(m_BorderColour2, 1, wxPENSTYLE_SOLID);
dc.SetPen(mypen1);
dc.DrawLine(xlocal, ylocal, xlocal, ylocal + m_Height - 1);
dc.DrawLine(xlocal, ylocal, xlocal + m_Width, ylocal);
dc.SetPen(mypen2);
dc.DrawLine(xlocal + m_Width - 1, ylocal, xlocal + m_Width - 1, ylocal + m_Height - 1);
dc.DrawLine(xlocal, ylocal + m_Height - 1, xlocal + m_Width, ylocal + m_Height - 1);
}
else if (m_Border> 0)
{
wxBrush mybrush1(m_BorderColour1, wxBRUSHSTYLE_SOLID);
wxBrush mybrush2(m_BorderColour2, wxBRUSHSTYLE_SOLID);
// draw upper left corner
// 0---------------5
// | /
// | 3-----------4
// | |
// | 2
// |/
// 1
wxPoint poly[6];
poly[0].x =m_PosX;
poly[0].y = m_PosY ;
poly[1].x =m_PosX;
poly[1].y = m_PosY + m_Height;
poly[2].x =m_PosX + m_Border;
poly[2].y = poly[1].y - m_Border;
poly[3].x =poly[2].x ;
poly[3].y = m_PosY + m_Border;
poly[4].x =m_PosX + m_Width - m_Border;
poly[4].y = poly[3].y;
poly[5].x =m_PosX + m_Width;
poly[5].y = m_PosY;
dc.SetBrush(mybrush1);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawPolygon(6, poly, x, y);
// draw lower right corner reusing point 1,2,4 and 5
// 5
// /|
// 4 |
// | |
// 2-----------3 |
// / |
// 1---------------0
dc.SetBrush(mybrush2);
poly[0].x = poly[5].x;
poly[0].y = poly[1].y;
poly[3].x = poly[4].x;
poly[3].y = poly[2].y;
dc.DrawPolygon(6, poly, x, y);
// smooth color transition like firefox
wxColour borderMediumColour(
(m_BorderColour1.Red() + m_BorderColour2.Red()) /2 ,
(m_BorderColour1.Green() + m_BorderColour2.Green()) /2 ,
(m_BorderColour1.Blue() + m_BorderColour2.Blue()) /2
);
wxPen mypen3(borderMediumColour, 1, wxPENSTYLE_SOLID);
dc.SetPen(mypen3);
dc.DrawLines(2, &poly[1], x, y - 1); // between 1 and 2
dc.DrawLines(2, &poly[4], x, y - 1); // between 4 and 5
}
if (m_Cells)
{
// draw container's contents:
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
{
//.........这里部分代码省略.........
示例11: Draw
void SkinColor::Draw(wxDC& dc, const wxRect& rect, int n) {
dc.SetBrush(brush);
dc.SetPen(pen);
dc.DrawRectangle(rect);
}
示例12: BrushColour
void SurfaceImpl::BrushColour(ColourAllocated back) {
hdc->SetBrush(wxBrush(wxColourFromCA(back), wxSOLID));
}
示例13: DrawSash
void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, const wxRect& rect)
{
#if defined(__WXMAC__)
HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height );
CGContextRef cgContext ;
#if wxMAC_USE_CORE_GRAPHICS
cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext() ;
#else
Rect bounds ;
GetPortBounds( (CGrafPtr) dc.m_macPort , &bounds ) ;
QDBeginCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ;
CGContextScaleCTM( cgContext , 1 , -1 ) ;
if ( window )
{
wxPoint origin = window->GetClientAreaOrigin();
int x, y;
x = origin.x;
y = origin.y;
window->MacWindowToRootWindow( &x , &y );
CGContextTranslateCTM( cgContext, x, y);
}
#endif
HIThemeSplitterDrawInfo drawInfo ;
drawInfo.version = 0 ;
drawInfo.state = kThemeStateActive ;
drawInfo.adornment = kHIThemeSplitterAdornmentNone ;
HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ;
#if wxMAC_USE_CORE_GRAPHICS
#else
QDEndCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
#endif
#elif defined(__WXGTK__)
// clear out the rectangle first
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_sash_brush);
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
GdkRectangle gdk_rect;
if (orientation == wxVERTICAL )
{
gdk_rect.x = rect.x;
gdk_rect.y = rect.y;
gdk_rect.width = m_sash_size;
gdk_rect.height = rect.height;
}
else
{
gdk_rect.x = rect.x;
gdk_rect.y = rect.y;
gdk_rect.width = rect.width;
gdk_rect.height = m_sash_size;
}
if (!window) return;
if (!window->m_wxwindow) return;
if (!GTK_PIZZA(window->m_wxwindow)->bin_window) return;
gtk_paint_handle
(
window->m_wxwindow->style,
GTK_PIZZA(window->m_wxwindow)->bin_window,
// flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
NULL /* no clipping */,
window->m_wxwindow,
"paned",
rect.x,
rect.y,
rect.width,
rect.height,
(orientation == wxVERTICAL) ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
);
#else
wxUnusedVar(window);
wxUnusedVar(orientation);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_sash_brush);
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
#endif
}
示例14: DrawPaneButton
void SAuiDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window),
int button,
int button_state,
const wxRect& _rect,
wxAuiPaneInfo& pane)
{
wxBitmap bmp;
if (!(&pane))
return;
switch (button)
{
default:
case wxAUI_BUTTON_CLOSE:
if (pane.state & wxAuiPaneInfo::optionActive)
bmp = m_activeCloseBitmap;
else
bmp = m_inactiveCloseBitmap;
break;
case wxAUI_BUTTON_PIN:
if (pane.state & wxAuiPaneInfo::optionActive)
bmp = m_activePinBitmap;
else
bmp = m_inactivePinBitmap;
break;
case wxAUI_BUTTON_MAXIMIZE_RESTORE:
if (pane.IsMaximized())
{
if (pane.state & wxAuiPaneInfo::optionActive)
bmp = m_activeRestoreBitmap;
else
bmp = m_inactiveRestoreBitmap;
}
else
{
if (pane.state & wxAuiPaneInfo::optionActive)
bmp = m_activeMaximizeBitmap;
else
bmp = m_inactiveMaximizeBitmap;
}
break;
}
wxRect rect = _rect;
int old_y = rect.y;
rect.y = rect.y + (rect.height / 2) - (bmp.GetHeight() / 2) + 1;
rect.height = old_y + rect.height - rect.y - 1;
//rect.y--;
if (button_state == wxAUI_BUTTON_STATE_PRESSED)
{
rect.x++;
rect.y++;
}
if (button_state == wxAUI_BUTTON_STATE_HOVER ||
button_state == wxAUI_BUTTON_STATE_PRESSED)
{
/*if (pane.state & wxAuiPaneInfo::optionActive)
{
dc.SetBrush(wxBrush(m_activeCaptionColour.ChangeLightness(120)));
dc.SetPen(wxPen(m_activeCaptionColour.ChangeLightness(70)));
}
else
{
dc.SetBrush(wxBrush(m_inactiveCaptionColour.ChangeLightness(120)));
dc.SetPen(wxPen(m_inactiveCaptionColour.ChangeLightness(70)));
}*/
//dc.SetBrush(wxBrush(captionAccentColour));
//dc.SetPen(wxPen(m_inactiveCaptionColour.ChangeLightness(70)));
// draw the background behind the button
//dc.DrawRectangle(rect.x, rect.y, 15, 15);
dc.SetPen(wxPen(Drawing::darkColour(Drawing::getPanelBGColour(), 2.0f)));
dc.SetBrush(wxBrush(Drawing::lightColour(Drawing::getPanelBGColour(), 1.0f)));
dc.DrawRectangle(rect.x, rect.y, rect.width + 1, rect.width + 1);
bmp = m_activeCloseBitmap;
//dc.DrawBitmap(bmp, rect.x + 1, rect.y, true);
//dc.DrawBitmap(bmp, rect.x - 1, rect.y, true);
//dc.DrawBitmap(bmp, rect.x, rect.y, true);
}
// draw the button itself
dc.DrawBitmap(bmp, rect.x, rect.y, true);
}
示例15: DrawSash
void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, const wxRect& rect)
{
#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
wxUnusedVar(window);
wxUnusedVar(orientation);
HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height );
CGContextRef cgContext ;
wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext() ;
HIThemeSplitterDrawInfo drawInfo ;
drawInfo.version = 0 ;
drawInfo.state = kThemeStateActive ;
drawInfo.adornment = kHIThemeSplitterAdornmentNone ;
HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ;
#elif defined(__WXGTK__)
// clear out the rectangle first
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_sash_brush);
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
#if 0
GdkRectangle gdk_rect;
if (orientation == wxVERTICAL )
{
gdk_rect.x = rect.x;
gdk_rect.y = rect.y;
gdk_rect.width = m_sash_size;
gdk_rect.height = rect.height;
}
else
{
gdk_rect.x = rect.x;
gdk_rect.y = rect.y;
gdk_rect.width = rect.width;
gdk_rect.height = m_sash_size;
}
#endif
if (!window) return;
if (!window->m_wxwindow) return;
if (!GTK_WIDGET_DRAWABLE(window->m_wxwindow)) return;
gtk_paint_handle
(
window->m_wxwindow->style,
window->GTKGetDrawingWindow(),
// flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
NULL /* no clipping */,
window->m_wxwindow,
"paned",
rect.x,
rect.y,
rect.width,
rect.height,
(orientation == wxVERTICAL) ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
);
#else
wxUnusedVar(window);
wxUnusedVar(orientation);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(m_sash_brush);
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
#endif
}