My Project
|
Button. More...
#include <Button.h>
Public Member Functions | |
CButton (SallyAPI::GUI::CGUIBaseObject *parent, int x, int y, int width, int height, int controlId=0, ButtonType type=BUTTON_TYPE_NORMAL) | |
Constructor. | |
virtual | ~CButton () |
Destructor. | |
virtual void | Timer (float timeDelta) |
Timers. | |
bool | GetCheckStatus () |
Gets the check status. | |
void | SetCheckStatus (bool value) |
Sets a check status. | |
void | SetActive (bool set) |
Sets the button active flag. | |
bool | GetActive () |
Gets the active flag. | |
void | SetDefaultButton (bool value) |
Sets a default button. Set this flag to true to make it a default button. A default button is displayed eye-catching. | |
bool | GetDefaultButton () |
Gets the default button. | |
void | SetImageLeft () |
Sets draw the image on the left side of the button. | |
void | SetImageRight () |
Sets draw the image on the right side of the button. | |
void | SetImageId (int image) |
Sets an image identifier. If you wan't to remove the image set GUI_NO_IMAGE. | |
bool | IsUseHoleWidth () |
Query if this object is use hole width. | |
void | UseHoleWidth (bool use) |
Set use hole width for text draw. Usually a button has a border on the left and on the right. The thickness of the border depends on the theme used. If you set this value to true there will be no border. This flag should be used with align center. | |
void | SetFourTexts (int i, const std::string &text) |
Sets text if the button is from the type BUTTON_TYPE_FOUR_TEXTS. | |
std::string | GetFourTexts (int i) |
Gets a four texts. | |
void | SetFourTextActive (int i) |
Sets a four text active. | |
virtual void | SetImageText (const std::string &text) |
Sets the text which is printed over the image. | |
virtual std::string | GetImageText () |
Gets the text which is printed over the image. | |
virtual void | SetImageTextColor (D3DCOLOR rgbFontColour) |
Sets the font color of the image text. | |
virtual bool | IsImageTextLocalised () |
Query if this object is image text localised. | |
virtual void | SetImageTextLocalised (bool localised) |
Sets an image text localised. | |
Protected Member Functions | |
void | DrawImageText (int x, int y, int width, int height) |
Draw the text ovver the image set to the control. | |
void | DrawFourTextItem (RECT r, const std::string &text, bool active, int itemNumber=-1, bool pressed=false) |
Draw four text item. | |
virtual void | RenderControl () |
Renders a control. | |
virtual bool | ProcessMouseUp (int x, int y) |
Process a mouse up. The button sends a GUI_BUTTON_CLICKED message to his parent. | |
virtual bool | ProcessMouseMove (int x, int y) |
Process a mouse move. | |
Protected Attributes | |
int | m_iImage |
std::string | m_strImageText |
bool | m_bImageTextLocalised |
D3DCOLOR | m_rgbImageFontColour |
ButtonType | m_eType |
int | m_iImageSize |
Not valide for BUTTON_TYPE_ONLY_IMAGE. | |
bool | m_bImageLeft |
Not valide for BUTTON_TYPE_ONLY_IMAGE. | |
bool | m_bChecked |
Not valide for BUTTON_TYPE_ONLY_IMAGE. | |
bool | m_bActive |
Not valide for BUTTON_TYPE_ONLY_IMAGE. | |
bool | m_bDefaultButton |
Not valide for BUTTON_TYPE_ONLY_IMAGE. | |
float | m_fDeltaStart |
bool | m_bUseHoleWidth |
Only valide for BUTTON_TYPE_NORMAL. | |
std::string | m_strFourTexts [4] |
Only valide for BUTTON_TYPE_FOUR_TEXTS. | |
int | m_iFourTextsActive |
Only valide for BUTTON_TYPE_FOUR_TEXTS. |
Button.
CButton::CButton | ( | SallyAPI::GUI::CGUIBaseObject * | parent, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
int | controlId = 0 , |
||
ButtonType | type = BUTTON_TYPE_NORMAL |
||
) |
Constructor.
m_iImageSize(ICON_SIZE), m_bChecked(false), m_bActive(false), m_fDeltaStart(0), m_bDefaultButton(false), m_bUseHoleWidth(false)
[in,out] | parent | If non-null, the parent. |
x | The x coordinate. | |
y | The y coordinate. | |
width | The width. | |
height | The height. | |
controlId | Identifier for the control. | |
type | The type. |
CButton::~CButton | ( | ) | [virtual] |
Destructor.
void CButton::DrawFourTextItem | ( | RECT | r, |
const std::string & | text, | ||
bool | active, | ||
int | itemNumber = -1 , |
||
bool | pressed = false |
||
) | [protected] |
Draw four text item.
r | The. |
text | The text. |
active | true to active. |
itemNumber | The item number. |
pressed | true to pressed. |
void CButton::DrawImageText | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) | [protected] |
Draw the text ovver the image set to the control.
x | The x coordinate. |
y | The y coordinate. |
width | The width. |
height | The height. |
bool CButton::GetActive | ( | ) |
Gets the active flag.
bool CButton::GetCheckStatus | ( | ) |
Gets the check status.
bool CButton::GetDefaultButton | ( | ) |
Gets the default button.
std::string CButton::GetFourTexts | ( | int | i | ) |
Gets a four texts.
i | The index. |
std::string CButton::GetImageText | ( | ) | [virtual] |
Gets the text which is printed over the image.
bool CButton::IsImageTextLocalised | ( | ) | [virtual] |
Query if this object is image text localised.
bool CButton::IsUseHoleWidth | ( | ) |
Query if this object is use hole width.
bool CButton::ProcessMouseMove | ( | int | x, |
int | y | ||
) | [protected, virtual] |
Process a mouse move.
x | The x coordinate. |
y | The y coordinate. |
Reimplemented from SallyAPI::GUI::CControl.
bool CButton::ProcessMouseUp | ( | int | x, |
int | y | ||
) | [protected, virtual] |
Process a mouse up. The button sends a GUI_BUTTON_CLICKED message to his parent.
x | The x coordinate. |
y | The y coordinate. |
Reimplemented from SallyAPI::GUI::CControl.
void CButton::RenderControl | ( | ) | [protected, virtual] |
Renders a control.
Implements SallyAPI::GUI::CGUIBaseObject.
Reimplemented in SallyAPI::GUI::CSideMenuButton, and SallyAPI::GUI::CButtonBarButton.
void CButton::SetActive | ( | bool | set | ) |
Sets the button active flag.
set | true to set. |
void CButton::SetCheckStatus | ( | bool | value | ) |
Sets a check status.
value | true to value. |
void CButton::SetDefaultButton | ( | bool | value | ) |
Sets a default button. Set this flag to true to make it a default button. A default button is displayed eye-catching.
value | true to value. |
void CButton::SetFourTextActive | ( | int | i | ) |
Sets a four text active.
i | The index. |
void CButton::SetFourTexts | ( | int | i, |
const std::string & | text | ||
) |
Sets text if the button is from the type BUTTON_TYPE_FOUR_TEXTS.
i | The index from 0 to 3 |
text | The text. |
void CButton::SetImageId | ( | int | image | ) |
Sets an image identifier. If you wan't to remove the image set GUI_NO_IMAGE.
image | The image. |
void CButton::SetImageLeft | ( | ) |
Sets draw the image on the left side of the button.
void CButton::SetImageRight | ( | ) |
Sets draw the image on the right side of the button.
void CButton::SetImageText | ( | const std::string & | text | ) | [virtual] |
Sets the text which is printed over the image.
text | The text. |
void CButton::SetImageTextColor | ( | D3DCOLOR | rgbFontColour | ) | [virtual] |
Sets the font color of the image text.
rgbFontColour | The rgb font colour. |
void CButton::SetImageTextLocalised | ( | bool | localised | ) | [virtual] |
Sets an image text localised.
localised | true to localised. |
void CButton::Timer | ( | float | timeDelta | ) | [virtual] |
Timers.
timeDelta | The time delta. |
Reimplemented from SallyAPI::GUI::CControl.
Reimplemented in SallyAPI::GUI::CListViewButton.
void CButton::UseHoleWidth | ( | bool | use | ) |
Set use hole width for text draw. Usually a button has a border on the left and on the right. The thickness of the border depends on the theme used. If you set this value to true there will be no border. This flag should be used with align center.
use | true to use. |
bool SallyAPI::GUI::CButton::m_bActive [protected] |
Not valide for BUTTON_TYPE_ONLY_IMAGE.
bool SallyAPI::GUI::CButton::m_bChecked [protected] |
Not valide for BUTTON_TYPE_ONLY_IMAGE.
bool SallyAPI::GUI::CButton::m_bDefaultButton [protected] |
Not valide for BUTTON_TYPE_ONLY_IMAGE.
bool SallyAPI::GUI::CButton::m_bImageLeft [protected] |
Not valide for BUTTON_TYPE_ONLY_IMAGE.
bool SallyAPI::GUI::CButton::m_bImageTextLocalised [protected] |
bool SallyAPI::GUI::CButton::m_bUseHoleWidth [protected] |
Only valide for BUTTON_TYPE_NORMAL.
ButtonType SallyAPI::GUI::CButton::m_eType [protected] |
float SallyAPI::GUI::CButton::m_fDeltaStart [protected] |
int SallyAPI::GUI::CButton::m_iFourTextsActive [protected] |
Only valide for BUTTON_TYPE_FOUR_TEXTS.
int SallyAPI::GUI::CButton::m_iImage [protected] |
int SallyAPI::GUI::CButton::m_iImageSize [protected] |
Not valide for BUTTON_TYPE_ONLY_IMAGE.
D3DCOLOR SallyAPI::GUI::CButton::m_rgbImageFontColour [protected] |
std::string SallyAPI::GUI::CButton::m_strFourTexts[4] [protected] |
Only valide for BUTTON_TYPE_FOUR_TEXTS.
std::string SallyAPI::GUI::CButton::m_strImageText [protected] |