Change wxSTC mapping for SCI_REGISTERIMAGE

Currently the Scintilla message SCI_REGISTERIMAGE is mapped to
wxStyledTextCtrl::RegisterImage(int, const wxBitmap&). This makes
RegisterImage a manually defined method and passes the bitmap directly
to the listbox instead of first converting to an XPM.

To backfill the message map, SCI_REGISTERIMAGE is now mapped to a new
method overload RegisterImage(int, const char* const*). The new method
accepts XPM data instead of a wxBitmap.
This commit is contained in:
New Pagodi
2019-03-17 01:48:51 -05:00
parent f50b18000a
commit 8be4f7dde6
9 changed files with 78 additions and 58 deletions

View File

@@ -29,7 +29,6 @@
#include "wx/mstream.h"
#include "wx/xpmdecod.h"
#include "wx/image.h"
#include "wx/imaglist.h"
#include "wx/tokenzr.h"
#include "wx/dynlib.h"
#include "wx/scopedarray.h"
@@ -2339,46 +2338,6 @@ inline wxListView* GETLB(WindowID win) {
//----------------------------------------------------------------------
class ListBoxImpl : public ListBox {
private:
int lineHeight;
bool unicodeMode;
int desiredVisibleRows;
int aveCharWidth;
size_t maxStrWidth;
Point location; // Caret location at which the list is opened
wxImageList* imgList;
wxArrayInt* imgTypeMap;
public:
ListBoxImpl();
~ListBoxImpl();
static ListBox *Allocate();
virtual void SetFont(Font &font) wxOVERRIDE;
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_) wxOVERRIDE;
virtual void SetAverageCharWidth(int width) wxOVERRIDE;
virtual void SetVisibleRows(int rows) wxOVERRIDE;
virtual int GetVisibleRows() const wxOVERRIDE;
virtual PRectangle GetDesiredRect() wxOVERRIDE;
virtual int CaretFromEdge() wxOVERRIDE;
virtual void Clear() wxOVERRIDE;
virtual void Append(char *s, int type = -1) wxOVERRIDE;
void Append(const wxString& text, int type);
virtual int Length() wxOVERRIDE;
virtual void Select(int n) wxOVERRIDE;
virtual int GetSelection() wxOVERRIDE;
virtual int Find(const char *prefix) wxOVERRIDE;
virtual void GetValue(int n, char *value, int len) wxOVERRIDE;
virtual void RegisterImage(int type, const char *xpm_data) wxOVERRIDE;
void RegisterImageHelper(int type, wxBitmap& bmp);
virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) wxOVERRIDE;
virtual void ClearRegisteredImages() wxOVERRIDE;
virtual void SetDoubleClickAction(CallBackAction, void *) wxOVERRIDE;
virtual void SetList(const char* list, char separator, char typesep) wxOVERRIDE;
};
ListBoxImpl::ListBoxImpl()
: lineHeight(10), unicodeMode(false),
desiredVisibleRows(5), aveCharWidth(8), maxStrWidth(0),
@@ -2542,7 +2501,7 @@ void ListBoxImpl::GetValue(int n, char *value, int len) {
value[len-1] = '\0';
}
void ListBoxImpl::RegisterImageHelper(int type, wxBitmap& bmp)
void ListBoxImpl::RegisterImageHelper(int type, const wxBitmap& bmp)
{
if (! imgList) {
// assumes all images are the same size