InternetMenu Class Reference

#include <internet_menu.h>

Inheritance diagram for InternetMenu:

Inheritance graph
[legend]
Collaboration diagram for InternetMenu:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 InternetMenu ()
 ~InternetMenu ()

Private Member Functions

void OnClic (const Point2i &mousePosition, int button)
void Draw (const Point2i &mousePosition)
void RefreshList ()
void __sig_ok ()
void __sig_cancel ()

Private Attributes

Fontnormal_font
Fontbig_font
VBoxconnection_box
ListBoxconnect_lst
ButtonTextrefresh
ButtonTextconnect

Detailed Description

Definition at line 30 of file internet_menu.h.


Constructor & Destructor Documentation

InternetMenu::InternetMenu (  ) 

Definition at line 33 of file internet_menu.cpp.

00033                            :
00034   Menu("menu/bg_network", vCancel)
00035 {
00036   Profile *res = resource_manager.LoadXMLProfile( "graphism.xml",false);
00037   Rectanglei rectZero(0, 0, 0, 0);
00038   
00039   normal_font = Font::GetInstance(Font::FONT_NORMAL);
00040   big_font = Font::GetInstance(Font::FONT_BIG);
00041 
00042   Rectanglei stdRect(0, 0, 300, 64);
00043 
00044   uint x_button = AppWormux::GetInstance()->video.window.GetWidth()/2 - stdRect.GetSizeX()/2;
00045   uint y_box = AppWormux::GetInstance()->video.window.GetHeight()/2 - 200;
00046 
00047   connection_box = new VBox(Rectanglei( x_button, y_box, stdRect.GetSizeX(), 1), false);
00048   connection_box->SetBorder(Point2i(0,0));
00049 
00050   connect_lst = new ListBox( Rectanglei(0, 0, stdRect.GetSizeX(), 300), false);
00051   connection_box->AddWidget(connect_lst);
00052 
00053   refresh = new ButtonText( Point2i(0,0),
00054                                  res, "main_menu/button",
00055                                  _("Refresh"), // Refresh the list of available hosts
00056                                  big_font);
00057   refresh->SetSizePosition( stdRect );
00058   connection_box->AddWidget(refresh);
00059 
00060   connect = new ButtonText( Point2i(0,0),
00061                                  res, "main_menu/button",
00062                                  _("Connect !"),
00063                                  big_font);
00064   connect->SetSizePosition( stdRect );
00065   connection_box->AddWidget(connect);
00066 
00067   widgets.AddWidget(connection_box);
00068 
00069   resource_manager.UnLoadXMLProfile(res);
00070   RefreshList();
00071 }

Here is the call graph for this function:

InternetMenu::~InternetMenu (  ) 

Definition at line 73 of file internet_menu.cpp.

00074 {
00075 }


Member Function Documentation

void InternetMenu::__sig_cancel (  )  [private, virtual]

Implements Menu.

Definition at line 131 of file internet_menu.cpp.

00132 {
00133 }

void InternetMenu::__sig_ok (  )  [private, virtual]

Implements Menu.

Definition at line 127 of file internet_menu.cpp.

00128 {
00129 }

void InternetMenu::Draw ( const Point2i mousePosition  )  [private, virtual]

Implements Menu.

Definition at line 125 of file internet_menu.cpp.

00125 {}

void InternetMenu::OnClic ( const Point2i mousePosition,
int  button 
) [private, virtual]

Implements Menu.

Definition at line 77 of file internet_menu.cpp.

00078 {     
00079   Widget* w = widgets.Clic(mousePosition, button);  
00080 
00081   if (w == refresh)
00082     RefreshList();
00083   else
00084   if (w == connect && connect_lst->GetSelectedItem() != -1)
00085   {
00086     network.Init();
00087     network.ClientConnect(connect_lst->ReadLabel(), connect_lst->ReadValue());
00088     if( network.IsConnected() )
00089     {
00090       close_menu = true;
00091       sig_ok();
00092     }
00093     else
00094     {
00095       Question question;
00096       question.Set(_("Unable to join the game..."),1,0);
00097       question.Draw();
00098     }
00099   }
00100 }

Here is the call graph for this function:

void InternetMenu::RefreshList (  )  [private]

Definition at line 102 of file internet_menu.cpp.

00103 {
00104   // Save the currently selected address
00105   int current = connect_lst->GetSelectedItem();
00106 
00107   // Empty the list:
00108   while( connect_lst->Size() != 0 )
00109   {
00110     connect_lst->Select(0);
00111     connect_lst->RemoveSelected();
00112   }
00113 
00114   std::list<address_pair> lst = index_server.GetHostList();
00115 
00116   for(std::list<address_pair>::iterator pair_it = lst.begin();
00117       pair_it != lst.end();
00118       ++pair_it)
00119     connect_lst->AddItem( false, pair_it->first, pair_it->second );
00120 
00121   if(current != -1)
00122     connect_lst->Select( current );
00123 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Font* InternetMenu::big_font [private]

Definition at line 33 of file internet_menu.h.

ButtonText* InternetMenu::connect [private]

Definition at line 38 of file internet_menu.h.

ListBox* InternetMenu::connect_lst [private]

Definition at line 36 of file internet_menu.h.

VBox* InternetMenu::connection_box [private]

Definition at line 35 of file internet_menu.h.

Font* InternetMenu::normal_font [private]

Definition at line 32 of file internet_menu.h.

ButtonText* InternetMenu::refresh [private]

Definition at line 37 of file internet_menu.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:53:39 2007 for Wormux by  doxygen 1.4.7