windowlistbox.h

来自「骨骼动画....把魔兽模型解出的代码..」· C头文件 代码 · 共 85 行

H
85
字号
//+-----------------------------------------------------------------------------
//| Inclusion guard
//+-----------------------------------------------------------------------------
#ifndef MAGOS_WINDOW_LISTBOX_H
#define MAGOS_WINDOW_LISTBOX_H


//+-----------------------------------------------------------------------------
//| Included files
//+-----------------------------------------------------------------------------
#include "Window.h"


//+-----------------------------------------------------------------------------
//| Window listbox info structure
//+-----------------------------------------------------------------------------
struct WINDOW_LISTBOX_INFO
{
	WINDOW_LISTBOX_INFO()
	{
		X = 0;
		Y = 0;
		Width = 100;
		Height = 100;

		HorizontalScroll = FALSE;
		VerticalScroll = FALSE;
		AutoSort = FALSE;

		Parent = NULL;
		Style = WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | LBS_DISABLENOSCROLL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY;
	}

	INT X;
	INT Y;
	INT Width;
	INT Height;

	BOOL HorizontalScroll;
	BOOL VerticalScroll;
	BOOL AutoSort;

	HWND Parent;
	DWORD Style;
};


//+-----------------------------------------------------------------------------
//| Window listbox class
//+-----------------------------------------------------------------------------
class WINDOW_LISTBOX : public WINDOW
{
	public:
		CONSTRUCTOR WINDOW_LISTBOX();
		DESTRUCTOR ~WINDOW_LISTBOX();

		virtual BOOL Create(CONST WINDOW_LISTBOX_INFO& NewListboxInfo);

		VOID Clear();

		INT AddString(CONST std::string& String);
		VOID RemoveString(INT Index);

		INT GetNrOfItems();
		INT GetIndex(CONST std::string& String);
		std::string GetString(INT Index);

		INT GetData(INT Index);
		VOID SetData(INT Index, INT NewData);

		INT GetCurrentSelection();
		VOID SetCurrentSelection(INT Index);

		VOID GetItemRect(INT Index, RECT& Rect);

	protected:
		WINDOW_LISTBOX_INFO ListboxInfo;
};


//+-----------------------------------------------------------------------------
//| End of inclusion guard
//+-----------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

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