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

📄 guiapplistbox.h

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

#include "guiappscrollbar.h"
#include "m_list.h"

class GUIAppListBox : public GUIAppObject {
protected:
	// item list
	class GUIAppItemList : public TList <GUIAppObject> {
	public:
		GUIAppItemList () : TList <GUIAppObject> (false) {
		}
	};

	enum Scrollers {
		VSCROLL, HSCROLL
	};
	
	// list box data
	GUIAppItemList objects;
	hgeQuad selection;
	hgeQuad background;
	DWORD frameColor;
	DWORD bgColor;
	DWORD selColor;
	
	// selection
	int selectIndex;
	GUIAppObject *selectObject;

	// tuning
	float sepHeight;

	// runtime data
	float listWidth;
	float listHeight;
	int clipWidth;
	int clipHeight;
	bool vsVisible;
	bool hsVisible;
	float oldVValue;
	float oldHValue;

	// helpers
	void SetupSize(float w, float h );
	void SetupList ();
	void SetupSelection();
	void FocusSelection ();
public:
	// allow to set scroll parameters
	GUIAppScrollBar *hscroll;
	GUIAppScrollBar *vscroll;

	GUIAppListBox ( int id, float x, float y, float width, float height, 
		const char *btn11, const char *btn12, const char *btn13, 
		const char *btn21, const char *btn22, const char *btn23 );
	~GUIAppListBox ();

	// implementation
	virtual void Move (float dx, float dy );
	virtual void Render();
	virtual void Selected ( bool selected );
	virtual void OnEvent ( int id );
	virtual bool MouseWheel(int params);
	virtual bool MouseLButton(bool bDown);
	virtual bool MouseMove(float x, float y);
	virtual bool KeyClick(int key, int chr);
	virtual void Focus(bool focus);
	virtual void Update(float dt);

	// design
	void SetBGColor ( DWORD clr );
	void SetSelectionColor ( DWORD clr );
	void SetFrameColor ( DWORD clr );
	void SetSepSize ( float sz );

	// selection work
	virtual void AddItem ( GUIAppObject *obj );
	virtual void DelItem ( GUIAppObject *obj );
	virtual void DelItem ( int idx );
	virtual int SelectionIndex ();
	virtual GUIAppObject * SelectionObject ();
	virtual bool SetSelection ( int idx );
	virtual int ItemCount ();
};

#endif

⌨️ 快捷键说明

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