ht.ui.drawable.TabBackgroundLineDrawable(lineWidth, color, position)

new TabBackgroundLineDrawable(lineWidth, color, position)

此类用于绘制 TabLayout 的标签头(分割线方式)

Parameters:
Name Type Attributes Description
lineWidth number
color string
position string <optional>

Extends

Methods

addPropertyChangeListener(listener, scope, ahead) → {void}

增加属性事件变化监听函数

Parameters:
Name Type Attributes Description
listener Object

监听器函数

scope object <optional>

函数域

ahead boolean <optional>

是否将当前监听器插入到监听器列表开头

Returns:
void
Inherited From:

draw(x, y, width, height, data, view, dom) → {void}

绘制内容

Parameters:
Name Type Attributes Description
x number

绘制范围的 x 坐标

y number

绘制范围的 y 坐标

width number

绘制范围的宽度

height number

绘制范围的高度

data ht.Data <optional>

绘制相关的 Data 对象,如绘制树组件中节点的 icon 时,可以用此参数判断出当前在绘制哪个节点

view ht.ui.View

当前在绘制的组件

dom HTMLElement <optional>

当前在绘制的 dom 对象,绝大多数组件无需考虑这个参数(因为只有一个绘制 canvas),特殊的是右键菜单,每个子菜单都是一个单独的 canvas,这种情况下才有这个参数

Returns:
void
Inherited From:
Example
// 下面这段代码绘制了一个矩形
function MyDrawable() {
	MyDrawable.superClass.constructor.call(this);
}
ht.Default.def(MyDrawable, ht.ui.drawable.Drawable, {
	draw: function(x, y, width, height, data, view, dom) {
		var g = view.getRootContext(dom);
		g.beginPath();
		g.rect(x, y, width, height);
		g.fillStyle = 'red';
		g.fill();
	}
});

firePropertyChange(property, oldValue, newValue, compareFunc) → {boolean}

派发属性变化事件

Parameters:
Name Type Attributes Description
property string

属性名

oldValue any

属性变化之前的值

newValue any

属性变化之后的值

compareFunc Object <optional>

比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件

Returns:
boolean -

事件是否派发成功

Inherited From:

fp(property, oldValue, newValue, compareFunc) → {boolean}

派发属性变化事件,firePropertyChange 的缩写

Parameters:
Name Type Attributes Description
property string

属性名

oldValue any

属性变化之前的值

newValue any

属性变化之后的值

compareFunc Object <optional>

比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件

Returns:
boolean -

事件是否派发成功

Inherited From:

getColor() → {string}

获取分割线颜色

Returns:
string -

颜色值

getLineWidth() → {number}

获取分割线宽度

Returns:
number -

宽度值

getPosition() → {string}

获取分割线位置

Returns:
string -

值为:outside|inside

getSerializableProperties() → {object}

获取可序列化的属性

Returns:
object -

属性 map

Inherited From:

mp(listener, scope, ahead) → {void}

增加属性事件变化监听函数,addPropertyChangeListener 的缩写

Parameters:
Name Type Attributes Description
listener Object

监听器函数

scope object <optional>

函数域

ahead boolean <optional>

是否将当前监听器插入到监听器列表开头

Returns:
void
Inherited From:

removePropertyChangeListener(listener, scope) → {void}

删除属性事件变化监听器

Parameters:
Name Type Attributes Description
listener Object

监听器函数

scope object <optional>

函数域

Returns:
void
Inherited From:

setColor(color) → {void}

设置分割线颜色

Parameters:
Name Type Description
color string

颜色值

Returns:
void

setLineWidth(width) → {void}

设置分割线宽度

Parameters:
Name Type Description
width number

宽度值

Returns:
void

setPosition(position) → {void}

设置分割线位置

Parameters:
Name Type Description
position string

位置,可选值为:outside|inside

Returns:
void

ump(listener, scope) → {void}

删除属性事件变化监听器,removePropertyChangeListener 的缩写

Parameters:
Name Type Attributes Description
listener Object

监听器函数

scope object <optional>

函数域

Returns:
void
Inherited From: