Use wxBitmapBundle in wxPropertyGrid

This commit is contained in:
Artur Wieczorek
2021-11-19 17:52:55 +01:00
parent 17c1bfc0f4
commit 87394856f5
11 changed files with 121 additions and 79 deletions

View File

@@ -1159,7 +1159,7 @@ void FormMain::PopulateWithStandardItems ()
continue;
pg->SetPropertyCell( p, 3, "Cell 3", bmp );
pg->SetPropertyCell( p, 4, "Cell 4", wxNullBitmap, *wxWHITE, *wxBLACK );
pg->SetPropertyCell( p, 4, "Cell 4", wxBitmapBundle(), *wxWHITE, *wxBLACK );
}
}
@@ -1384,16 +1384,35 @@ void FormMain::PopulateWithExamples ()
pg->Append( new wxStringProperty( "StringPropertyWithBitmap",
wxPG_LABEL,
"Test Text") );
wxBitmap myTestBitmap(60, 15, 32);
wxMemoryDC mdc;
mdc.SelectObject(myTestBitmap);
mdc.SetBackground(*wxWHITE_BRUSH);
mdc.Clear();
mdc.SetPen(*wxBLACK);
mdc.DrawLine(0, 0, 60, 15);
mdc.SelectObject(wxNullBitmap);
pg->SetPropertyImage( "StringPropertyWithBitmap", myTestBitmap );
wxBitmap myTestBitmap1x(60, 15, 32);
{
wxMemoryDC mdc(myTestBitmap1x);
mdc.SetBackground(*wxWHITE_BRUSH);
mdc.Clear();
mdc.SetPen(*wxBLACK_PEN);
mdc.SetBrush(*wxWHITE_BRUSH);
mdc.DrawRectangle(0, 0, 60, 15);
mdc.DrawLine(0, 0, 59, 14);
mdc.SetTextForeground(*wxBLACK);
mdc.DrawText("x1", 0, 0);
}
wxBitmap myTestBitmap2x(120, 30, 32);
{
wxMemoryDC mdc(myTestBitmap2x);
mdc.SetBackground(*wxWHITE_BRUSH);
mdc.Clear();
mdc.SetPen(wxPen(*wxBLUE, 2));
mdc.SetBrush(*wxWHITE_BRUSH);
mdc.DrawRectangle(0, 0, 120, 30);
mdc.DrawLine(0, 0, 119, 31);
mdc.SetTextForeground(*wxBLUE);
wxFont f = mdc.GetFont();
f.SetPixelSize(2 * f.GetPixelSize());
mdc.SetFont(f);
mdc.DrawText("x2", 0, 0);
}
myTestBitmap2x.SetScaleFactor(2);
pg->SetPropertyImage( "StringPropertyWithBitmap", wxBitmapBundle::FromBitmaps(myTestBitmap1x, myTestBitmap2x));
// this value array would be optional if values matched string indexes
//long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX, wxMAXIMIZE_BOX };