+public:
+
+ switch_thru_all_uis () : m_iter (ui_list), m_save_ui (¤t_ui)
+ {
+ current_ui = ui_list;
+ }
+
+ /* If done iterating, return true; otherwise return false. */
+ bool done () const
+ {
+ return m_iter == NULL;
+ }
+
+ /* Move to the next UI, setting current_ui if iteration is not yet
+ complete. */
+ void next ()
+ {
+ m_iter = m_iter->next;
+ if (m_iter != NULL)
+ current_ui = m_iter;
+ }
+
+ private:
+
+ /* No need for these. They are intentionally not defined
+ anywhere. */
+ switch_thru_all_uis &operator= (const switch_thru_all_uis &);
+ switch_thru_all_uis (const switch_thru_all_uis &);
+
+ /* Used to iterate through the UIs. */
+ struct ui *m_iter;
+
+ /* Save and restore current_ui. */
+ scoped_restore_tmpl<struct ui *> m_save_ui;