view LightClone/Source/GuiButton.h @ 75:57c0ce406a68 tip

Add main menu
author koryspansel <koryspansel@bendbroadband.com>
date Tue, 18 Oct 2011 17:08:17 -0700
parents efd2b1ca5b77
children
line wrap: on
line source

/*
 * GuiButton
 */

#ifndef __GUIBUTTON_H__
#define __GUIBUTTON_H__

#include "Core.h"
#include "GuiElement.h"

/*
 * GuiButtonState
 */
enum
{
	GuiButtonState_Normal,
	GuiButtonState_Down,
	GuiButtonState_Hover,
	GuiButtonState_Disabled,
	GuiButtonState_Count,
};

/*
 * GuiButton
 */
class GuiButton : public GuiElement
{
public:

	/*
	 * EventClick
	 */
	static const char* EventClick;

private:

	/*
	 * nState
	 */
	uint32 nState;

	/*
	 * pTexture
	 */
	IDirect3DTexture9* pTexture[GuiButtonState_Count];

	/*
	 * pFont
	 */
	ID3DXFont* pFont;

	/*
	 * kText
	 */
	FixedString<> kText;

public:

	/*
	 * GuiButton
	 */
	GuiButton();

	/*
	 * Render
	 */
	virtual void Render(GuiRenderContext& kContext);

	/*
	 * SetTexture
	 */
	ErrorCode SetTexture(uint32 nState, const char* pName, bool bResize = false);

	/*
	 * SetFont
	 */
	ErrorCode SetFont(const char* pName, uint32 nSize, uint32 nWeight = FW_NORMAL);

	/*
	 * SetText
	 */
	void SetText(const char* pText);

	/*
	 * OnMouseEnter
	 */
	virtual void OnMouseEnter();

	/*
	 * OnMouseLeave
	 */
	virtual void OnMouseLeave();

	/*
	 * OnMouseDown
	 */
	virtual void OnMouseDown(uint32 nButton, float fX, float fY);

	/*
	 * OnMouseUp
	 */
	virtual void OnMouseUp(uint32 nButton, float fX, float fY);

	/*
	 * OnMouseMove
	 */
	virtual void OnMouseMove(float fX, float fY);
};

#endif //__GUIBUTTON_H__