/* $Id: serverlistwindow.hpp,v 1.13 2005/07/17 17:27:31 chfreund Exp $ */ #ifndef _SERVERLISTWINDOW_HPP_ #define _SERVERLISTWINDOW_HPP_ #include #include #include #include #include "clientcommunicator.hpp" #include "serverentry.hpp" #include "tcpconnection.hpp" #include "wopwindow.hpp" // #include "loader.hpp" #include "widget.h" #include "action.h" #include "textlabel.h" #include "button.h" using namespace SDLwidgets; class ServerListWindow : public WopWindow, public ActionWidget, public ActionListener { public: enum Action { ITEM_SELECTED, REFRESH_PRESSED, CONNECT_PRESSED, BACK_PRESSED }; private: Uint32 m_width, m_height; std::vector m_entries; std::vector m_labels; std::vector m_buttons; BackgroundWidget* m_background; WidgetComposite* m_content; TextLabel* m_searchLabel; TextLabel* m_header[3]; WidgetComposite* m_entriesContainer; WidgetComposite* m_buttonRow; TextButton* m_updateButton; TextButton* m_connectButton; TextButton* m_backButton; SDL_Color m_normalBackground, m_highlightBackground; SDL_Color m_labelColor, m_buttonColor; int m_selectedIndex; public: ServerListWindow( Uint32 width, Uint32 height ); ~ServerListWindow(); void clearEntries(); void setEntries( std::vector& entries ); void actionPerformed( Uint32 cmd, void* source ); bool handleEvent( SDL_Event* event ); int getSelectedIndex() const { return m_selectedIndex; } ServerEntry* getSelectedServer() { return m_entries[m_selectedIndex]; } }; #endif // _SERVERLISTWINDOW_HPP_