开发者

c/gtk convert structure to the type of GtkWindow

开发者 https://www.devze.com 2023-01-03 17:32 出处:网络
I have the following structure, typedef struct _MainWin { GtkWindow parent; GtkWidget* scroll; GtkWidget* box;

I have the following structure,

    typedef struct _MainWin
    {
        GtkWindow parent;
        GtkWidget* scroll;
        GtkWidget* box;
    }MainWin;

I have created the application main window from this structure. Now I need the main window in full screen开发者_运维问答. When I tried to call,

gtk_window_fullscree(GTK_WINDOW(mw);

Where mw is object of MainWin. I got the following error message gtk_window_fullscreen: assertionGTK_IS_WINDOW (window)' failed`

How can I lead mw to GtkWindow?

Thank you.


What they did in the Viewnior code that you posted is to make a subclass of GtkWindow. You have copied part of the code to do that properly, but not all of it. You should read the tutorial part of the GObject documentation on how to define new classes. You can find it online here.


This seems wrong. Your GtkWindow should be a pointer too, and created using gtk_window_new() like any other GTK+ widget. This looks like you're trying to "subclass" the GtkWindow struct, which I don't think you can do like this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号