;
; Example of Icon type-checking V1.10 (17/08/1999)
; (C) Robert Hutchinson 1999!
; Satanic Dreams Software 1999! [Loki^SD]
;
; Feel free to use this example any way you like ;)
; Please email me with any bug reports or changes please:
;
;   loki@sds.in2home.co.uk
;
; This example will use the NewIcon images if availible and
; will fallback on the Standard images otherwise. NI
; image viewing can be overridden by setting #NIB_OVERRIDE=1
;
; Requirements:
;
;   o NewIconsBlitz installed correctly (see docs)
;   o The NIB_Single_Include.BB2 include (provided)
;   o newicon.library (V4 preferably!)
;
; BTW - This is how your program SHOULD function ;)
;       (Of course depending on what you are doing ;))
;

#NIB_OVERRIDE=0

WbToScreen 0
WBenchToFront_

  XINCLUDE "/NIBIncludes/NIB_Include.BB2"

  ;--- Check our libraries
  ;
  If NIBCheckLibs{}=False
    NPrint "Incorrect or non-present newicon.library/icon.library!"
    End
  EndIf

  If NIBOpenIcon{0,"YAM:YAM"}=False
    NPrint "Cant Load Icon!"
    End
  EndIf

  imgs.b=NIBCheckStruct{0}

  If imgs=0
    simgs.b=STDCheckStruct{0}
    If simgs=0
      NIBFreeIcon{0}
      End
    EndIf
    UseSTD=1
  EndIf

  If #NIB_OVERRIDE=1
    UseSTD=1
  EndIf

  If UseSTD=0
    NIBRemapChunkyData{0,#NIB_BOTH,0}
    If imgs=1
      NormONLY=1
    EndIf
    ImgW.w=NIBFindWidth{0}
    ImgH.w=NIBFindHeight{0}
  Else
    If simgs=1
      NormONLY=1
    EndIf
    STDToImages{0}
    ImgW.w=STDFindWidth{0}
    ImgH.w=STDFindHeight{0}
  EndIf

  If ImgW=0 OR ImgH=0
    NIBFreeIcon{0}
    End
  EndIf

  ;#################################

  Window 0,50,50,ImgW+10,(ImgH*imgs)+11,$0,"",0,1
  DefaultOutput

  ;#################################

  If UseSTD=0
    succ.b=NIBDrawImage{0,#NIB_NORMAL  ,0,5,5}
    If NormONLY=0
      succ.b=NIBDrawImage{0,#NIB_SELECTED,0,5,6+ImgH}
    EndIf
  Else
    succ.b=STDDrawImage{0,#NIB_NORMAL  ,0,5,5}
    If NormONLY=0
      succ.b=STDDrawImage{0,#NIB_SELECTED,0,5,6+ImgH}
    EndIf
  EndIf

  MouseWait

  NIBFreeImages{0,#NIB_BOTH,0}
  NIBFreeIcon{0}
  CloseWindow 0

End


