Code : Tout sélectionner
; Auteur : Le Soldat Inconnu
; Version de PB : 4.00
;
; Explication du programme :
; Animation d'ouverture et de fermeture
#AW_HOR_POSITIVE = $1 ; Animates the window from left to right. This flag can be used with roll or slide animation.
#AW_HOR_NEGATIVE = $2 ; Animates the window from right to left. This flag can be used with roll or slide animation.
#AW_VER_POSITIVE = $4 ; Animates the window from top to bottom. This flag can be used with roll or slide animation.
#AW_VER_NEGATIVE = $8 ; Animates the window from bottom to top. This flag can be used with roll or slide animation.
#AW_CENTER = $10 ; Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
#AW_HIDE = $10000 ; Hides the window. By default, the window is shown.
#AW_ACTIVATE = $20000 ; Activates the window.
#AW_SLIDE = $40000 ; Uses slide animation. By default, roll animation is used.
#AW_BLEND = $80000 ; Uses a fade effect. This flag can be used only if hwnd is a top-level window.
Procedure.l Valeur_Duree()
ProcedureReturn Val(GetGadgetText(1))
EndProcedure
Procedure Animation(Fenetre, Effet, Duree)
; On cache la fenêtre
AnimateWindow_(WindowID(Fenetre), Duree, Effet | #AW_HIDE)
Delay(1000)
; On affiche la fenêtre
AnimateWindow_(WindowID(Fenetre), Duree, Effet)
; On redessine la fenêtre, certain gadget ne se réaffiche pas correctement
RedrawWindow_(WindowID(Fenetre), 0, 0, 1)
EndProcedure
; Création de la fenêtre et de la GadgetList
If OpenWindow(0, 0, 0, 300, 300, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget) = 0 Or CreateGadgetList(WindowID(0)) = 0
End
EndIf
TextGadget(#PB_Any, 0, 0, 300, 15, "Durée de l'animation en ms :")
StringGadget(1, 0, 15, 100, 20, "500", #PB_String_Numeric)
ButtonGadget(2, 0, 50, 150, 25, "Effet de transparence") : ButtonGadget(3, 150, 50, 150, 25, "Du centre")
ButtonGadget(4, 0, 75, 150, 25, "De la gauche vers la droite") : ButtonGadget(5, 150, 75, 150, 25, "De la droite vers la gauche")
ButtonGadget(6, 0, 100, 150, 25, "Du haut vers le bas") : ButtonGadget(7, 150, 100, 150, 25, "Du bas vers le haut")
ButtonGadget(8, 0, 125, 150, 25, "Diagonale HG vers BD") : ButtonGadget(9, 150, 125, 150, 25, "Diagonale BG vers HD")
ButtonGadget(10, 0, 150, 150, 25, "Diagonale HD vers BG") : ButtonGadget(11, 150, 150, 150, 25, "Diagonale BD vers HG")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget() ; Gadgets
Case 2
Animation(0, #AW_BLEND, Valeur_Duree())
Case 3
Animation(0, #AW_CENTER, Valeur_Duree())
Case 4
Animation(0, #AW_HOR_POSITIVE, Valeur_Duree())
Case 5
Animation(0, #AW_HOR_NEGATIVE, Valeur_Duree())
Case 6
Animation(0, #AW_VER_POSITIVE, Valeur_Duree())
Case 7
Animation(0, #AW_VER_NEGATIVE, Valeur_Duree())
Case 8
Animation(0, #AW_HOR_POSITIVE | #AW_VER_POSITIVE, Valeur_Duree())
Case 9
Animation(0, #AW_HOR_POSITIVE | #AW_VER_NEGATIVE, Valeur_Duree())
Case 10
Animation(0, #AW_HOR_NEGATIVE | #AW_VER_POSITIVE, Valeur_Duree())
Case 11
Animation(0, #AW_HOR_NEGATIVE | #AW_VER_NEGATIVE, Valeur_Duree())
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
End