0
votes

Question:

How implement a custom wxSciter control properly and correctly place it inside standard wxWidgets controls? (so it can behave like a browser window)

SOLVED:

I got it solved after provided suggestions with:

class NativeWindow : public wxNativeWindow
{
public:
    explicit NativeWindow(wxWindow* parent)
        : wxNativeWindow()
    {

        GtkWidget* widget = SAPI()->SciterCreateWindow(SW_CHILD, NULL, NULL, NULL, this->GetHandle());
        g_object_ref_sink(widget);

        // remove Sciter's GTK top-level container
        // to prevent "Can't set a parent on widget which has a parent"
        gtk_container_remove(GTK_CONTAINER(gwindow(widget)), widget);

        SAPI()->SciterLoadFile(widget, WSTR("http://linux.org.ru/"));

        (void)Create(parent, wxID_ANY, widget);
    }

    virtual ~NativeWindow()
    {
        Disown();
    }

};
1
Take a look at wxNativeWindow. It should give you everything you need. The documentation has an example of how to do that. But why do you need it? wxWidgets has wxWebView control which provides the Web interface to developer. And current GSoC has a project to further integrate JS in wx.Igor
Sciter is not exactly a real browser. It's a tiny-sized library that uses subset of HTML5 and subset of JavaScript with animations to write desktop application GUI. In contrast to wxWebView the browser engine is guaranteed to be the same on all platforms (Windows, macOS, GTK3, soon iOS and Android). Think of it as Qt's QML/QtQuick.Zelid

1 Answers

1
votes

wxNativeWindow normally should allow you to do what you need with very little effort. You can find a fuller example of using it than the one given in the docs in the widgets sample, see its GTK-specific part.