Don't use deprecated wxBOLD, wxNORMAL and similar constants.
Replace them with wxFONTWEIGHT_BOLD, wxFONTSTYLE_NORMAL or wxFONTWEIGHT_NORMAL and equivalents in the code of the library itself and in the samples. Also simplify font construction using wxFontInfo where possible to avoid specifying these constants at all if they are not needed. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1084,7 +1084,7 @@ void DnDFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
GetClientSize( &w, &h );
|
||||
|
||||
wxPaintDC dc(this);
|
||||
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, false, wxT("charter") ) );
|
||||
dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE).FaceName("charter") );
|
||||
dc.DrawText( wxT("Drag text from here!"), 100, h-50 );
|
||||
}
|
||||
|
||||
|
@@ -774,7 +774,7 @@ void MyCanvas::DrawDefault(wxDC& dc)
|
||||
void MyCanvas::DrawText(wxDC& dc)
|
||||
{
|
||||
// set underlined font for testing
|
||||
dc.SetFont( wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, true) );
|
||||
dc.SetFont( wxFontInfo(12).Family(wxFONTFAMILY_MODERN).Underlined() );
|
||||
dc.DrawText( wxT("This is text"), 110, 10 );
|
||||
dc.DrawRotatedText( wxT("That is text"), 20, 10, -45 );
|
||||
|
||||
@@ -791,7 +791,7 @@ void MyCanvas::DrawText(wxDC& dc)
|
||||
dc.DrawRotatedText(text , 400, 400, n);
|
||||
}
|
||||
|
||||
dc.SetFont( wxFont( 18, wxSWISS, wxNORMAL, wxNORMAL ) );
|
||||
dc.SetFont( wxFontInfo(18).Family(wxFONTFAMILY_SWISS) );
|
||||
|
||||
dc.DrawText( wxT("This is Swiss 18pt text."), 110, 40 );
|
||||
|
||||
@@ -1232,7 +1232,7 @@ void MyCanvas::DrawSplines(wxDC& dc)
|
||||
letters[m][n].y = center.y + h[ letters[m][n].y ];
|
||||
}
|
||||
|
||||
dc.SetPen( wxPen( *wxBLUE, 1, wxDOT) );
|
||||
dc.SetPen( wxPen( *wxBLUE, 1, wxPENSTYLE_DOT) );
|
||||
dc.DrawLines(5, letters[m]);
|
||||
dc.SetPen( wxPen( *wxBLACK, 4) );
|
||||
dc.DrawSpline(5, letters[m]);
|
||||
|
@@ -666,7 +666,7 @@ void MyCanvas::CreateAntiAliasedBitmap()
|
||||
|
||||
dc.Clear();
|
||||
|
||||
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL) );
|
||||
dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE) );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.DrawText( wxT("This is anti-aliased Text."), 20, 5 );
|
||||
dc.DrawText( wxT("And a Rectangle."), 20, 45 );
|
||||
|
@@ -110,11 +110,11 @@ void OwnerDrawnFrame::InitMenu()
|
||||
wxMenu *sub_menu = new wxMenu;
|
||||
|
||||
// vars used for menu construction
|
||||
wxFont fontLarge(18, wxROMAN, wxNORMAL, wxBOLD, false),
|
||||
fontUlined(12, wxDEFAULT, wxNORMAL, wxNORMAL, true),
|
||||
fontItalic(12, wxMODERN, wxITALIC, wxBOLD, false),
|
||||
wxFont fontLarge(wxFontInfo(18).Family(wxFONTFAMILY_ROMAN).Bold()),
|
||||
fontUlined(wxFontInfo(12).Underlined()),
|
||||
fontItalic(wxFontInfo(12).Italic().Bold()),
|
||||
// should be at least of the size of bitmaps
|
||||
fontBmp(14, wxDEFAULT, wxNORMAL, wxNORMAL, false);
|
||||
fontBmp(wxFontInfo(14));
|
||||
|
||||
// sorry for my artistic skills...
|
||||
wxBitmap bmpBell(wxT("bell")),
|
||||
|
@@ -698,9 +698,8 @@ void MyPrintout::DrawPageTwo()
|
||||
wxT("testing "), wxT("string. "), wxT("Enjoy "), wxT("it!") };
|
||||
wxCoord w, h;
|
||||
long x = 200, y= 250;
|
||||
wxFont fnt(15, wxSWISS, wxNORMAL, wxNORMAL);
|
||||
|
||||
dc->SetFont(fnt);
|
||||
dc->SetFont(wxFontInfo(15).Family(wxFONTFAMILY_SWISS));
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
@@ -746,15 +745,6 @@ void MyPrintout::DrawPageTwo()
|
||||
// Writes a header on a page. Margin units are in millimetres.
|
||||
bool MyPrintout::WritePageHeader(wxPrintout *printout, wxDC *dc, const wxString&text, float mmToLogical)
|
||||
{
|
||||
#if 0
|
||||
static wxFont *headerFont = (wxFont *) NULL;
|
||||
if (!headerFont)
|
||||
{
|
||||
headerFont = wxTheFontList->FindOrCreateFont(16, wxSWISS, wxNORMAL, wxBOLD);
|
||||
}
|
||||
dc->SetFont(headerFont);
|
||||
#endif
|
||||
|
||||
int pageWidthMM, pageHeightMM;
|
||||
|
||||
printout->GetPageSizeMM(&pageWidthMM, &pageHeightMM);
|
||||
|
@@ -113,7 +113,7 @@ void wxFontDataProperty::OnSetValue()
|
||||
|
||||
wxFont font = fontData.GetChosenFont();
|
||||
if ( !font.IsOk() )
|
||||
font = wxFont(10,wxSWISS,wxNORMAL,wxNORMAL);
|
||||
font = wxFontInfo(10).Family(wxFONTFAMILY_SWISS);
|
||||
|
||||
m_value = WXVARIANT(font);
|
||||
}
|
||||
|
@@ -594,8 +594,8 @@ void MyApp::CreateStyles()
|
||||
{
|
||||
// Paragraph styles
|
||||
|
||||
wxFont romanFont(12, wxROMAN, wxNORMAL, wxNORMAL);
|
||||
wxFont swissFont(12, wxSWISS, wxNORMAL, wxNORMAL);
|
||||
wxFont romanFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
|
||||
wxFont swissFont(wxFontInfo(12).Family(wxFONTFAMILY_SWISS));
|
||||
|
||||
wxRichTextParagraphStyleDefinition* normalPara = new wxRichTextParagraphStyleDefinition(wxT("Normal"));
|
||||
wxRichTextAttr normalAttr;
|
||||
@@ -915,14 +915,14 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
||||
wxSplitterWindow* splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE);
|
||||
sizer->Add(splitter, 1, wxEXPAND);
|
||||
|
||||
wxFont textFont = wxFont(12, wxROMAN, wxNORMAL, wxNORMAL);
|
||||
wxFont boldFont = wxFont(12, wxROMAN, wxNORMAL, wxBOLD);
|
||||
wxFont italicFont = wxFont(12, wxROMAN, wxITALIC, wxNORMAL);
|
||||
wxFont textFont = wxFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
|
||||
wxFont boldFont = wxFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
|
||||
wxFont italicFont = wxFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN).Italic());
|
||||
|
||||
m_richTextCtrl = new MyRichTextCtrl(splitter, ID_RICHTEXT_CTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxVSCROLL|wxHSCROLL/*|wxWANTS_CHARS*/);
|
||||
wxASSERT(!m_richTextCtrl->GetBuffer().GetAttributes().HasFontPixelSize());
|
||||
|
||||
wxFont font(12, wxROMAN, wxNORMAL, wxNORMAL);
|
||||
wxFont font(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
|
||||
|
||||
m_richTextCtrl->SetFont(font);
|
||||
|
||||
|
@@ -145,7 +145,7 @@ Edit::Edit (wxWindow *parent, wxWindowID id,
|
||||
SetReadOnly (g_CommonPrefs.readOnlyInitial);
|
||||
SetWrapMode (g_CommonPrefs.wrapModeInitial?
|
||||
wxSTC_WRAP_WORD: wxSTC_WRAP_NONE);
|
||||
wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
wxFont font(wxFontInfo(10).Family(wxFONTFAMILY_MODERN));
|
||||
StyleSetFont (wxSTC_STYLE_DEFAULT, font);
|
||||
StyleSetForeground (wxSTC_STYLE_DEFAULT, *wxBLACK);
|
||||
StyleSetBackground (wxSTC_STYLE_DEFAULT, *wxWHITE);
|
||||
@@ -529,7 +529,7 @@ bool Edit::InitializePrefs (const wxString &name) {
|
||||
// default fonts for all styles!
|
||||
int Nr;
|
||||
for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) {
|
||||
wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL);
|
||||
wxFont font(wxFontInfo(10).Family(wxFONTFAMILY_MODERN));
|
||||
StyleSetFont (Nr, font);
|
||||
}
|
||||
|
||||
@@ -543,8 +543,9 @@ bool Edit::InitializePrefs (const wxString &name) {
|
||||
for (Nr = 0; Nr < STYLE_TYPES_COUNT; Nr++) {
|
||||
if (curInfo->styles[Nr].type == -1) continue;
|
||||
const StyleInfo &curType = g_StylePrefs [curInfo->styles[Nr].type];
|
||||
wxFont font (curType.fontsize, wxMODERN, wxNORMAL, wxNORMAL, false,
|
||||
curType.fontname);
|
||||
wxFont font(wxFontInfo(curType.fontsize)
|
||||
.Family(wxFONTFAMILY_MODERN)
|
||||
.FaceName(curType.fontname));
|
||||
StyleSetFont (Nr, font);
|
||||
if (curType.foreground) {
|
||||
StyleSetForeground (Nr, wxColour (curType.foreground));
|
||||
|
@@ -648,7 +648,7 @@ AppAbout::AppAbout (wxWindow *parent,
|
||||
wxBoxSizer *totalpane = new wxBoxSizer (wxVERTICAL);
|
||||
totalpane->Add (0, 20);
|
||||
wxStaticText *appname = new wxStaticText(this, wxID_ANY, *g_appname);
|
||||
appname->SetFont (wxFont (24, wxDEFAULT, wxNORMAL, wxBOLD));
|
||||
appname->SetFont (wxFontInfo(24).Bold());
|
||||
totalpane->Add (appname, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 40);
|
||||
totalpane->Add (0, 10);
|
||||
totalpane->Add (aboutpane, 0, wxEXPAND | wxALL, 4);
|
||||
|
@@ -336,7 +336,6 @@ void MyCanvas::OnDraw(wxDC& dc)
|
||||
wxBrush wB;
|
||||
wxPoint points[6];
|
||||
wxColour wC;
|
||||
wxFont wF;
|
||||
|
||||
dc.SetFont(*wxSWISS_FONT);
|
||||
dc.SetPen(*wxGREEN_PEN);
|
||||
@@ -399,8 +398,10 @@ void MyCanvas::OnDraw(wxDC& dc)
|
||||
dc.DrawText(wxT("This is a Red string"), 50, 200);
|
||||
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
|
||||
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
|
||||
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
|
||||
dc.SetFont(wF);
|
||||
dc.SetFont(wxFontInfo(18)
|
||||
.FaceName("Times New Roman")
|
||||
.Family(wxFONTFAMILY_ROMAN)
|
||||
.Italic().Bold());
|
||||
dc.SetTextForeground (wC);
|
||||
dc.DrawText(wxT("This is a Times-style string"), 50, 60);
|
||||
#if wxUSE_STATUSBAR
|
||||
@@ -455,8 +456,10 @@ void MyCanvas::OnDraw(wxDC& dc)
|
||||
break;
|
||||
|
||||
case 5:
|
||||
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
|
||||
dc.SetFont(wF);
|
||||
dc.SetFont(wxFontInfo(18)
|
||||
.FaceName("Times New Roman")
|
||||
.Family(wxFONTFAMILY_ROMAN)
|
||||
.Italic().Bold());
|
||||
dc.DrawLine(0, 0, 200, 200);
|
||||
dc.DrawLine(200, 0, 0, 200);
|
||||
dc.DrawText(wxT("This is an 18pt string"), 50, 60);
|
||||
|
@@ -1098,23 +1098,23 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||
switch ( (wxChar)wxTheApp->argv[1][0] )
|
||||
{
|
||||
case '2':
|
||||
m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL,
|
||||
false, wxT(""),
|
||||
wxFONTENCODING_ISO8859_2));
|
||||
m_horizontal->SetFont(wxFontInfo(18)
|
||||
.Family(wxFONTFAMILY_SWISS)
|
||||
.Encoding(wxFONTENCODING_ISO8859_2));
|
||||
m_horizontal->AppendText(wxT("\256lu\273ou\350k\375 k\371\362 zb\354sile \350e\271tina \253\273"));
|
||||
break;
|
||||
|
||||
case '1':
|
||||
m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL,
|
||||
false, wxT(""),
|
||||
wxFONTENCODING_CP1251));
|
||||
m_horizontal->SetFont(wxFontInfo(18)
|
||||
.Family(wxFONTFAMILY_SWISS)
|
||||
.Encoding(wxFONTENCODING_CP1251));
|
||||
m_horizontal->AppendText(wxT("\317\360\350\342\345\362!"));
|
||||
break;
|
||||
|
||||
case '8':
|
||||
m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL,
|
||||
false, wxT(""),
|
||||
wxFONTENCODING_CP1251));
|
||||
m_horizontal->SetFont(wxFontInfo(18)
|
||||
.Family(wxFONTFAMILY_SWISS)
|
||||
.Encoding(wxFONTENCODING_CP1251));
|
||||
#if wxUSE_UNICODE
|
||||
m_horizontal->AppendText(L"\x0412\x0430\x0434\x0438\x043c \x0426");
|
||||
#else
|
||||
@@ -1923,12 +1923,12 @@ void RichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||
|
||||
if (attr.HasFont())
|
||||
{
|
||||
if (attr.GetFont().GetWeight() == wxBOLD)
|
||||
if (attr.GetFont().GetWeight() == wxFONTWEIGHT_BOLD)
|
||||
msg += wxT(" BOLD");
|
||||
else if (attr.GetFont().GetWeight() == wxNORMAL)
|
||||
else if (attr.GetFont().GetWeight() == wxFONTWEIGHT_NORMAL)
|
||||
msg += wxT(" NORMAL");
|
||||
|
||||
if (attr.GetFont().GetStyle() == wxITALIC)
|
||||
if (attr.GetFont().GetStyle() == wxFONTSTYLE_ITALIC)
|
||||
msg += wxT(" ITALIC");
|
||||
|
||||
if (attr.GetFont().GetUnderlined())
|
||||
|
@@ -111,7 +111,7 @@ void ClassListDialog::CreateControls()
|
||||
m_pClassCountText = new wxStaticText( this, wxID_STATIC,
|
||||
wxT("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pClassCountText->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, wxT("Tahoma")));
|
||||
m_pClassCountText->SetFont(wxFontInfo(8).Family(wxFONTFAMILY_SWISS).Bold());
|
||||
itemBoxSizer2->Add(m_pClassCountText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
Reference in New Issue
Block a user