new TabBackgroundDrawable(borderWidth, borderColor, background)
此类用于绘制 TabLayout 的标签头
Parameters:
Name | Type | Description |
---|---|---|
borderWidth |
Number | 边框宽度 |
borderColor |
color | 边框颜色 |
background |
color | 背景颜色 |
Extends
Methods
-
addPropertyChangeListener(listener, scope, ahead)
-
增加属性事件变化监听函数
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
- Inherited From:
-
draw(x, y, width, height, data, view, dom)
-
绘制内容
Parameters:
Name Type Argument Description x
Number 绘制范围的 x 坐标
y
Number 绘制范围的 y 坐标
width
Number 绘制范围的宽度
height
Number 绘制范围的高度
data
ht.Data <optional>
绘制相关的 Data 对象,如绘制树组件中节点的 icon 时,可以用此参数判断出当前在绘制哪个节点
view
ht.View 当前在绘制的组件
dom
HTMLElement <optional>
当前在绘制的 dom 对象,绝大多数组件无需考虑这个参数(因为只有一个绘制 canvas),特殊的是右键菜单,每个子菜单都是一个单独的 canvas,这种情况下才有这个参数
- 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 Argument Description property
String 属性名
oldValue
Object 属性变化之前的值
newValue
Object 属性变化之后的值
compareFunc
function <optional>
比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件
- Inherited From:
Returns:
事件是否派发成功
- Type
- Boolean
-
fp(property, oldValue, newValue, compareFunc) → {Boolean}
-
派发属性变化事件,firePropertyChange 的缩写
Parameters:
Name Type Argument Description property
String 属性名
oldValue
Object 属性变化之前的值
newValue
Object 属性变化之后的值
compareFunc
function <optional>
比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件
- Inherited From:
Returns:
事件是否派发成功
- Type
- Boolean
-
getBackground() → {color}
-
获取背景色
Returns:
背景色
- Type
- color
-
getBorderColor() → {color}
-
获取边框颜色
Returns:
边框颜色
- Type
- color
-
getBorderWidth() → {Number}
-
获取边框宽度
Returns:
宽度值
- Type
- Number
-
mp(listener, scope, ahead)
-
增加属性事件变化监听函数,addPropertyChangeListener 的缩写
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
- Inherited From:
-
removePropertyChangeListener(listener, scope)
-
删除属性事件变化监听器
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
函数域
- Inherited From:
-
setBackground(backgroundColor)
-
设置背景色
Parameters:
Name Type Description backgroundColor
color 背景色
-
setBorderColor(borderColor)
-
设置边框颜色
Parameters:
Name Type Description borderColor
color 边框颜色
-
setBorderWidth(borderWidth)
-
设置边框宽度
Parameters:
Name Type Description borderWidth
Number 宽度值
-
ump(listener, scope)
-
删除属性事件变化监听器,removePropertyChangeListener 的缩写
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
函数域
- Inherited From: