Advertisement
deseven

pb_toolbar

Feb 25th, 2015
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Enumeration
  2.   #largeIcon
  3.   #smallIcon
  4.   #list
  5.   #report
  6. EndEnumeration
  7.  
  8. ; вот тебе кстати простейшее рисование картинок
  9. Procedure createButtons()
  10.   CreateImage(#largeIcon,16,16)
  11.   StartDrawing(ImageOutput(#largeIcon))
  12.   Box(0,0,16,16,$eeeeee)
  13.   Box(4,4,8,8,$990000)
  14.   StopDrawing()
  15.   CreateImage(#smallIcon,16,16)
  16.   StartDrawing(ImageOutput(#smallIcon))
  17.   Box(0,0,16,16,$eeeeee)
  18.   Box(3,3,4,4,$990000)
  19.   Box(9,3,4,4,$990000)
  20.   Box(3,9,4,4,$990000)
  21.   Box(9,9,4,4,$990000)
  22.   StopDrawing()
  23.   CreateImage(#list,16,16)
  24.   StartDrawing(ImageOutput(#list))
  25.   Box(0,0,16,16,$eeeeee)
  26.   Box(3,3,10,4,$990000)
  27.   Box(3,9,10,4,$990000)
  28.   StopDrawing()
  29.   CreateImage(#report,16,16)
  30.   StartDrawing(ImageOutput(#report))
  31.   Box(0,0,16,16,$eeeeee)
  32.   Box(3,3,4,10,$990000)
  33.   Box(9,3,4,10,$990000)
  34.   StopDrawing()
  35. EndProcedure
  36.  
  37. Procedure toggleButton(button.l)
  38.   SetToolBarButtonState(0,#largeIcon,#False)
  39.   SetToolBarButtonState(0,#smallIcon,#False)
  40.   SetToolBarButtonState(0,#list,#False)
  41.   SetToolBarButtonState(0,#report,#False)
  42.   SetToolBarButtonState(0,button,#True)
  43. EndProcedure
  44.  
  45. OpenWindow(0,200,200,500,300,"Открывалка файлов",#PB_Window_SystemMenu)
  46. SetWindowColor(0,$eeeeee)
  47. createButtons()
  48. CreateToolBar(0,WindowID(0))
  49. ToolBarImageButton(#largeIcon,ImageID(#largeIcon),#PB_ToolBar_Toggle)
  50. ToolBarImageButton(#smallIcon,ImageID(#smallIcon),#PB_ToolBar_Toggle)
  51. ToolBarImageButton(#list,ImageID(#list),#PB_ToolBar_Toggle)
  52. ToolBarImageButton(#report,ImageID(#report),#PB_ToolBar_Toggle)
  53. ToolBarToolTip(0,#largeIcon,"Large icon")
  54. ToolBarToolTip(0,#smallIcon,"Small icon")
  55. ToolBarToolTip(0,#list,"List")
  56. ToolBarToolTip(0,#report,"Report")
  57. folders = ExplorerListGadget(#PB_Any,0,ToolBarHeight(0),500,300-ToolBarHeight(0),dir$)
  58. SetGadgetAttribute(folders,#PB_Explorer_DisplayMode,#PB_Explorer_LargeIcon)
  59. toggleButton(#largeIcon)
  60.  
  61. Repeat
  62.   event = WaitWindowEvent()
  63.   If event = #PB_Event_Menu
  64.     Select EventMenu()
  65.       Case #largeIcon
  66.         value = #PB_Explorer_LargeIcon
  67.       Case #smallIcon
  68.         value = #PB_Explorer_SmallIcon
  69.       Case #list
  70.         value = #PB_Explorer_List    
  71.       Case #report
  72.         value = #PB_Explorer_Report  
  73.     EndSelect
  74.     SetGadgetAttribute(folders,#PB_Explorer_DisplayMode,value)
  75.     toggleButton(EventMenu())
  76.   EndIf
  77.  
  78. Until event = #PB_Event_CloseWindow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement