use stock colour/pen/brush objects in samples
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1250,8 +1250,8 @@ void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_colOld = wxColour(wxT("red"));
|
s_colOld = *wxRED;
|
||||||
SetBackgroundColour(wxT("white"));
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
m_lbSelectThis->SetForegroundColour(wxT("white"));
|
m_lbSelectThis->SetForegroundColour(wxT("white"));
|
||||||
m_lbSelectThis->SetBackgroundColour(wxT("red"));
|
m_lbSelectThis->SetBackgroundColour(wxT("red"));
|
||||||
|
@@ -1302,19 +1302,19 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
|||||||
r3.y += 60;
|
r3.y += 60;
|
||||||
wxRect r4 = r2;
|
wxRect r4 = r2;
|
||||||
r4.y += 60;
|
r4.y += 60;
|
||||||
dc.SetPen(wxPen(wxColour(255, 0, 0)));
|
dc.SetPen(*wxRED_PEN);
|
||||||
dc.DrawRectangle(r);
|
dc.DrawRectangle(r);
|
||||||
r.Deflate(1);
|
r.Deflate(1);
|
||||||
dc.GradientFillLinear(r, wxColour(0,255,0), wxColour(0,0,0), wxNORTH);
|
dc.GradientFillLinear(r, *wxGREEN, *wxBLACK, wxNORTH);
|
||||||
dc.DrawRectangle(r2);
|
dc.DrawRectangle(r2);
|
||||||
r2.Deflate(1);
|
r2.Deflate(1);
|
||||||
dc.GradientFillLinear(r2, wxColour(0,0,0), wxColour(0,255,0), wxSOUTH);
|
dc.GradientFillLinear(r2, *wxBLACK, *wxGREEN, wxSOUTH);
|
||||||
dc.DrawRectangle(r3);
|
dc.DrawRectangle(r3);
|
||||||
r3.Deflate(1);
|
r3.Deflate(1);
|
||||||
dc.GradientFillLinear(r3, wxColour(0,255,0), wxColour(0,0,0), wxEAST);
|
dc.GradientFillLinear(r3, *wxGREEN, *wxBLACK, wxEAST);
|
||||||
dc.DrawRectangle(r4);
|
dc.DrawRectangle(r4);
|
||||||
r4.Deflate(1);
|
r4.Deflate(1);
|
||||||
dc.GradientFillLinear(r4, wxColour(0,0,0), wxColour(0,255,0), wxWEST);
|
dc.GradientFillLinear(r4, *wxBLACK, *wxGREEN, wxWEST);
|
||||||
|
|
||||||
#if wxUSE_GRAPHICS_CONTEXT
|
#if wxUSE_GRAPHICS_CONTEXT
|
||||||
if (m_useContext)
|
if (m_useContext)
|
||||||
@@ -1328,9 +1328,9 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
|||||||
dc.DrawText(wxT("Linear Gradient with Stops"), gfr.x, gfr.y);
|
dc.DrawText(wxT("Linear Gradient with Stops"), gfr.x, gfr.y);
|
||||||
gfr.Offset(0, TEXT_HEIGHT);
|
gfr.Offset(0, TEXT_HEIGHT);
|
||||||
|
|
||||||
stops = wxGraphicsGradientStops(wxColour(255,0,0), wxColour(0,0,255));
|
stops = wxGraphicsGradientStops(*wxRED, *wxBLUE);
|
||||||
stops.Add(wxColour(255,255,0), 0.33f);
|
stops.Add(wxColour(255,255,0), 0.33f);
|
||||||
stops.Add(wxColour(0,255,0), 0.67f);
|
stops.Add(*wxGREEN, 0.67f);
|
||||||
|
|
||||||
gc->SetBrush(gc->CreateLinearGradientBrush(gfr.x, gfr.y,
|
gc->SetBrush(gc->CreateLinearGradientBrush(gfr.x, gfr.y,
|
||||||
gfr.x + gfr.width, gfr.y + gfr.height,
|
gfr.x + gfr.width, gfr.y + gfr.height,
|
||||||
@@ -1365,11 +1365,11 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
|||||||
dc.DrawText(wxT("Linear Gradient with Stops and Gaps"), gfr.x, gfr.y);
|
dc.DrawText(wxT("Linear Gradient with Stops and Gaps"), gfr.x, gfr.y);
|
||||||
gfr.Offset(0, TEXT_HEIGHT);
|
gfr.Offset(0, TEXT_HEIGHT);
|
||||||
|
|
||||||
stops = wxGraphicsGradientStops(wxColour(255,0,0), wxColour(0,0,255));
|
stops = wxGraphicsGradientStops(*wxRED, *wxBLUE);
|
||||||
stops.Add(wxColour(255,255,0), 0.33f);
|
stops.Add(wxColour(255,255,0), 0.33f);
|
||||||
stops.Add(wxTransparentColour, 0.33f);
|
stops.Add(wxTransparentColour, 0.33f);
|
||||||
stops.Add(wxTransparentColour, 0.67f);
|
stops.Add(wxTransparentColour, 0.67f);
|
||||||
stops.Add(wxColour(0,255,0), 0.67f);
|
stops.Add(*wxGREEN, 0.67f);
|
||||||
|
|
||||||
gc->SetBrush(gc->CreateLinearGradientBrush(gfr.x, gfr.y + gfr.height,
|
gc->SetBrush(gc->CreateLinearGradientBrush(gfr.x, gfr.y + gfr.height,
|
||||||
gfr.x + gfr.width, gfr.y,
|
gfr.x + gfr.width, gfr.y,
|
||||||
@@ -1404,12 +1404,12 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
|||||||
dc.DrawText(wxT("Gradients with Stops and Transparency"), gfr.x, gfr.y);
|
dc.DrawText(wxT("Gradients with Stops and Transparency"), gfr.x, gfr.y);
|
||||||
gfr.Offset(0, TEXT_HEIGHT);
|
gfr.Offset(0, TEXT_HEIGHT);
|
||||||
|
|
||||||
stops = wxGraphicsGradientStops(wxColour(255,0,0), wxTransparentColour);
|
stops = wxGraphicsGradientStops(*wxRED, wxTransparentColour);
|
||||||
stops.Add(wxColour(255,0,0), 0.33f);
|
stops.Add(*wxRED, 0.33f);
|
||||||
stops.Add(wxTransparentColour, 0.33f);
|
stops.Add(wxTransparentColour, 0.33f);
|
||||||
stops.Add(wxTransparentColour, 0.67f);
|
stops.Add(wxTransparentColour, 0.67f);
|
||||||
stops.Add(wxColour(0,0,255), 0.67f);
|
stops.Add(*wxBLUE, 0.67f);
|
||||||
stops.Add(wxColour(0,0,255), 1.0f);
|
stops.Add(*wxBLUE, 1.0f);
|
||||||
|
|
||||||
pth = gc->CreatePath();
|
pth = gc->CreatePath();
|
||||||
pth.MoveToPoint(gfr.x,gfr.y);
|
pth.MoveToPoint(gfr.x,gfr.y);
|
||||||
|
@@ -340,7 +340,7 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
|
|||||||
wxNO_FULL_REPAINT_ON_RESIZE |
|
wxNO_FULL_REPAINT_ON_RESIZE |
|
||||||
wxVSCROLL | wxHSCROLL)
|
wxVSCROLL | wxHSCROLL)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(wxColour("WHITE"));
|
SetBackgroundColour(*wxWHITE);
|
||||||
SetCursor(wxCursor(wxCURSOR_PENCIL));
|
SetCursor(wxCursor(wxCURSOR_PENCIL));
|
||||||
|
|
||||||
SetScrollbars(20, 20, 50, 50);
|
SetScrollbars(20, 20, 50, 50);
|
||||||
|
@@ -1603,7 +1603,7 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF
|
|||||||
| wxSUNKEN_BORDER);
|
| wxSUNKEN_BORDER);
|
||||||
|
|
||||||
// Set the background of our listctrl to white
|
// Set the background of our listctrl to white
|
||||||
m_playlist->SetBackgroundColour(wxColour(255,255,255));
|
m_playlist->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
// The layout of the headers of the listctrl are like
|
// The layout of the headers of the listctrl are like
|
||||||
// | | File | Length
|
// | | File | Length
|
||||||
|
@@ -86,7 +86,7 @@ bool MyApp::OnInit(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// object allocation
|
// object allocation
|
||||||
wxBrush* brush = new wxBrush(*wxRED);
|
wxBrush* brush = new wxBrush(*wxRED_BRUSH);
|
||||||
wxBitmap* bitmap = new wxBitmap(100, 100);
|
wxBitmap* bitmap = new wxBitmap(100, 100);
|
||||||
|
|
||||||
// non-object allocation
|
// non-object allocation
|
||||||
|
@@ -367,7 +367,7 @@ RegFrame::RegFrame(wxFrame *parent, const wxChar *title, int x, int y, int w, in
|
|||||||
: wxFrame(parent, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
|
: wxFrame(parent, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
|
||||||
{
|
{
|
||||||
// this reduces flicker effects
|
// this reduces flicker effects
|
||||||
SetBackgroundColour(wxColour(255, 255, 255));
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
// set the icon
|
// set the icon
|
||||||
// ------------
|
// ------------
|
||||||
|
@@ -985,13 +985,13 @@ void MyFrame::WriteInitialText()
|
|||||||
r.WriteImage(wxBitmap(smiley_xpm));
|
r.WriteImage(wxBitmap(smiley_xpm));
|
||||||
r.WriteText(wxT(" Well, you can change text "));
|
r.WriteText(wxT(" Well, you can change text "));
|
||||||
|
|
||||||
r.BeginTextColour(wxColour(255, 0, 0));
|
r.BeginTextColour(*wxRED);
|
||||||
r.WriteText(wxT("colour, like this red bit."));
|
r.WriteText(wxT("colour, like this red bit."));
|
||||||
r.EndTextColour();
|
r.EndTextColour();
|
||||||
|
|
||||||
wxRichTextAttr backgroundColourAttr;
|
wxRichTextAttr backgroundColourAttr;
|
||||||
backgroundColourAttr.SetBackgroundColour(*wxGREEN);
|
backgroundColourAttr.SetBackgroundColour(*wxGREEN);
|
||||||
backgroundColourAttr.SetTextColour(wxColour(0, 0, 255));
|
backgroundColourAttr.SetTextColour(*wxBLUE);
|
||||||
r.BeginStyle(backgroundColourAttr);
|
r.BeginStyle(backgroundColourAttr);
|
||||||
r.WriteText(wxT(" And this blue on green bit."));
|
r.WriteText(wxT(" And this blue on green bit."));
|
||||||
r.EndStyle();
|
r.EndStyle();
|
||||||
|
@@ -108,7 +108,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
|
|||||||
win->SetDefaultSize(wxSize(1000, 30));
|
win->SetDefaultSize(wxSize(1000, 30));
|
||||||
win->SetOrientation(wxLAYOUT_HORIZONTAL);
|
win->SetOrientation(wxLAYOUT_HORIZONTAL);
|
||||||
win->SetAlignment(wxLAYOUT_TOP);
|
win->SetAlignment(wxLAYOUT_TOP);
|
||||||
win->SetBackgroundColour(wxColour(255, 0, 0));
|
win->SetBackgroundColour(*wxRED);
|
||||||
win->SetSashVisible(wxSASH_BOTTOM, true);
|
win->SetSashVisible(wxSASH_BOTTOM, true);
|
||||||
|
|
||||||
m_topWindow = win;
|
m_topWindow = win;
|
||||||
@@ -120,7 +120,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
|
|||||||
win->SetDefaultSize(wxSize(1000, 30));
|
win->SetDefaultSize(wxSize(1000, 30));
|
||||||
win->SetOrientation(wxLAYOUT_HORIZONTAL);
|
win->SetOrientation(wxLAYOUT_HORIZONTAL);
|
||||||
win->SetAlignment(wxLAYOUT_BOTTOM);
|
win->SetAlignment(wxLAYOUT_BOTTOM);
|
||||||
win->SetBackgroundColour(wxColour(0, 0, 255));
|
win->SetBackgroundColour(*wxBLUE);
|
||||||
win->SetSashVisible(wxSASH_TOP, true);
|
win->SetSashVisible(wxSASH_TOP, true);
|
||||||
|
|
||||||
m_bottomWindow = win;
|
m_bottomWindow = win;
|
||||||
@@ -132,7 +132,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
|
|||||||
win->SetDefaultSize(wxSize(120, 1000));
|
win->SetDefaultSize(wxSize(120, 1000));
|
||||||
win->SetOrientation(wxLAYOUT_VERTICAL);
|
win->SetOrientation(wxLAYOUT_VERTICAL);
|
||||||
win->SetAlignment(wxLAYOUT_LEFT);
|
win->SetAlignment(wxLAYOUT_LEFT);
|
||||||
win->SetBackgroundColour(wxColour(0, 255, 0));
|
win->SetBackgroundColour(*wxGREEN);
|
||||||
win->SetSashVisible(wxSASH_RIGHT, true);
|
win->SetSashVisible(wxSASH_RIGHT, true);
|
||||||
win->SetExtraBorderSize(10);
|
win->SetExtraBorderSize(10);
|
||||||
|
|
||||||
|
@@ -490,7 +490,7 @@ SeeThroughFrame::SeeThroughFrame()
|
|||||||
wxSTAY_ON_TOP),
|
wxSTAY_ON_TOP),
|
||||||
m_currentState(STATE_SEETHROUGH)
|
m_currentState(STATE_SEETHROUGH)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(wxColour(255, 255, 255, 255));
|
SetBackgroundColour(*wxWHITE);
|
||||||
SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
|
SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -320,7 +320,7 @@ END_EVENT_TABLE()
|
|||||||
MyCanvas::MyCanvas(MyChild *parent, const wxPoint& pos, const wxSize& size)
|
MyCanvas::MyCanvas(MyChild *parent, const wxPoint& pos, const wxSize& size)
|
||||||
: wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER|wxVSCROLL|wxHSCROLL)
|
: wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER|wxVSCROLL|wxHSCROLL)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(wxColour(wxT("WHITE")));
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
m_child = parent;
|
m_child = parent;
|
||||||
m_index = m_child->GetFrame()->GetCountOfChildren() % 9;
|
m_index = m_child->GetFrame()->GetCountOfChildren() % 9;
|
||||||
|
@@ -215,7 +215,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
|||||||
// This reduces flicker effects - even better would be to define
|
// This reduces flicker effects - even better would be to define
|
||||||
// OnEraseBackground to do nothing. When the tree control's scrollbars are
|
// OnEraseBackground to do nothing. When the tree control's scrollbars are
|
||||||
// show or hidden, the frame is sent a background erase event.
|
// show or hidden, the frame is sent a background erase event.
|
||||||
SetBackgroundColour(wxColour(255, 255, 255));
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
// Give it an icon
|
// Give it an icon
|
||||||
SetIcon(wxICON(sample));
|
SetIcon(wxICON(sample));
|
||||||
|
@@ -619,7 +619,7 @@ wxBitmap ButtonWidgetsPage::CreateBitmap(const wxString& label)
|
|||||||
wxBitmap bmp(180, 70); // shouldn't hardcode but it's simpler like this
|
wxBitmap bmp(180, 70); // shouldn't hardcode but it's simpler like this
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
dc.SelectObject(bmp);
|
dc.SelectObject(bmp);
|
||||||
dc.SetBackground(wxBrush(*wxCYAN));
|
dc.SetBackground(*wxCYAN_BRUSH);
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
dc.SetTextForeground(*wxBLACK);
|
dc.SetTextForeground(*wxBLACK);
|
||||||
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n")
|
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n")
|
||||||
|
@@ -541,7 +541,7 @@ void ODComboboxWidgetsPage::CreateCombo()
|
|||||||
|
|
||||||
if ( m_chkBitmapbutton->GetValue() )
|
if ( m_chkBitmapbutton->GetValue() )
|
||||||
{
|
{
|
||||||
wxBitmap bmpNormal = CreateBitmap(wxColour(0,0,255));
|
wxBitmap bmpNormal = CreateBitmap(*wxBLUE);
|
||||||
wxBitmap bmpPressed = CreateBitmap(wxColour(0,0,128));
|
wxBitmap bmpPressed = CreateBitmap(wxColour(0,0,128));
|
||||||
wxBitmap bmpHover = CreateBitmap(wxColour(128,128,255));
|
wxBitmap bmpHover = CreateBitmap(wxColour(128,128,255));
|
||||||
m_combobox->SetButtonBitmaps(bmpNormal,m_chkStdbutton->GetValue(),bmpPressed,bmpHover);
|
m_combobox->SetButtonBitmaps(bmpNormal,m_chkStdbutton->GetValue(),bmpPressed,bmpHover);
|
||||||
|
@@ -526,7 +526,7 @@ wxBitmap ToggleWidgetsPage::CreateBitmap(const wxString& label)
|
|||||||
wxBitmap bmp(180, 70); // shouldn't hardcode but it's simpler like this
|
wxBitmap bmp(180, 70); // shouldn't hardcode but it's simpler like this
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
dc.SelectObject(bmp);
|
dc.SelectObject(bmp);
|
||||||
dc.SetBackground(wxBrush(*wxCYAN));
|
dc.SetBackground(*wxCYAN_BRUSH);
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
dc.SetTextForeground(*wxBLACK);
|
dc.SetTextForeground(*wxBLACK);
|
||||||
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n")
|
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n")
|
||||||
|
Reference in New Issue
Block a user