$IFNDEF TRUE
$DEFINE True 1
$ENDIF
$IFNDEF FALSE
$DEFINE False 0
$ENDIF
$IFNDEF boolean
$DEFINE boolean INTEGER
$ENDIF
TYPE QSkinBtn EXTENDS QIMAGE
Private:
show AS QCANVAS
Align AS INTEGER
Stretch AS boolean
Width AS SHORT
Height AS SHORT
Public:
btUp AS QBITMAP
btDown AS QBITMAP
btEnable AS QBITMAP
mode AS SHORT PROPERTY SET SetMode
down AS boolean PROPERTY SET SetDown
enabled AS boolean PROPERTY SET SetEnabled
PROPERTY SET SetEnabled(value AS boolean)
QSkinBtn.bmp=QSkinBtn.btEnable.bmp
QSkinBtn.repaint
QSkinBtn.Enabled=value
Super.Enabled=value
END PROPERTY
PROPERTY SET SetDown(value AS boolean)
IF super.Enabled THEN
QSkinBtn.Down=value
IF QSkinBtn.Down THEN
QSkinBtn.bmp=QSkinBtn.btDown.bmp
ELSE
QSkinBtn.bmp=QSkinBtn.btUp.bmp
END IF
QSkinBtn.repaint
END IF
END PROPERTY
PROPERTY SET SetMode(value AS SHORT)
QSkinBtn.mode=value
END PROPERTY
EVENT OnMouseDown
QSkinBtn.bmp=QSkinBtn.btDown.bmp
QSkinBtn.repaint
END EVENT
EVENT OnMouseUp
IF QSkinBtn.mode=1 OR QSkinBtn.mode=2 THEN
IF QSkinBtn.Down AND QSkinBtn.mode=2 THEN
QSkinBtn.bmp=QSkinBtn.btUp.bmp
QSkinBtn.repaint
QSkinBtn.Down=false
ELSE
QSkinBtn.Down=true
END IF
ELSE
QSkinBtn.bmp=QSkinBtn.btUp.bmp
QSkinBtn.repaint
QSkinBtn.Down=false
END IF
END EVENT
EVENT Show.OnPaint
IF super.Enabled THEN
IF QSkinBtn.Down THEN
QSkinBtn.bmp=QSkinBtn.btDown.bmp
ELSE
QSkinBtn.bmp=QSkinBtn.btUp.bmp
END IF
ELSE
QSkinBtn.bmp=QSkinBtn.btEnable.bmp
END IF
QSkinBtn.Show.visible=false
END EVENT
CONSTRUCTOR
autosize=true
show.PARENT=QFORM
Down=false
mode=0
Enabled=true
END CONSTRUCTOR
END TYPE
|