Commit 4045e710 authored by Hugo Pereira Da Costa's avatar Hugo Pereira Da Costa
Browse files

Register all GtkMenuItems to MenuItemEngine via their parent menu, the first time it is shown.

CCBUG: 299321
parent a38ad409
......@@ -18,6 +18,7 @@ set( oxygen_gtk_SOURCES
animations/oxygenmainwindowdata.cpp
animations/oxygenmenubarstatedata.cpp
animations/oxygenmenustatedata.cpp
animations/oxygenmenuitemengine.cpp
animations/oxygenmenuitemdata.cpp
animations/oxygenpaneddata.cpp
animations/oxygensignal.cpp
......
/*
* this file is part of the oxygen gtk engine
* Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or(at your option ) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "oxygenmenuitemengine.h"
#include <iostream>
namespace Oxygen
{
//_______________________________________________________________
bool MenuItemEngine::registerMenu( GtkWidget* parent )
{
// check widget
if( !GTK_IS_MENU( parent ) ) return false;
// keep track of added children
bool found( false );
// get children
GList* children( gtk_container_get_children( GTK_CONTAINER( parent ) ) );
for( GList *child = g_list_first( children ); child; child = g_list_next( child ) )
{
if( !GTK_IS_MENU_ITEM( child->data ) ) continue;
GtkWidget* widget( gtk_bin_get_child( GTK_BIN( child->data ) ) );
if( registerWidget( widget ) ) found = true;
}
// free list of children
if( children ) g_list_free( children );
return found;
}
}
......@@ -51,6 +51,9 @@ namespace Oxygen
virtual ~MenuItemEngine( void )
{}
//! register all menuItems children of a menu
virtual bool registerMenu( GtkWidget* );
};
}
......
......@@ -1043,6 +1043,9 @@ namespace Oxygen
// add mask if needed
if( GTK_IS_MENU(widget) )
{
Style::instance().animations().menuItemEngine().registerMenu( widget );
GdkWindow* window( gtk_widget_get_parent_window(widget) );
if( !(options&Alpha) )
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment