File indexing completed on 2024-05-12 17:05:49

0001 /*
0002     this file is part of the oxygen gtk engine
0003     SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "oxygenmenuitemengine.h"
0009 #include <iostream>
0010 
0011 namespace Oxygen
0012 {
0013 
0014     //_______________________________________________________________
0015     bool MenuItemEngine::registerMenu( GtkWidget* parent )
0016     {
0017 
0018         // check widget
0019         if( !GTK_IS_MENU( parent ) ) return false;
0020 
0021         // keep track of added children
0022         bool found( false );
0023 
0024         // get children
0025         GList* children( gtk_container_get_children( GTK_CONTAINER( parent ) ) );
0026         for( GList *child = g_list_first( children ); child; child = g_list_next( child ) )
0027         {
0028             if( !GTK_IS_MENU_ITEM( child->data ) ) continue;
0029             GtkWidget* widget( gtk_bin_get_child( GTK_BIN( child->data ) ) );
0030             if( registerWidget( widget ) ) found = true;
0031         }
0032 
0033         // free list of children
0034         if( children ) g_list_free( children );
0035 
0036         return found;
0037 
0038     }
0039 
0040 }