Ignore:
Timestamp:
07/29/15 16:24:01 (10 years ago)
Author:
epyon
Message:
  • slowly fixing up gui
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/gui_style.cc

    r440 r444  
    114114        return false;
    115115}
     116
     117void nv::gui::style::load_flags( element* e )
     118{
     119        lua::stack_guard guard( m_lua );
     120        lua_getglobal( m_lua, "default" );
     121        int global = lua_gettop( m_lua );
     122
     123        // check id
     124        string_view id( m_env->get_string( e->m_id ) );
     125        if ( !id.empty() )
     126        {
     127                lua_getfield( m_lua, -1, id.data() );
     128                add_flags( e );
     129                lua_pop( m_lua, -1 );
     130        }
     131        // check class
     132        string_view klass( m_env->get_string( e->m_class ) );
     133        if ( !klass.empty() )
     134        {
     135                lua_getfield( m_lua, -1, klass.data() );
     136                add_flags( e );
     137                lua_pop( m_lua, -1 );
     138        }
     139        add_flags( e );
     140}
     141
     142void nv::gui::style::add_flags( element* e )
     143{
     144        if ( lua_istable( m_lua, -1 ) )
     145        {
     146                lua_getfield( m_lua, -1, "hover" );
     147                if ( lua_istable( m_lua, -1 ) )
     148                {
     149                        e->m_flags[DIRTY_HOVER] = true;
     150                }
     151                lua_pop( m_lua, 1 );
     152
     153                lua_getfield( m_lua, -1, "selected" );
     154                if ( lua_istable( m_lua, -1 ) )
     155                {
     156                        e->m_flags[DIRTY_SELECT] = true;
     157                }
     158                lua_pop( m_lua, 1 );
     159        }
     160}
Note: See TracChangeset for help on using the changeset viewer.