Use wxBitmapBundle in wxPropertyGridManager

wxBitmapBundle can be used in wxPropertyGridManager to pass images
to the toolbar.
This commit is contained in:
Artur Wieczorek
2021-11-14 19:16:00 +01:00
parent 91402a0de8
commit 12af82ca38
3 changed files with 141 additions and 18 deletions

View File

@@ -192,8 +192,8 @@ public:
// Creates new property page. Note that the first page is not created
// automatically.
// label - A label for the page. This may be shown as a toolbar tooltip etc.
// bmp - Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
// default image is used.
// bmp - Bitmap bundle image for toolbar. If it's null then a built-in
// default bitmap bundle is used.
// pageObj - wxPropertyGridPage instance. Manager will take ownership of this object.
// NULL indicates that a default page instance should be created.
// Returns pointer to created page.
@@ -201,7 +201,7 @@ public:
// added when the toolbar is not turned off using window style flag
// switching.
wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
const wxBitmap& bmp = wxNullBitmap,
const wxBitmapBundle& bmp = wxBitmapBundle(),
wxPropertyGridPage* pageObj = NULL )
{
return InsertPage(-1, label, bmp, pageObj);
@@ -378,14 +378,14 @@ public:
// automatically.
// index - Add to this position. -1 will add as the last item.
// label - A label for the page. This may be shown as a toolbar tooltip etc.
// bmp - Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
// default image is used.
// bmp - Bitmap bundle for toolbar. If it's null, then a built-in
// default bitmap bundle is used.
// pageObj - wxPropertyGridPage instance. Manager will take ownership of this object.
// If NULL, default page object is constructed.
// Returns pointer to created page.
virtual wxPropertyGridPage* InsertPage( int index,
const wxString& label,
const wxBitmap& bmp = wxNullBitmap,
const wxBitmapBundle& bmp = wxBitmapBundle(),
wxPropertyGridPage* pageObj = NULL );
// Returns true if any property on any page has been modified by the user.

View File

@@ -244,8 +244,8 @@ public:
A label for the page. This may be shown as a toolbar tooltip etc.
@param bmp
Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
default image is used.
Bitmap bundle for toolbar. If it is null then a built-in default
bitmap bundle is used.
@param pageObj
wxPropertyGridPage instance. Manager will take ownership of this
@@ -258,7 +258,7 @@ public:
switching. Otherwise toolbar buttons might not be added properly.
*/
wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
const wxBitmap& bmp = wxPG_NULL_BITMAP,
const wxBitmapBundle& bmp = wxBitmapBundle(),
wxPropertyGridPage* pageObj = NULL );
/**
@@ -402,8 +402,8 @@ public:
A label for the page. This may be shown as a toolbar tooltip etc.
@param bmp
Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
default image is used.
Bitmap bundle for toolbar. If it is null then a built-in default
bitmap bundle is used.
@param pageObj
wxPropertyGridPage instance. Manager will take ownership of this
@@ -412,7 +412,7 @@ public:
@return Returns pointer to created page.
*/
virtual wxPropertyGridPage* InsertPage( int index, const wxString& label,
const wxBitmap& bmp = wxNullBitmap,
const wxBitmapBundle& bmp = wxBitmapBundle(),
wxPropertyGridPage* pageObj = NULL );
/**

View File

@@ -85,6 +85,47 @@ static const char* const gs_xpm_catmode[] = {
"................"
};
static const char* const gs_xpm_catmode_2x[] = {
"32 32 5 1",
". c none",
"B c black",
"D c #868686",
"L c #CACACA",
"W c #FFFFFF",
"................................",
"...DDDD.........................",
"..DDDDDD........................",
"..DDLLDD..BBBBBBBBBBBB..........",
"..DDLLDD..BBBBBBBBBBBB..........",
"..DDDDDD........................",
"...DDDD.........................",
"..........DDDDDDDDDD..DDDDDD....",
"..........DDDDDDDDDD..DDDDDD....",
"................................",
"................................",
"..........DDDDDDDDDD..DDDDDD....",
"..........DDDDDDDDDD..DDDDDD....",
"................................",
"................................",
"..........DDDDDDDDDD..DDDDDD....",
"..........DDDDDDDDDD..DDDDDD....",
"................................",
"................................",
"..........DDDDDDDDDD..DDDDDD....",
"..........DDDDDDDDDD..DDDDDD....",
"................................",
"................................",
"...DDDD.........................",
"..DDDDDD........................",
"..DDLLDD..BBBBBBBBBBBB..........",
"..DDLLDD..BBBBBBBBBBBB..........",
"..DDDDDD........................",
"...DDDD.........................",
"..........DDDDDDDDDD..DDDDDD....",
"..........DDDDDDDDDD..DDDDDD....",
"................................"
};
// Alphabetic Mode Icon
static const char* const gs_xpm_noncatmode[] = {
"16 16 5 1",
@@ -111,6 +152,47 @@ static const char* const gs_xpm_noncatmode[] = {
"................"
};
static const char* const gs_xpm_noncatmode_2x[] = {
"32 32 5 1",
". c none",
"B c black",
"D c #868686",
"L c #000080",
"W c #FFFFFF",
"................................",
"....DDBBDD......DDDDDD..DDDDDD..",
"....DDBBDD......DDDDDD..DDDDDD..",
"..DDBB..BBDD....................",
"..DDBB..BBDD....................",
"..BBBBBBBBBB....DDDDDD..DDDDDD..",
"..BBBBBBBBBB....DDDDDD..DDDDDD..",
"..BB......BB....................",
"..BB......BB....................",
"................DDDDDD..DDDDDD..",
"......LL........DDDDDD..DDDDDD..",
"......LL........................",
"......LL........................",
"......LL........DDDDDD..DDDDDD..",
"..LL..LL..LL....DDDDDD..DDDDDD..",
"...LL.LL.LL.....................",
"....LLLLLL......................",
".....LLLL.......DDDDDD..DDDDDD..",
"......LL........DDDDDD..DDDDDD..",
"......LL........................",
"................................",
"..BBBBBBBBBB....DDDDDD..DDDDDD..",
"..BBBBBBBBBB....DDDDDD..DDDDDD..",
"........BBDD....................",
".......BBDD.....................",
"......BBDD......DDDDDD..DDDDDD..",
".....BBDD.......DDDDDD..DDDDDD..",
"....BBDD........................",
"...BBDD.........................",
"..BBBBBBBBBB....DDDDDD..DDDDDD..",
"..BBBBBBBBBB....DDDDDD..DDDDDD..",
"................................"
};
// Default Page Icon.
static const char* const gs_xpm_defpage[] = {
"16 16 5 1",
@@ -137,6 +219,47 @@ static const char* const gs_xpm_defpage[] = {
"................"
};
static const char* const gs_xpm_defpage_2x[] = {
"32 32 5 1",
". c none",
"B c black",
"D c #868686",
"L c #000080",
"W c #FFFFFF",
"................................",
"................................",
"................................",
"................................",
"................................",
"....BBBBBBBBBBBBBBBBBBBBBBBB....",
"....BBBBBBBBBBBBBBBBBBBBBBBB....",
"....BB....................BB....",
"....BB....................BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB....................BB....",
"....BB....................BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB....................BB....",
"....BB....................BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB....................BB....",
"....BB....................BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB..BBBB..LLLLLLLLLL..BB....",
"....BB....................BB....",
"....BB....................BB....",
"....BBBBBBBBBBBBBBBBBBBBBBBB....",
"....BBBBBBBBBBBBBBBBBBBBBBBB....",
"................................",
"................................",
"................................",
"................................",
"................................"
};
// -----------------------------------------------------------------------
// wxPropertyGridPage
// -----------------------------------------------------------------------
@@ -939,7 +1062,7 @@ size_t wxPropertyGridManager::GetPageCount() const
wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
const wxString& label,
const wxBitmap& bmp,
const wxBitmapBundle& bmp,
wxPropertyGridPage* pageObj )
{
if ( index < 0 )
@@ -1038,7 +1161,7 @@ wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
label, wxITEM_RADIO);
else
tool = m_pToolbar->AddTool(wxID_ANY, label,
wxBitmap(gs_xpm_defpage),
wxBitmapBundle::FromBitmaps(wxBitmap(gs_xpm_defpage), wxBitmap(gs_xpm_defpage_2x)),
label, wxITEM_RADIO);
pageObj->m_toolId = tool->GetId();
@@ -1532,8 +1655,8 @@ void wxPropertyGridManager::RecreateControls()
wxToolBarToolBase* tool = m_pToolbar->InsertTool(0,
wxID_ANY,
desc,
wxBitmap(gs_xpm_catmode),
wxNullBitmap,
wxBitmapBundle::FromBitmaps(wxBitmap(gs_xpm_catmode), wxBitmap(gs_xpm_catmode_2x)),
wxBitmapBundle(),
wxITEM_RADIO,
desc);
m_categorizedModeToolId = tool->GetId();
@@ -1549,8 +1672,8 @@ void wxPropertyGridManager::RecreateControls()
wxToolBarToolBase* tool = m_pToolbar->InsertTool(1,
wxID_ANY,
desc,
wxBitmap(gs_xpm_noncatmode),
wxNullBitmap,
wxBitmapBundle::FromBitmaps(wxBitmap(gs_xpm_noncatmode), wxBitmap(gs_xpm_noncatmode_2x)),
wxBitmapBundle(),
wxITEM_RADIO,
desc);
m_alphabeticModeToolId = tool->GetId();