home *** CD-ROM | disk | FTP | other *** search
- Card "Card#1"
- AfterAttachment
- Nop ; we don't want any see thru parts
- Transparent Off
- Nop ; we want fast drag feedback
- FastFeedBack On
- Nop ; lets make it so we don't draw on the borders of the window
- Let Left =WindowBorderLeft
- Let Top =WindowBorderTop
- Let Width=WindowWidth-WindowBorderLeft-WindowBorderRight-1
- Let Height=WindowHeight-WindowBorderTop-WindowBorderBottom-1
- InstallClipRegion Left,Top,Width,Height,ONLY
- Nop ; lets get an initial brush incase someone draws before
- Nop ; dropping an icon on us. don't forget to fill in offsets
- ClipBrush 25,25,1,1,"MyBrush"
- Let WidthOffset=0
- Let HeightOffset=0
- EndScript
- Window "UserWindow"
- Definition
- Origin 25,25
- Size 320,100
- Title "Workbench 2.0 AppEvents..."
- NumberOfColors 2
- DefaultColors 0,1,0
- WindowObjects CLOSEBUTTON DEPTHBUTTONS DRAGBAR
- WindowFlags ACTIVATE TOFRONT WORKBENCH
- VisualEffects NONE ,WAIT
- EndScript
- OnCloseButton
- Quit
- EndScript
- OnAppEvent
- Nop ; we get passed thru Arg1 the icons dropped on us
- Nop ; get a clean slate to draw on
- ClearWindow
- Nop ; we need a variable to work with
- Local IconName
- Nop ; parse off the iconname
- Let IconName=GetWord(Arg1,1,Char(10))
- Nop ; a directory maybe?
- If GetChars(IconName,NumberOfChars(IconName),1)="/" ; a directory?
- Nop ; if it is a directory then we need to trim
- Nop ; the '/' off the end of the name or the
- Nop ; icon system will get confused. :-(
- Let IconName=GetChars(IconName,1,NumberOfChars(IconName)-1)
- EndIf
- Nop ; changed the window title to show the iconname
- SetWindowTitle "Icon : "||IconName
- Nop ; load the icon
- LoadIcon IconName,"MyIcon"
- Nop ; clip out the image
- ClipIconImage "MyIcon","MyBrush"
- Nop ; get rid of the icon
- Flush "MyIcon"
- Nop ; figure out the size of the icon image
- GetBufferInfo "MyBrush",Width,Height
- Nop ; we really want to know the center offset of the image
- Let WidthOffset=Width%2
- Let HeightOffset=Height%2
- Nop ; show the icon image where it was dropped
- ShowBrush "MyBrush",MouseX-WidthOffset,MouseY-HeightOffset
- EndScript
- EndObj
- AreaButton "DrawingArea"
- Definition
- Origin 0,0
- Size 320,100
- Border NONE ,2,1
- Highlight NONE
- ButtonFlags NONE
- EndScript
- OnClick
- Nop ; show the image right heerrreee....
- ShowBrush "MyBrush",MouseX-WidthOffset,MouseY-HeightOffset
- EndScript
- OnDrag
- Nop ; and then show it over here.
- ShowBrush "MyBrush",MouseX-WidthOffset,MouseY-HeightOffset
- EndScript
- EndObj
- EndObj
-