Skip to content

How do you pass xpm data into wxStyledTextCtrl MarkerDefinePixmap call? #1186

@greatwolf

Description

@greatwolf

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:

userdata : A pointer to a C/C++ object.

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.

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 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions