UI Widget drawing in order
<p>I have a custom UI Widget library I've created for a game I'm working on. I need to consider drawing order and retro fit it into what I currently have and not sure of the best way to do so. I have a UI class which loads the widgets from an xml file. It stores all widgets in a map where the key is the string name of the widget.</p>

<p>Widgets can hold other Widgets in a parent child relationship (so the Widget class has a map of Widgets where the name is the key again). When I draw I loop through the UI widget map and only call the Widget's Draw() function's that don't have parents (most top level). Within each Widget's Draw() it loops through it's children and calls their Draw() functions.</p>

<p>The question is what would be a good way to have a sort order variable for each widget work with drawing in the order of the sort order variable while keeping the maps, since I like the ease of finding widgets by the string key name?</p>

<p>Any ideas?</p>
