rem /**
rem * DownloadButton.bbj
rem *
rem * This program demonstrates adding SVG icons to a BBjButton control using
rem * the DWC's built-in icon pools.
rem *
rem */
rem If the app is running in BUI, switch it automatically to run in the DWC client instead
rem ================================================================================
if (info(3, 6) = "5") then
bui! = BBjAPI().getBuiManager()
url! = bui!.getUrl().replaceAll("apps", "webapp")
action! = bui!.urlAction(url!)
bui!.setEndAction(action!)
release
endif
rem Create the window and use a grid layout
window! = BBjAPI().openSysGui("X0").addWindow("DWC Icon Pools", $00100093$)
window!.setPanelStyle("display", "inline-grid")
window!.setPanelStyle("grid-template-columns", "1fr")
window!.setPanelStyle("gap", "var(--bbj-space)")
window!.setPanelStyle("padding", "var(--bbj-space-xl)")
window!.setCallback(BBjAPI.ON_CLOSE, "onExit")
rem Define the HTML title for the buttons that incorporate the download icons
btnIconFeather$ = ""
btnIconTabler$ = ""
btnIconFontAwesome$ = ""
rem Now create the buttons using the HTML for the title
btnFeather! = window!.addButton(btnIconFeather$ + "Feather's Download Icon")
btnTabler! = window!.addButton(btnIconTabler$ + "Tabler's Download Icon")
btnFontAwesome! = window!.addButton(btnIconFontAwesome$ + "Font Awesome's Download Icon")
rem Define the HTML title for the alternate buttons that incorporate the cloud download icons with extra styling for size/color
btnIconFeather$ = ""
btnIconTabler$ = ""
btnIconFontAwesome$ = ""
rem Now create the buttons using the HTML for the title
btnFeather! = window!.addButton(btnIconFeather$ + "Feather's Cloud Download Icon")
btnTabler! = window!.addButton(btnIconTabler$ + "Tabler's Cloud Download Icon")
btnFontAwesome! = window!.addButton(btnIconFontAwesome$ + "Font Awesome's Cloud Download Icon")
rem Add a custom icon pool referencing the ionicons library from a CDN
rem @see https://ionic.io/ionicons for the icons
iconLibraryName! = "ionicons"
resolverPathCdn! = "https://cdnjs.cloudflare.com/ajax/libs/ionicons/6.0.2/svg/${name}.svg"
myIconPool! = "(window.BBj ??= {}).IconsPools ??= []; window.BBj.IconsPools.push({ name: '" + iconLibraryName! + "', resolver: name => `" + resolverPathCdn! + "` });"
BBjAPI().getSysGui().executeScript(myIconPool!)
rem Define the HTML title for the buttons that incorporate the bootstrap icons
btnIconIon1$ = ""
btnIconIon2$ = ""
rem Now create the buttons using the HTML for the title
btnIonIcon1! = window!.addButton(btnIconIon1$ + "IonIcons's Cloud Download Icon")
btnIonIcon2! = window!.addButton(btnIconIon2$ + "IonIcons's Cloud Download Icon Filled")
window!.setVisible(1)
process_events
rem ================================================================================================
rem Subroutines
rem ================================================================================================
rem Handle the user exiting the app
onExit:
release