8d9769a779
* BUG: Virtual control icons are searched in Gambas control directories. * NEW: The directory where source package is done is remembered, by project. [WIKI CGI SCRIPT] * NEW: Virtual classes are not creatable. [GB.DESKTOP] * NEW: Many enhancements to top-level windows management. * NEW: The DesktopWatcher class allows to watch desktop changes and top- level window changes. [GB.QT] * BUG: Showing a window during an Open or Close event, and closing a window during the Close event now do nothing. git-svn-id: svn://localhost/gambas/trunk@1617 867c0c6c-44f3-4631-809d-bfa615b0a4ec
149 lines
2.8 KiB
Text
149 lines
2.8 KiB
Text
' Gambas class file
|
|
|
|
Static Private $cAnim As New Collection
|
|
Static Private $hPict[8] As Picture
|
|
|
|
Private $sAnim As String
|
|
Private $iWait As Integer
|
|
Private $MX As Integer
|
|
Private $MY As Integer
|
|
Private $bHide As Boolean
|
|
'PRIVATE $sMessage AS String
|
|
|
|
' STATIC PUBLIC SUB _init()
|
|
'
|
|
' DIM iInd AS Integer
|
|
' DIM maxW AS Integer
|
|
' DIM maxH AS Integer
|
|
'
|
|
' $cAnim["Blink"] = "1,0,1,0"
|
|
' $cAnim["Blink2"] = "3,4,3,0"
|
|
' $cAnim["Depressive"] = "2,6,7,-8,6,2,0,-8"
|
|
' $cAnim["Happy"] = "5,0,5,0"
|
|
'
|
|
' 'Shrinks the form to match
|
|
' 'the largest animation image
|
|
' maxW = 0
|
|
' maxH = 0
|
|
' FOR iInd = 0 TO 7
|
|
' $hPict[iInd] = Picture["img/anim/gambas" & CStr(iInd + 1) & ".png"]
|
|
' maxH = Max(maxH, $hPict[iInd].Height)
|
|
' maxW = Max(maxW, $hPict[iInd].Width)
|
|
' NEXT
|
|
'
|
|
' 'The +11,+3 is a kludge to even the padding
|
|
' 'of the Form versus the background image,
|
|
' 'tested by dragging to the four corners of
|
|
' 'the screen and adjusting the numbers to
|
|
' 'even the spacing to the edges on all
|
|
' 'screen corners.
|
|
' ME.Resize(maxW + 11, maxH + 3)
|
|
'
|
|
' END
|
|
|
|
|
|
' PUBLIC SUB _new()
|
|
'
|
|
' 'Config.LoadWindow(ME, "/FGambas")
|
|
' Settings.Read(ME)
|
|
' ME.Picture = $hPict[0]
|
|
'
|
|
' END
|
|
'
|
|
'
|
|
' PUBLIC SUB Form_Close()
|
|
'
|
|
' 'Config.SaveWindow(ME, "/FGambas")
|
|
' Settings.Write(ME)
|
|
'
|
|
' END
|
|
|
|
|
|
Public Sub Animate(sAnim As String, Optional sMsg As String)
|
|
'
|
|
' If Not Me.Visible Then Return
|
|
'
|
|
' If sMsg Then
|
|
' $sAnim = $cAnim[sAnim]
|
|
' $bHide = True
|
|
' Warning(sMsg)
|
|
' Else
|
|
' $sAnim &= $cAnim[sAnim]
|
|
' Endif
|
|
' $iWait = 0
|
|
'
|
|
' 'ME.Raise
|
|
'
|
|
' End
|
|
'
|
|
'
|
|
' Public Sub timAnim_Timer()
|
|
'
|
|
' Dim iPos As Integer
|
|
' Dim iCmd As Integer
|
|
' Dim eRnd As Float
|
|
'
|
|
' If $iWait > 0 Then
|
|
' Dec $iWait
|
|
' Return
|
|
' Endif
|
|
'
|
|
' If Not $sAnim Then
|
|
' If $bHide Then
|
|
' 'Balloon.Hide
|
|
' $bHide = False
|
|
' Endif
|
|
' eRnd = Rnd
|
|
' If eRnd < 0.02 Then
|
|
' $sAnim = $cAnim["Blink"]
|
|
' Else If eRnd < 0.04 Then
|
|
' $sAnim = $cAnim["Blink2"]
|
|
' Else
|
|
' Return
|
|
' Endif
|
|
' Endif
|
|
'
|
|
' iPos = InStr($sAnim, ",")
|
|
' If iPos = 0 Then iPos = Len($sAnim) + 1
|
|
' iCmd = Val(Left$($sAnim, iPos - 1))
|
|
' $sAnim = Mid$($sAnim, iPos + 1)
|
|
'
|
|
' If iCmd < 0 Then
|
|
' $iWait = Abs(iCmd) - 1
|
|
' Return
|
|
' Endif
|
|
'
|
|
' Me.Picture = $hPict[iCmd]
|
|
'
|
|
End
|
|
|
|
Public Sub Warning(sMsg As String)
|
|
|
|
If Me.Visible Then
|
|
Balloon.Warning(sMsg, Me, panThere.X, panThere.Y)
|
|
Else
|
|
Message.Warning(sMsg)
|
|
Endif
|
|
|
|
End
|
|
|
|
Public Sub Error(sMsg As String)
|
|
|
|
If Me.Visible Then
|
|
Animate("Depressive")
|
|
Balloon.Error(sMsg, Me, panThere.X, panThere.Y)
|
|
Else
|
|
Message.Error(sMsg)
|
|
Endif
|
|
|
|
End
|
|
|
|
Public Sub Info(sMsg As String)
|
|
|
|
If Me.Visible Then
|
|
Balloon.Info(sMsg, Me, panThere.X, panThere.Y)
|
|
Else
|
|
Message.Info(sMsg)
|
|
Endif
|
|
|
|
End
|