Re: How to ask if a widget is GtkMenuBar or GtkMenuItem



Havoc Pennington wrote:

Ignacio Nodal <inodal teleline es> writes:

Hi, i'm writing my own functions to create menus, submenus, etc.

In my function CreateMenu(GtkWidget* parent, gchar* label), I would
like to know if my "GtkWidget* parent" parameter is either a
GtkMenuBar or a GtkMenuItem..

how can I ask this?


GTK_IS_MENU_BAR() and GTK_IS_MENU_ITEM()

The problem is parent is either a GtkMenuBar or a GtkMenuItem, so.. if I ask at the beginning of my function:

if (GTK_IS_MENU_ITEM(parent)) ...

and it's a GtkMenuBar I get a GTK-Critical:


Gtk-WARNING **: invalid class type `(unknown)' in cast to `GtkMenuItem'

Gtk-CRITICAL **: file gtkmenuitem.c: line 241 (gtk_menu_item_set_submenu): assertion `GTK_IS_MENU_ITEM (menu_item)' failed.


How should I ask?

Thanks again




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]