⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guiappscrollbar.h

📁 老外为HGE写的扩展GUI
💻 H
字号:
#ifndef __GUIAPPSCROLLBAR_H__
#define __GUIAPPSCROLLBAR_H__

#include "guiappbutton.h"

class GUIAppScrollBar : public GUIAppObject {
protected:
	void RenderV ();
	void RenderH ();
	void InitV ();
	void InitH ();
	void SetupSize(float x, float y, float w, float h);
	float Value2Pos( float value );
	float Pos2Value( float pos );
public:
	enum ScrollDir {
		V_SCROLL, H_SCROLL
	};

	enum ScrollBtn {
		B_LEFTUP, B_RIGHTDN, B_SCROLL
	};

	GUIAppScrollBar(int id, ScrollDir direction, float x, float y, float lenght, const char *btn1, const char *btn2, const char *btn3 );

	virtual			~GUIAppScrollBar();
	
	virtual void	Render();
	virtual void	Move(float dx, float dy);
	virtual bool	MouseLButton(bool bDown);
	virtual bool	MouseMove(float x, float y);
	virtual void	Focus(bool focus);
	virtual void	Selected(bool focus);
	virtual bool	KeyClick(int key, int chr );
	virtual void	OnEvent( int event );
	virtual bool	MouseWheel(int params);

	void SetLimits ( float min, float max, float step = 1.0f );
	void SetBGColor (DWORD clr);
	void SetFrameColor (DWORD clr);
	
	float GetValue ();
	float GetMinValue ();
	float GetMaxValue ();
	void SetValue ( float v );
	void SetLenght ( float lenght );

private:
	ScrollDir		direction;
	GUIAppButton	*btn1;
	GUIAppButton	*btn2;
	GUIAppButton	*btn3;
	hgeQuad			background;
	DWORD			frameColor;
	DWORD			bgColor;
	// movement
	float			oldValue;
	bool			firstMove;
	// limits
	float			x, y;
	float			lenght;
	float			minValue;
	float			maxValue;
	float			curValue;
	float			stepValue;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -