/************************************
Author		: lujjjh
Date		: 2010.9
************************************/

namespace win {
	imagelist = class {
		ctor (v1 = 0, v2 = -1) {
			if (v2 == -1)
				this.handle = v1;
			else
				this.handle = ::ImageList_Create(v1, v2, 0x8/*_ILC_COLOR8*/ | 0x1/*_ILC_MASK*/, 0, 1);
		}
		add = function (pic, color=0xff00ff) {
			import win.ole.image;
			var hbmp = ..win.ole.image.load(pic).handle;
			::ImageList_AddMasked(this.handle, hbmp, color);
			::DeleteObject(topointer(hbmp));
		}
		int handle;
	}
}

namespace win.imagelist {
	/*intellisense(::)*/
	::Comctl32 := ..raw.loadDll("Comctl32.dll");
	::ImageList_Create := ::Comctl32.api("ImageList_Create", "INT(int cx, int cy, INT flags, int cInitial, int cGrow)");
	::ImageList_AddMasked = ::Comctl32.api("ImageList_AddMasked", "int(INT himl, INT hbmImage, int crMask)")
	/*end intellisense*/
}

/**intellisense(win)
imagelist(.()  = 创建一个 imagelist
imagelist(.(宽度,高度)  = 创建一个 imagelist
end intellisense**/

/**intellisense(iml) 
add(__/*图片路径*/, 0xff00ff/*透明色*/) = 向 imagelist 中添加图片
end intellisense**/

