
// Stack used to track what gui thread we are viewing
new SimSet(menu_thread_stack);

// Define various topic threads
new SimSet(main_menu_thread);
   main_menu_thread.add(MainMenuDlg);

new SimSet(play_minigame_menu_thread);
   play_minigame_menu_thread.add(PlayMinigameDlg);   

new SimSet(overview_thread);
   //overview_thread.add(overview_main);

new SimSet(new_player_menu_thread);
   new_player_menu_thread.add(NewPlayerMenuDlg);

new SimSet(select_player_menu_thread);
   select_player_menu_thread.add(SelectPlayerMenuDlg);
   
//new SimSet(map_menu_thread);
//   map_menu_thread.add(MapGui);   
   
new SimSet(loadlevel_menu_thread);
   loadlevel_menu_thread.add(LoadLevelGui);
   
new SimSet(award_room_thread);
   award_room_thread.add(AwardRoom);   
   
new SimSet(options_menu_thread);
   options_menu_thread.add(OptionsMenuDlg);

new SimSet(instructions_menu_thread);
   instructions_menu_thread.add(InstructionsMenuDlg);

new SimSet(credits_menu_thread);
   credits_menu_thread.add(CreditsMenuDlg);

package AutoLoad_GuiMLTextCtrl_Contents
{
   function GuiMLTextCtrl::onWake(%this)
   {
      if (%this.filename !$= "")
      {
         %file = expandFileName(%this.filename);
         
         %fo = new FileObject();
         %fo.openForRead(%file);
         %text = "";
         while(!%fo.isEOF())
            %text = %text @ %fo.readLine() @ "\n";
            
         %text = strreplace(%text, "~", $defaultGame);

         %fo.delete();
         %this.setText(%text);
      }
      //parent::onWake(%this);
   }

   function gotoWebPage(%url)
   {
      if(isFullScreen())
         toggleFullScreen();
      Parent::gotoWebPage(%url);
   }

   function GuiMLTextCtrl::onURL(%this, %url)
   {
      if (getSubStr(%url, 0, 9) $= "gamelink ")
         eval( getSubStr(%url, 9, 1024) );
      else
         gotoWebPage( %url );
   }   

};

activatePackage(AutoLoad_GuiMLTextCtrl_Contents);

