Zelid
Zelid

Reputation: 7195

wxWidgets: integrate custom GTK+ widget

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();
    }

};

Upvotes: 0

Views: 244

Answers (1)

VZ.
VZ.

Reputation: 22678

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.

Upvotes: 1

Related Questions