I don't know if this is much help but basically what I do is write an image button gadget and then place each button seperatly.
The only really annoyance with this system is you can't use the DisableGadget/EnabledGadget/SelectedGadgetItem...ext functions you have to use the SetEnabled/SetSelected methods.
You can quite easilly add your own seperators in by using a label of height 2 and with a flag of LABEL_FRAME.
Heres an example, just save it somewhere and stick 5 png toolbar images in the folder you saved it to.
SuperStrict
Framework brl.glmax2d
Import brl.pngloader
?win32
Import brl.win32maxgui
?macos
Import brl.cocoamaxgui
?linux
Import brl.fltkmaxgui
?
Type TImageButton Extends TGadget
Field Panel:TGadget, Panel2:TGadget
Field Toolbar:TGadget
Method New()
AddHook(EmitEventHook,EventHook,Self)
End Method
Method Delete()
RemoveHook(EmitEventHook,EventHook,Self)
End Method
Method SetEnabled(bool:Int)
If bool = False
DisableGadgetItem(Toolbar,0)
Else
EnableGadgetItem(Toolbar,0)
EndIf
End Method
Method SetSelected(bool:Int)
If bool = False
DeselectGadgetItem(Toolbar,0)
Else
SelectGadgetItem(Toolbar,0)
EndIf
End Method
Method Poll:TEvent(Event:TEvent)
If Event.source = Toolbar
Local ClickEvent:TEvent = TEvent.Create(EVENT_GADGETACTION,Self)
Return ClickEvent
EndIf
Return Event
End Method
Function EventHook:Object(id:Int,data:Object,context:Object)
Return TImageButton(Context).Poll(TEvent(data))
End Function
Function Create:TImageButton(source:Object,x:Int,y:Int,parent:TGadget = Null)
Local Button:TImageButton = New TImageButton
Local TempImage:TImage = LoadImage(source)
Button.Panel = CreatePanel(x,y,ImageWidth(TempImage)+5,ImageHeight(TempImage)+5,parent)
SetGadgetLayout(Button.Panel,EDGE_ALIGNED,EDGE_CENTERED,EDGE_ALIGNED,EDGE_CENTERED)
Button.Panel2 = CreatePanel(0,-1,ImageWidth(TempImage)+5,ImageHeight(TempImage)+5,Button.Panel)
SetGadgetLayout(Button.Panel2,EDGE_ALIGNED,EDGE_CENTERED,EDGE_ALIGNED,EDGE_CENTERED)
Button.Toolbar = CreateToolBar(source,0,0,0,0,Button.Panel2)
Return Button
End Function
End Type
Local Window:TGadget = CreateWindow("Vertical toolbar test",50,50,350,350,Null,WINDOW_TITLEBAR)
Local ToolbarItems:TGadget[5]
For Local i:Int = 0 To 4
ToolbarItems[i] = TImageButton.Create(i+".png",0,0+(i*25),Window)
If i = 1 Then ToolbarItems[i].SetEnabled(False)
If i = 4 Then ToolbarItems[i].SetSelected(True)
Next
Repeat
PollEvent()
Until (EventSource() = Window And EventID() = EVENT_WINDOWCLOSE)
Hope that helps.
|