Index: trunk/src/gui/gui_style.cc
===================================================================
--- trunk/src/gui/gui_style.cc	(revision 433)
+++ trunk/src/gui/gui_style.cc	(revision 440)
@@ -7,4 +7,5 @@
 #include "nv/gui/gui_style.hh"
 
+#include "nv/gui/gui_environment.hh"
 #include <nv/lua/lua_raw.hh>
 
@@ -12,25 +13,23 @@
 using namespace nv::gui;
 
-style::style()
-{
-}
-
 void style::load_style( const string_view& filename )
 {
+	NV_ASSERT_ALWAYS( m_env, "Environment not set in style!" );
 	m_lua.do_file( filename );
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, std::string& s )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, string128& s )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TSTRING ) ) return false;
-	s = lua_tostring( m_lua, -1 );
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TSTRING ) ) return false;
+	// TODO: create lua_tostringbuffer< size >
+	s.assign( lua_tostring( m_lua, -1 ) );
 	return true;
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, vec4& vec )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, vec4& vec )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TTABLE ) ) return false;
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TTABLE ) ) return false;
 	vec = vec4();
 	for ( int i = 0; i < 4; ++i )
@@ -44,16 +43,16 @@
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, int& i )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, int& i )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TNUMBER ) ) return false;
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TNUMBER ) ) return false;
 	i = static_cast< int >( lua_tointeger( m_lua, -1 ) );
 	return true;
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, double& d )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, double& d )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TNUMBER ) ) return false;
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TNUMBER ) ) return false;
 	d = lua_tonumber( m_lua, -1 );
 	return true;
@@ -64,14 +63,14 @@
 }
 
-bool style::find_entry( const char* cselector, const char* centry, int type )
+bool style::find_entry( const string_view& cselector, const string_view& centry, int type )
 {
 	if ( lua_istable( m_lua, -1 ) )
 	{
-		if ( cselector )
+		if ( !cselector.empty() )
 		{
-			lua_getfield( m_lua, -1, cselector );
+			lua_getfield( m_lua, -1, cselector.data() );
 			if ( lua_istable( m_lua, -1 ) )
 			{
-				lua_getfield( m_lua, -1, centry );
+				lua_getfield( m_lua, -1, centry.data() );
 				if ( lua_type( m_lua, -1 ) == type ) 
 				{
@@ -83,5 +82,5 @@
 		}
 
-		lua_getfield( m_lua, -1, centry );
+		lua_getfield( m_lua, -1, centry.data() );
 		if ( lua_type( m_lua, -1 ) == type ) return true;
 	}
@@ -89,5 +88,5 @@
 }
 
-bool style::resolve( const char* cid, const char* cclass, const char* cselector, const char* centry, int type )
+bool style::resolve( shash64 cid, shash64 cclass, const string_view& cselector, const string_view& centry, int type )
 {
 	lua_getglobal( m_lua, "default" );
@@ -95,12 +94,19 @@
 
 	// check id
-	lua_getfield( m_lua, -1, cid );
-	if ( find_entry( cselector, centry, type ) ) return true;
-	lua_settop( m_lua, global );
-
+	string_view id( m_env->get_string( cid ) );
+	if ( !id.empty() )
+	{
+		lua_getfield( m_lua, -1, id.data() );
+		if ( find_entry( cselector, centry, type ) ) return true;
+		lua_settop( m_lua, global );
+	}
 	// check class
-	lua_getfield( m_lua, -1, cclass );
-	if ( find_entry( cselector, centry, type ) ) return true;
-	lua_settop( m_lua, global );
+	string_view klass( m_env->get_string( cclass ) );
+	if ( !klass.empty() )
+	{
+		lua_getfield( m_lua, -1, klass.data() );
+		if ( find_entry( cselector, centry, type ) ) return true;
+		lua_settop( m_lua, global );
+	}
 
 	// check entry
