$IFNDEF TRUE
$DEFINE True 1
$ENDIF
$IFNDEF FALSE
$DEFINE False 0
$ENDIF
$IFNDEF boolean
$DEFINE boolean INTEGER
$ENDIF
DECLARE FUNCTION DrawFocusRect LIB "user32" ALIAS "DrawFocusRect" (hdc AS LONG,lpRect AS QRECT) AS LONG
TYPE QDrawFocus EXTENDS QOBJECT
PUBLIC:
Left AS SHORT PROPERTY SET SetLeft
Top AS SHORT PROPERTY SET SetTop
Width AS SHORT PROPERTY SET SetWidth
Height AS SHORT PROPERTY SET SetHeight
Move AS boolean PROPERTY SET SetMove
Visible AS boolean
Inside AS boolean PROPERTY SET SetInside
NoResize AS boolean
ShowCursor AS boolean
PRIVATE:
Border AS SHORT
Frame1 AS boolean
Frame2 AS boolean
Frame3 AS boolean
offsetX AS SHORT
offsetY AS SHORT
rect AS QRECT
PUBLIC:
PROPERTY SET SetLeft(value AS SHORT)
END PROPERTY
PROPERTY SET SetTop(value AS SHORT)
END PROPERTY
PROPERTY SET SetWidth(value AS SHORT)
END PROPERTY
PROPERTY SET SetHeight(value AS SHORT)
END PROPERTY
PROPERTY SET SetMove(value AS boolean)
END PROPERTY
PROPERTY SET SetInside(value AS boolean)
END PROPERTY
SUB Remove(handle AS LONG)
IF QDrawFocus.Visible THEN
QDrawFocus.rect.right=QDrawFocus.left+QDrawFocus.width
QDrawFocus.rect.bottom=QDrawFocus.top+QDrawFocus.height
QDrawFocus.rect.left=QDrawFocus.left
QDrawFocus.rect.top=QDrawFocus.top
DrawFocusRect(handle,QDrawFocus.rect)
QDrawFocus.Visible=false
END IF
IF QDrawFocus.ShowCursor THEN Screen.Cursor=0
END SUB
SUB Start(handle AS LONG,x AS INTEGER,y AS INTEGER)
QDrawFocus.Inside=false
QDrawFocus.Move=false
IF x>QDrawFocus.left AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.Visible=true THEN
QDrawFocus.Inside=true
ELSE
QDrawFocus.Remove(handle)
QDrawFocus.Inside=false
QDrawFocus.Move=false
QDrawFocus.left=x
QDrawFocus.top=y
QDrawFocus.rect.left=x
QDrawFocus.rect.top=y
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-3
END IF
IF QDrawFocus.Inside AND QDrawFocus.Visible THEN
QDrawFocus.Frame1=false
QDrawFocus.Frame2=false
QDrawFocus.Frame3=false
QDrawFocus.offsetX=x-QDrawFocus.left
QDrawFocus.offsetY=y-QDrawFocus.top
IF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
QDrawFocus.Frame3=true
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-8
ELSEIF y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
QDrawFocus.Frame2=true
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-7
ELSEIF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND QDrawFocus.NoResize=false THEN
QDrawFocus.Frame1=true
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-9
ELSE
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-21
END IF
END IF
END SUB
SUB Draw(handle AS LONG,x AS INTEGER,y AS INTEGER,flagDraw AS boolean)
IF flagDraw THEN
IF QDrawFocus.Visible THEN
QDrawFocus.rect.right=QDrawFocus.left+QDrawFocus.width
QDrawFocus.rect.bottom=QDrawFocus.top+QDrawFocus.height
QDrawFocus.rect.left=QDrawFocus.left
QDrawFocus.rect.top=QDrawFocus.top
DrawFocusRect(handle,QDrawFocus.rect)
END IF
IF QDrawFocus.Inside AND QDrawFocus.Visible THEN
IF QDrawFocus.Frame1 AND QDrawFocus.NoResize=false THEN
QDrawFocus.rect.right=x
QDrawFocus.rect.bottom=QDrawFocus.top+QDrawFocus.height
QDrawFocus.width=x-QDrawFocus.left
END IF
IF QDrawFocus.Frame2 AND QDrawFocus.NoResize=false THEN
QDrawFocus.rect.bottom=y
QDrawFocus.rect.right=QDrawFocus.left+QDrawFocus.width
QDrawFocus.height=y-QDrawFocus.top
END IF
IF QDrawFocus.Frame3 AND QDrawFocus.NoResize=false THEN
QDrawFocus.rect.right=x
QDrawFocus.rect.bottom=y
QDrawFocus.width=x-QDrawFocus.left
QDrawFocus.height=y-QDrawFocus.top
END IF
IF QDrawFocus.Frame1=false AND QDrawFocus.Frame2=false AND QDrawFocus.Frame3=false THEN
QDrawFocus.left=x-QDrawFocus.offsetX
QDrawFocus.top=y-QDrawFocus.offsetY
QDrawFocus.rect.left=QDrawFocus.left
QDrawFocus.rect.top=QDrawFocus.top
QDrawFocus.rect.right=x-QDrawFocus.offsetX+QDrawFocus.width
QDrawFocus.rect.bottom=y-QDrawFocus.offsetY+QDrawFocus.height
END IF
DrawFocusRect(handle,QDrawFocus.rect)
QDrawFocus.Move=true
QDrawFocus.Visible=true
ELSE
QDrawFocus.width=x-QDrawFocus.left
QDrawFocus.height=y-QDrawFocus.top
QDrawFocus.rect.right=x
QDrawFocus.rect.bottom=y
DrawFocusRect(handle,QDrawFocus.rect)
QDrawFocus.Visible=true
END IF
ELSE
IF QDrawFocus.Visible THEN
IF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
QDrawFocus.Inside=true
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-8
ELSEIF x>QDrawFocus.left AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
QDrawFocus.Inside=true
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-7
ELSEIF x>QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND x<QDrawFocus.left+QDrawFocus.width AND y>QDrawFocus.top AND y<QDrawFocus.top+QDrawFocus.height AND QDrawFocus.NoResize=false THEN
QDrawFocus.Inside=true
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-9
ELSEIF x>QDrawFocus.left AND x<QDrawFocus.left+QDrawFocus.width-QDrawFocus.Border AND y>QDrawFocus.top AND y<QDrawFocus.top+QDrawFocus.height-QDrawFocus.Border THEN
QDrawFocus.Inside=true
IF QDrawFocus.ShowCursor THEN Screen.Cursor=-21
ELSE
QDrawFocus.Inside=false
IF QDrawFocus.ShowCursor THEN Screen.Cursor=0
END IF
END IF
END IF
END SUB
SUB Stop(handle AS LONG,flagRemove AS boolean)
IF QDrawFocus.Move AND flagRemove THEN
QDrawFocus.Remove(handle)
END IF
IF QDrawFocus.ShowCursor THEN Screen.Cursor=0
END SUB
CONSTRUCTOR
Border=10
ShowCursor=true
END CONSTRUCTOR
END TYPE
|