From 75467841ee216aebe97b10bc9946c5dbaa3312d1 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 8 Aug 2015 11:48:21 +0200 Subject: [PATCH 1/2] Moved "edit" icon from wxEditableListBox to wxArtProvider. "Edit" icon definition used internally in wxEditableListBox is moved to wxDefaultArtProvider and exposed as wxART_EDIT. While there is no native version of this icon yet, it could be added in the future and in the meanwhile this commit will be useful to use only standard bitmaps in wxEditableListBox. --- art/edit.xpm | 22 ++++++++++++++++++++++ include/wx/artprov.h | 1 + interface/wx/artprov.h | 2 ++ src/common/artstd.cpp | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 art/edit.xpm diff --git a/art/edit.xpm b/art/edit.xpm new file mode 100644 index 0000000000..83d684ab3b --- /dev/null +++ b/art/edit.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char* const edit_xpm[] = { +"16 16 3 1", +" c None", +". c #000000", +"+ c #00007F", +" ", +" ", +" .. .. ", +" . ", +" . ", +" ++++ . ++++ ", +" ++ . ++ ++", +" +++++ . ++++++", +" ++ ++ . ++ ", +" ++ ++ . ++ ++", +" +++++ . ++++ ", +" . ", +" . ", +" .. .. ", +" ", +" "}; diff --git a/include/wx/artprov.h b/include/wx/artprov.h index 14ba530417..29e0c71b26 100644 --- a/include/wx/artprov.h +++ b/include/wx/artprov.h @@ -113,6 +113,7 @@ typedef wxString wxArtID; #define wxART_FULL_SCREEN wxART_MAKE_ART_ID(wxART_FULL_SCREEN) +#define wxART_EDIT wxART_MAKE_ART_ID(wxART_EDIT) // ---------------------------------------------------------------------------- // wxArtProvider class diff --git a/interface/wx/artprov.h b/interface/wx/artprov.h index 8299b0dc1d..aff555eb29 100644 --- a/interface/wx/artprov.h +++ b/interface/wx/artprov.h @@ -89,6 +89,7 @@ wxArtID wxART_FIND; wxArtID wxART_FIND_AND_REPLACE; wxArtID wxART_FULL_SCREEN; +wxArtID wxART_EDIT; /** @@ -191,6 +192,7 @@ wxArtID wxART_FULL_SCREEN; @li @c wxART_FIND @li @c wxART_FIND_AND_REPLACE @li @c wxART_FULL_SCREEN (since 3.1.0) + @li @c wxART_EDIT (since 3.1.0) @li @c wxART_HARDDISK @li @c wxART_FLOPPY @li @c wxART_CDROM diff --git a/src/common/artstd.cpp b/src/common/artstd.cpp index e00702ef69..0f59d8cc5f 100644 --- a/src/common/artstd.cpp +++ b/src/common/artstd.cpp @@ -127,6 +127,7 @@ protected: #include "../../art/find.xpm" #include "../../art/findrepl.xpm" #include "../../art/fullscreen.xpm" +#include "../../art/edit.xpm" wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) { @@ -192,6 +193,7 @@ wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) ART(wxART_FIND_AND_REPLACE, findrepl) ART(wxART_FULL_SCREEN, fullscreen) ART(wxART_NEW, new) + ART(wxART_EDIT, edit) return wxNullBitmap; From c774494009822ffa7d18d15399ec77340b9a3f66 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 8 Aug 2015 11:30:45 +0200 Subject: [PATCH 2/2] Use standard wxArtProvider icons for wxEditableListBox buttons. This make wxEditableListBox appearance more native under the platforms where the stock icons are used, e.g. GTK. Closes #16885. --- docs/changes.txt | 1 + src/generic/editlbox.cpp | 126 ++++----------------------------------- 2 files changed, 12 insertions(+), 115 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 640acdb46f..2f3b03efcb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -121,6 +121,7 @@ All (GUI): - Show how to handle files on command line in docview sample (Neil Mayhew). - Improve wxFileCtrl::SetFilename() and SetPath() (Kevin B. McCarty). - Fix a crash when using animated GIFs in wxHtmlListBox. +- Use platform-specific stock icons for wxEditableListBox buttons. wxGTK: diff --git a/src/generic/editlbox.cpp b/src/generic/editlbox.cpp index bf54142507..074fa5fac2 100644 --- a/src/generic/editlbox.cpp +++ b/src/generic/editlbox.cpp @@ -24,6 +24,7 @@ #include "wx/editlbox.h" #include "wx/sizer.h" #include "wx/listctrl.h" +#include "wx/artprov.h" // ============================================================================ // implementation @@ -31,116 +32,6 @@ const char wxEditableListBoxNameStr[] = "editableListBox"; -static const char* const eledit_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #00007F", -" ", -" ", -" .. .. ", -" . ", -" . ", -" ++++ . ++++ ", -" ++ . ++ ++", -" +++++ . ++++++", -" ++ ++ . ++ ", -" ++ ++ . ++ ++", -" +++++ . ++++ ", -" . ", -" . ", -" .. .. ", -" ", -" "}; - -static const char* const elnew_xpm[] = { -"16 16 5 1", -" c None", -". c #7F7F7F", -"+ c #FFFFFF", -"@ c #FFFF00", -"# c #000000", -" ", -" ", -" . .+ .@ ", -" . .@.@# # # ", -" @.@+.... # ", -" ... @@ ", -" @ . @. # ", -" .# .@ ", -" . # ", -" # ", -" # ", -" # ", -" # ", -" # # # # # # ", -" ", -" "}; - -static const char* const eldel_xpm[] = { -"16 16 3 1", -" c None", -". c #7F0000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ..+ ..+ ", -" ....+ ..+ ", -" ....+ ..+ ", -" ...+ .+ ", -" .....+ ", -" ...+ ", -" .....+ ", -" ...+ ..+ ", -" ...+ ..+ ", -" ...+ .+ ", -" ...+ .+ ", -" . . ", -" "}; - -static const char* const eldown_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ........... ", -" ......... ", -" ....... ", -" ..... ", -" ... ", -" . ", -" ", -" "}; - -static const char* const elup_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" . ", -" ... ", -" ..... ", -" ....... ", -" ......... ", -" ........... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ", -" ", -" "}; - // list control with auto-resizable column: class CleverListCtrl : public wxListCtrl { @@ -243,28 +134,33 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, if ( m_style & wxEL_ALLOW_EDIT ) { - m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, wxBitmap(eledit_xpm)); + m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, + wxArtProvider::GetBitmap(wxART_EDIT, wxART_BUTTON)); subsizer->Add(m_bEdit, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); } if ( m_style & wxEL_ALLOW_NEW ) { - m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, wxBitmap(elnew_xpm)); + m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, + wxArtProvider::GetBitmap(wxART_NEW, wxART_BUTTON)); subsizer->Add(m_bNew, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); } if ( m_style & wxEL_ALLOW_DELETE ) { - m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, wxBitmap(eldel_xpm)); + m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, + wxArtProvider::GetBitmap(wxART_DELETE, wxART_BUTTON)); subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); } if (!(m_style & wxEL_NO_REORDER)) { - m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxBitmap(elup_xpm)); + m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, + wxArtProvider::GetBitmap(wxART_GO_UP, wxART_BUTTON)); subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); - m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxBitmap(eldown_xpm)); + m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, + wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_BUTTON)); subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); }