Index: /trunk/nv/gui/gui_common.hh
===================================================================
--- /trunk/nv/gui/gui_common.hh	(revision 66)
+++ /trunk/nv/gui/gui_common.hh	(revision 66)
@@ -0,0 +1,36 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+ * @file gui_common.hh
+ * @author Kornel Kisielewicz
+ * @brief common GUI
+ */
+
+#ifndef NV_GUI_COMMON_HH
+#define NV_GUI_COMMON_HH
+
+#include <nv/object.hh>
+
+namespace nv
+{
+	namespace gui
+	{
+		enum alignment
+		{
+			ALIGN_TOP,
+			ALIGN_BOTTOM,
+			ALIGN_CENTER,
+			ALIGN_SCALE,
+			ALIGN_LEFT = ALIGN_TOP,
+			ALIGN_RIGHT = ALIGN_BOTTOM,
+		};
+
+	} // namespace gui
+
+} // namespace nv
+
+#endif // NV_GUI_ELEMENT_HH
Index: /trunk/nv/gui/gui_element.hh
===================================================================
--- /trunk/nv/gui/gui_element.hh	(revision 66)
+++ /trunk/nv/gui/gui_element.hh	(revision 66)
@@ -0,0 +1,55 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+ * @file gui_element.hh
+ * @author Kornel Kisielewicz
+ * @brief GUI Element
+ */
+
+#ifndef NV_GUI_ELEMENT_HH
+#define NV_GUI_ELEMENT_HH
+
+#include <nv/object.hh>
+#include <nv/position.hh>
+
+namespace nv
+{
+	namespace gui
+	{
+
+		class element : public object
+		{
+		public:
+			element() : object() {}
+			element( root* aroot, const rectangle r );
+			element* get_element( const position& p );
+			virtual void on_update( uint32 elapsed );
+			virtual void on_draw();
+			// bool on_event( event );
+			bool contains( const position& p ) const;
+			virtual void set_relative( const rectangle& r );
+			virtual void set_relative( const position& p );
+			virtual const rectangle& get_relative() const { return m_relative; }
+			virtual const rectangle& get_absolute() const { return m_absolute; }
+			virtual element* get_parent() const { return (element*)m_parent; }
+			virtual bool is_enabled() const { return m_enabled; }
+			virtual bool is_visible() const { return m_visible; }
+			virtual void set_enabled( bool value ) { m_enabled = value; }
+			virtual void set_visible( bool value ) { m_visible = value; }
+			virtual void recalculate_absolute();
+		protected:
+			rectangle m_relative;
+			rectangle m_absolute;
+			bool m_enabled;
+			bool m_visible;
+		};
+
+	} // namespace gui
+
+} // namespace nv
+
+#endif // NV_GUI_ELEMENT_HH
Index: /trunk/nv/object.hh
===================================================================
--- /trunk/nv/object.hh	(revision 65)
+++ /trunk/nv/object.hh	(revision 66)
@@ -129,5 +129,5 @@
 		 * @returns parent object of current object
 		 */
-		object* get_parent() const { return m_parent; }
+		virtual object* get_parent() const { return m_parent; }
 
 		/**
@@ -140,4 +140,18 @@
 		 */
 		int get_lua_index() const { return m_lua_index; }
+
+		/**
+		 * Moves object to back of child list (top of stack)
+		 *
+		 * @returns true if object found, false otherwise
+		 */
+		bool move_to_top( object* child );
+
+		/**
+		 * Moves object to front of child list (bottom of stack)
+		 *
+		 * @returns true if object found, false otherwise
+		 */
+		bool move_to_bottom( object* child );
 
 		list::iterator begin() { return m_children.begin(); }
Index: /trunk/src/gui/gui_element.cc
===================================================================
--- /trunk/src/gui/gui_element.cc	(revision 66)
+++ /trunk/src/gui/gui_element.cc	(revision 66)
@@ -0,0 +1,89 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#include "nv/gui/gui_element.hh"
+
+using namespace nv;
+using namespace nv::gui;
+
+element::element( root* aroot, const rectangle r ) 
+	: object( aroot, "", 0 ), m_relative( r ), m_absolute( r ), m_enabled( true ), m_visible( true )
+{
+
+}
+
+void element::on_update( uint32 elapsed )
+{
+	if ( is_visible() )
+	{
+		for ( object* i : *this )
+		{
+			((element*)i)->on_update( elapsed );
+		}
+	}
+}
+
+void element::on_draw()
+{
+	if ( is_visible() )
+	{
+		for ( object* i : *this )
+		{
+			((element*)i)->on_draw();
+		}
+	}
+}
+
+element* element::get_element( const position& p )
+{
+	if ( !is_visible() ) return nullptr;
+
+	element* result = nullptr;
+	list::reverse_iterator it = m_children.rbegin();
+
+	while ( it != m_children.rend() )
+	{
+		result = ((element*)(*it))->get_element( p );
+		if ( result ) return result;
+		++it;
+	}
+
+	if ( contains( p ) ) return this;
+	return nullptr;
+}
+
+bool element::contains( const position& p ) const
+{
+	return m_absolute.contains( p );
+}
+
+void element::set_relative( const rectangle& r )
+{
+	m_relative = r;
+	recalculate_absolute();
+}
+
+void element::set_relative( const position& p )
+{
+	set_relative( rectangle( p, p + m_relative.get_size() ) );
+}
+
+void element::recalculate_absolute()
+{
+	rectangle pabsolute;
+
+	if ( m_parent )
+	{
+		pabsolute = ((element*)(m_parent))->m_absolute;
+	}
+
+	m_absolute = m_relative + pabsolute.upper_left;
+
+	for ( object* o : *this )
+	{
+		((element*)o)->recalculate_absolute();
+	}
+}
Index: /trunk/src/object.cc
===================================================================
--- /trunk/src/object.cc	(revision 65)
+++ /trunk/src/object.cc	(revision 66)
@@ -138,4 +138,28 @@
 }
 
+bool object::move_to_top( object* child )
+{
+	list::iterator it = std::find( m_children.begin(), m_children.end(), child );
+	if ( it != m_children.end() )
+	{
+		m_children.erase( it );
+		m_children.push_back( child );
+		return true;
+	}	
+	return false;
+}
+
+bool object::move_to_bottom( object* child )
+{
+	list::iterator it = std::find( m_children.begin(), m_children.end(), child );
+	if ( it != m_children.end() )
+	{
+		m_children.erase( it );
+		m_children.push_front( child );
+		return true;
+	}	
+	return false;
+}
+
 void object::register_type( type_database* db )
 {
