diff --git a/src/client/panels/ConnectionPanel.h b/src/client/panels/ConnectionPanel.h index 24dda2b61473a1abe66eb89a9082adf799b7a797..db1d31f59dd4c1371a8e587708afbf7d45791407 100644 --- a/src/client/panels/ConnectionPanel.h +++ b/src/client/panels/ConnectionPanel.h @@ -4,24 +4,53 @@ #include <wx/wx.h> #include "../uiElements/InputField.h" - +/** + * @brief A custom wxPanel for handling server connection input and UI. +* This panel provides fields for entering the server address, port, and player name. + * It also includes a background image and a "Connect" button. + */ class ConnectionPanel : public wxPanel { public: + /** + * @brief Constructs Connection Panel + * @param parent Pointer to the parent wxWindow that contains this window + */ ConnectionPanel(wxWindow* parent); + /** + * @brief Retrieves the server address entered by the user (default is set to 127.0.0.1). + * @return The server address as a wxString. + */ wxString getServerAddress(); + /** + * @brief Retrieves the server port entered by the user (default is set to 50505). + * @return The server port as a wxString. + */ wxString getServerPort(); + /** + * @brief Retrieves the player name entered by the user. + * The player name is entered in an input field and is used for gameplay identification. + * @return The player name as a wxString. + */ wxString getPlayerName(); private: + /** + * @brief Handles the paint event to draw the background image. + * @param event The wxPaintEvent triggered by the paint action. + */ void OnPaint(wxPaintEvent& event); + /** + * @brief Handles the resize event to adjust layout and widget sizes. + * @param event The wxSizeEvent triggered by the resize action. + */ void OnSize(wxSizeEvent& event); - wxBitmap _backgroundImage; - InputField* _serverAddressField; - InputField* _serverPortField; - InputField* _playerNameField; + wxBitmap _backgroundImage; ///< Bitmap for the background image of the panel + InputField* _serverAddressField; ///< Input field for enterng the server address + InputField* _serverPortField; ///< Input field for entering the server port + InputField* _playerNameField; ///< Input field for entering the player name }; diff --git a/src/client/panels/TrickEstimationPanel.h b/src/client/panels/TrickEstimationPanel.h index 635e75c4109915a3d940c78093c6c896a5d4ef68..47cad9b78fa5d60a0ed0e2a2fe727a4ac458a79e 100644 --- a/src/client/panels/TrickEstimationPanel.h +++ b/src/client/panels/TrickEstimationPanel.h @@ -10,26 +10,78 @@ #include <wx/wx.h> #include <wx/gbsizer.h> +/** +* @brief The TrickEstimationPanel class handles the GUI layout and functionality for the trick estimation phase of the game. +* @class TrickEstimationPanel +*/ class TrickEstimationPanel : public wxPanel{ public: + /** + * @brief Constructor for TrickEstimationPanel. + * @param parent Pointer to the parent window. + */ TrickEstimationPanel(wxWindow* parent); + /** + * @brief Destructor for TrickEstimationPanel. + */ ~TrickEstimationPanel(); + /** + * @brief Gets the trick estimate entered by the player. + * @return A wxString containing the entered trick estimate. + */ wxString getTrickEstimate(); + /** + * @brief Builds the game state for the trick estimation phase. + * @param gameState Pointer to the current game state. + * @param me Pointer to the player being the current user. + */ void buildGameState(game_state* gameState, player* me); private: - wxSize const panelSize = wxSize(1200, 850); - wxSize const cardSize = wxSize(85, 131); + wxSize const panelSize = wxSize(1200, 850); ///< panel size used for layout calculations + wxSize const cardSize = wxSize(85, 131); ///< size of displayed cards + /** + * @brief builds center panel showing round number and prediction sum + * @param sizer Pointer to the grid bag sizer used for the layout + * @param gameState Pointer to the current game state + */ void buildCenter(wxGridBagSizer* sizer, game_state* gameState); + /** + * @brief Displays trump card + * @param sizer Pointer to the grid bag sizer used for the layout + * @param gameState Pointer to the current game state + */ void buildTrumpColor(wxGridBagSizer* sizer, game_state* gameState); + /** + * Displays hand of player being the user + * @param sizer Pointer to the grid bag sizer used for the layout + * @param gameState Pointer to the current game state + * @param me Pointerto the player being the user + */ void buildHand(wxGridBagSizer* sizer, game_state* gameState, player* me); + /** + * @brief Displays name and estimated tricks of the player being the user + * @param sizer Pointer to the grid bag sizer used for the layout + * @param gameState Pointer to the current game state + * @param me Pointer to the player being the user + */ void buildThisPlayer(wxGridBagSizer* sizer, game_state* gameState, player* me); + /** + * @brief Displays name and estimated tricks of the players not being the user + * @param sizer Pointer to the grid bag sizer used for the layout + * @param gameState Pointer to the current game state + * @param myPosition Index of the player being the user in the player list. + */ void buildOtherPlayers(wxGridBagSizer* sizer, game_state* gameState, int myPosition); - + /** + * @brief Builds scoreboard and leave game button + * @param sizer Pointer to the grid bag sizer used for the layout + * @param gameState Pointer to the current game state + */ void buildScoreLeaveButtons(wxGridBagSizer* sizer, game_state* gameState); - InputField* _trickEstimateField; + InputField* _trickEstimateField; ///< input field for entering trick estimates }; #endif //TRICKESTIMATIONPANEL_H