
assert(web.layout.element);
var dll = ..web.layout._dll;

namespace web.layout.element;

class state{
	ctor(element){
		this.element = element;
	}
	@_meta;
}
namespace state{ 
	bits = {  
		link = 0x1;
		hover = 0x2;
		active = 0x4;
		focus = 0x8;
		visited = 0x10;
		current = 0x20;
		checked = 0x40;
		disabled = 0x80;
		readonly = 0x100;
		expanded = 0x200;
		collapsed = 0x400;
		incomplete = 0x800;
		animating = 0x1000;
		focusable = 0x2000;
		anchor = 0x4000;
		synthetic = 0x8000;
		ownsPopup = 0x10000;
		tabfocus = 0x20000;
		empty = 0x40000;
		busy = 0x80000;
		dragOver = 0x100000;
		dropTarget = 0x200000;
		moving = 0x400000;
		copying = 0x800000;
		dragSource = 0x1000000;
		dropMarker = 0x2000000;
		pressed = 0x4000000;
		popup = 0x8000000;
		ltr = 0x10000000;
		rtl = 0x20000000; 
	}
	var bits = bits;
	
	_meta = {
		_get = function(k){
			state = bits[k];
			if(state) return !!owner.element.getState(state)
		}
		_set = function(k,v){
			state = bits[k];
			if(!state){
				error("错误的状态名",2)
			}
			if(v){
				owner.element.modifyState(state)
			}
			else {
				owner.element.modifyState(,state)
			}
			
		};
	}
}

/**intellisense(!htmlayout_state)
link=未被点击超链接
hover=鼠标悬停
active=鼠标按下状态
focus=拥有焦点
visited=点击过的超链接
current=当前选中节点
checked=是否选中
disabled=禁用状态
readonly=只读
expanded=展开状态
collapsed=折叠状态
incomplete=背景或前景图像、框架页面等请求的资源未加载完成\nCSS中 frame:not(:busy):incomplete 匹配框架下载失败数据未加载
animating=是否正在播放动画
focusable=可接受输入焦点;
anchor=多选的选区端点
synthetic=是否引擎自动生成的节点
ownsPopup=是否弹出节点的所有者节点\nCSS中对应 :owns-popup
tabfocus=通过tab键得到焦点
empty=文本内容为空
busy=节点忙状态\n指正在下载、但尚未下载结束\nCSS中 frame:not(:busy):incomplete 匹配框架下载失败数据未加载
dragOver=是否正在当前节点上拖动\nCSS中对应 :drag-over
dropTarget=是否拖放目标节点\nCSS中对应 :drag-target
moving=是否正在拖动,移动模式
copying=是否正在拖动,复制模式
dragSource=是否拖放源节点\nCSS中对应 :drag-source
dropMarker=是否指示拖放目的位置的副本\nCSS中对应 :drag-marker
pressed=键按下
popup=弹出状态
ltr=是否左向右显示
rtl=是否右向左显示
end intellisense**/
  
 /**intellisense()
_HL_STATE_LINK=@1/*_HL_STATE_LINK*/
_HL_STATE_HOVER=@2/*_HL_STATE_HOVER*/
_HL_STATE_ACTIVE=@4/*_HL_STATE_ACTIVE*/
_HL_STATE_FOCUS=@8/*_HL_STATE_FOCUS*/
_HL_STATE_VISITED=@0x10/*_HL_STATE_VISITED*/
_HL_STATE_CURRENT=@0x20/*_HL_STATE_CURRENT*/
_HL_STATE_CHECKED=@0x40/*_HL_STATE_CHECKED*/
_HL_STATE_DISABLED=@0x80/*_HL_STATE_DISABLED*/
_HL_STATE_READONLY=@0x100/*_HL_STATE_READONLY*/
_HL_STATE_EXPANDED=@0x200/*_HL_STATE_EXPANDED*/
_HL_STATE_COLLAPSED=@0x400/*_HL_STATE_COLLAPSED*/
_HL_STATE_INCOMPLETE=@0x800/*_HL_STATE_INCOMPLETE*/
_HL_STATE_ANIMATING=@0x1000/*_HL_STATE_ANIMATING*/
_HL_STATE_FOCUSABLE=@0x2000/*_HL_STATE_FOCUSABLE*/
_HL_STATE_ANCHOR=@0x4000/*_HL_STATE_ANCHOR*/
_HL_STATE_SYNTHETIC=@0x8000/*_HL_STATE_SYNTHETIC*/
_HL_STATE_OWNS_POPUP=@0x10000/*_HL_STATE_OWNS_POPUP*/
_HL_STATE_TABFOCUS=@0x20000/*_HL_STATE_TABFOCUS*/
_HL_STATE_EMPTY=@0x40000/*_HL_STATE_EMPTY*/
_HL_STATE_BUSY=@0x80000/*_HL_STATE_BUSY*/
_HL_STATE_DRAG_OVER=@0x100000/*_HL_STATE_DRAG_OVER*/
_HL_STATE_DROP_TARGET=@0x200000/*_HL_STATE_DROP_TARGET*/
_HL_STATE_MOVING=@0x400000/*_HL_STATE_MOVING*/
_HL_STATE_COPYING=@0x800000/*_HL_STATE_COPYING*/
_HL_STATE_DRAG_SOURCE=@0x1000000/*_HL_STATE_DRAG_SOURCE*/
_HL_STATE_DROP_MARKER=@0x2000000/*_HL_STATE_DROP_MARKER*/
_HL_STATE_PRESSED=@0x4000000/*_HL_STATE_PRESSED*/
_HL_STATE_POPUP=@0x8000000/*_HL_STATE_POPUP*/
_HL_STATE_IS_LTR=@0x10000000/*_HL_STATE_IS_LTR*/
_HL_STATE_IS_RTL=@0x20000000/*_HL_STATE_IS_RTL*/
end intellisense**/