Skip to content

ButtonP Class Accessors and Mutators

Alex Ricciardi edited this page Feb 5, 2023 · 3 revisions
    //----------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------

    // Accessors Methods
    //----------------------------------------------------------------------------------


    /*----------------------------------------------------

        draw button

     -----------------------------------------------------*/
    void draw();


    //----------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------

    // Mutators Methods
    //---------------------------------------------------------------------------------


    /*----------------------------------------------------

        Updates button

     -----------------------------------------------------*/
    int update();


    /*----------------------------------------------------

        Sets font size and
        Resizes button to fit text
        Takes a string

     -----------------------------------------------------*/
    void setFontSize(float fontSize);

    /*----------------------------------------------------

        Sets font size and
        does NOT resizes button to fit text
        Takes a string

     -----------------------------------------------------*/
    void setFontSizeNoResize(float fontSize);

    /*----------------------------------------------------

         Sets text and
         Resizes button to fit text
         Takes a string

     -----------------------------------------------------*/
    void setText(string text);

    /*----------------------------------------------------

         Sets text and
         does NOT resizes button to fit text
         Takes a string

     -----------------------------------------------------*/
    void setTextNoResize(string text);

    /*----------------------------------------------------

         Sets text position
         does NOT resizes button to fit text

     -----------------------------------------------------*/
    void setTextPosition(float x, float y);   

    /*----------------------------------------------------

        Sets the hover color for button and text

     -----------------------------------------------------*/
    void setHoverColor(Color btnHoverColor);

    /*----------------------------------------------------

        Sets the pressed color for the button and text

     -----------------------------------------------------*/
    void setPressedColor(Color btnPressedColor);

    /*----------------------------------------------------

        Sets the button position on the screen

     -----------------------------------------------------*/
    void setBtnPosition(float btnX, float btnY);
    /*----------------------------------------------------

        Sets sizes of the button,
        does not resize fonts

     -----------------------------------------------------*/
    void setBtnSize(float btnWidth, float btnHeight);

private:


    //----------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------

    // Classe Operation Methods (private)
    //---------------------------------------------------------------------------------


    /*----------------------------------------------------------

        Builds the botton,
        computes size from the font size and length of the text

     -----------------------------------------------------------*/
    void buildBtn();