Debian Codegraph @

Contrib/BgImage/Example.nsi

raw
1 Name "BgImage.dll test"
2
3 OutFile "BgImage Test.exe"
4
5 XPStyle on
6 RequestExecutionLevel user
7
8 !define DEBUG
9 !macro GetReturnValue
10 !ifdef DEBUG
11 Pop $R9
12 StrCmp $R9 success +2
13 DetailPrint "Error: $R9"
14 !endif
15 !macroend
16
17 Function .onGUIInit
18 # the plugins dir is automatically deleted when the installer exits
19 InitPluginsDir
20 # lets extract some bitmaps...
21 File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
22 File /oname=$PLUGINSDIR\2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
23
24 !ifdef DEBUG
25 # turn return values on if in debug mode
26 BgImage::SetReturn on
27 !endif
28
29 # set the initial background for images to be drawn on
30 # we will use a gradient from drak green to dark red
31 BgImage::SetBg /GRADIENT 0 0x80 0 0x80 0 0
32 !insertmacro GetReturnValue
33 # add an image @ (150,0)
34 BgImage::AddImage $PLUGINSDIR\2.bmp 150 0
35 !insertmacro GetReturnValue
36 # add the same image only transparent (magenta wiped) @ (150,16)
37 BgImage::AddImage /TRANSPARENT 255 0 255 $PLUGINSDIR\2.bmp 150 16
38 !insertmacro GetReturnValue
39 # create the font for the following text
40 CreateFont $R0 "Comic Sans MS" 50 700
41 # add a blue shadow for the text
42 BgImage::AddText "Testing 1... 2... 3..." $R0 0 0 255 48 48 798 198
43 !insertmacro GetReturnValue
44 # add a green shadow for the text
45 BgImage::AddText "Testing 1... 2... 3..." $R0 0 255 0 52 52 802 202
46 !insertmacro GetReturnValue
47 # add the text
48 BgImage::AddText "Testing 1... 2... 3..." $R0 255 0 0 50 50 800 200
49 !insertmacro GetReturnValue
50 # show our creation to the world!
51 BgImage::Redraw
52 # Refresh doesn't return any value
53
54 FunctionEnd
55
56 ShowInstDetails show
57
58 Section
59 # play some sounds
60 FindFirst $0 $1 $WINDIR\Media\*.wav
61 StrCmp $0 "" skipSound
62 moreSounds:
63 StrCmp $1 "" noMoreSounds
64 BgImage::Sound /WAIT $WINDIR\Media\$1
65 # Sound doesn't return any value either
66 MessageBox MB_YESNO "Another sound?" IDNO noMoreSounds
67 FindNext $0 $1
68 Goto moreSounds
69
70 noMoreSounds:
71 FindClose $0
72 skipSound:
73
74 # change the background image to Mike, tiled
75 BgImage::SetBg /TILED $PLUGINSDIR\1.bmp
76 !insertmacro GetReturnValue
77 # we have to redraw to reflect the changes
78 BgImage::Redraw
79
80 MessageBox MB_OK "Mike the llama"
81
82 # clear everything
83 BgImage::Clear
84 # Clear doesn't return any value
85 # set another gradient
86 BgImage::SetBg /GRADIENT 0xFF 0xFA 0xBA 0xAA 0xA5 0x65
87 !insertmacro GetReturnValue
88 # add some text
89 BgImage::AddText "A Desert for Mike" $R0 0 0 0 50 50 800 150
90 !insertmacro GetReturnValue
91 # add mike as an image
92 BgImage::AddImage $PLUGINSDIR\1.bmp 50 150
93 !insertmacro GetReturnValue
94 # again, we have to call redraw to reflect changes
95 BgImage::Redraw
96 SectionEnd
97
98 Function .onGUIEnd
99 BgImage::Destroy
100 # Destroy doesn't return any value
101 FunctionEnd