i've used it in few projects but i can't say i invented it
http://gamedevgeek.com/tutorials/man...e-states-in-c/
check out the 'stack of states' thing - really usefull for menus