You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure whether to ask this on here or on wxLua. I'm trying to change the way the breakpoint icon looks on the left margin gutter of the editor and it looks like SCI_MARKERDEFINEPIXMAP is what I'm after.
A metatable (see Lua documentation) may be assigned to it to allow it to act as a table or be called as a function, among other things.
wxLua uses userdata types to wrap the wxWidgets C++ objects to make them useable in a Lua program.
Those examples turn xpm, represented as a table from the lua side, into a wxBitmap and then wxIcon. But using wxBitmap and wxIcon is not a suitable userdata because MarkerDefinePixmap wants to turn it into a const char* const*. I've tried passing it in as a plain lua string, as a lua table, wxBitmap, wxIcon. None of it seems to work.
It feels like I'm missing something simple but what actually is the suitable userdata I should be using here?
The text was updated successfully, but these errors were encountered:
I suspect you may be right, as it looks like a direct translation of the API without a good way to provide that parameter. In fact, other interface files have comments to the effect that wxlua doesn't handle const char* const* parameters.
Would using MarkerDefineRGBAImage or MarkerDefineBitmap work (the latter is not available with wxwidgets 3.1.3+)?
I think it will be better to change MarkerDefinePixmap(int markerNumber, const char* const* xpmData); to MarkerDefinePixmap(int markerNumber, const char* xpmData); to allow passing a string with xpmData content.
I'll have to take a look at MarkerDefineRGBAImage and MarkerDefineBitmap -- those could probably work. I was looking at MarkerDefinePixmap because scintilla provides some icons https://www.scintilla.org/Icons.html and they're in xpm format.
That said, the current MarkerDefinePixmap does seem like a design defect if there isn't a convenient way to use it from lua side. Changing it to accept either a lua string or lua table seems to make sense to me.
greatwolf
changed the title
How do you past xpm data into wxStyledTextCtrl MarkerDefinePixmap call?
How do you pass xpm data into wxStyledTextCtrl MarkerDefinePixmap call?
Sep 10, 2024
I'm not sure whether to ask this on here or on wxLua. I'm trying to change the way the breakpoint icon looks on the left margin gutter of the editor and it looks like
SCI_MARKERDEFINEPIXMAP
is what I'm after.The corresponding wxlua binding is here https://github.com/pkulchenko/wxlua/blob/4d83c8d44eeccf88683ca0146a13b16d0b0d4264/wxLua/bindings/wxwidgets/wxstc_override.hpp#L86.
What's unclear to me is how to actually pass in that xpm data as
const char **
from the lua side. Been banging my head against the wall trying to figure this out. I looked at https://github.com/pkulchenko/wxlua/blob/master/wxLua/docs/binding.md and https://github.com/pkulchenko/wxlua/blob/master/wxLua/docs/wxlua.md. Closest thing I could find is this section:I also looked at some of the wxlua samples like https://github.com/pkulchenko/wxlua/blob/4d83c8d44eeccf88683ca0146a13b16d0b0d4264/wxLua/samples/calculator.wx.lua#L242 and https://github.com/pkulchenko/wxlua/blob/4d83c8d44eeccf88683ca0146a13b16d0b0d4264/wxLua/samples/catch.lua#L601 hoping for some usage hints.
Those examples turn xpm, represented as a table from the lua side, into a
wxBitmap
and thenwxIcon
. But usingwxBitmap
andwxIcon
is not a suitableuserdata
becauseMarkerDefinePixmap
wants to turn it into aconst char* const*
. I've tried passing it in as a plain lua string, as a lua table,wxBitmap
,wxIcon
. None of it seems to work.It feels like I'm missing something simple but what actually is the suitable userdata I should be using here?
The text was updated successfully, but these errors were encountered: