from pyfbsdk import *
from pyfbsdk_additions import *
regionStyles = {
"No Border" : FBBorderStyle.kFBNoBorder,
"Standard" : FBBorderStyle.kFBStandardBorder,
"Emboss" : FBBorderStyle.kFBEmbossBorder,
"EmbossEdgeSmooth" : FBBorderStyle.kFBEmbossEdgeSmoothBorder,
"EmbossSmooth" : FBBorderStyle.kFBEmbossSmoothBorder,
"EmbossSmoothEdge" : FBBorderStyle.kFBEmbossSmoothEdgeBorder,
"Highlight" : FBBorderStyle.kFBHighlightBorder,
"Picking" : FBBorderStyle.kFBPickingBorder,
"Standard (again)" : FBBorderStyle.kFBStandardBorder,
"StandardEdgeSmooth" : FBBorderStyle.kFBStandardEdgeSmoothBorder,
"StandardSmooth" : FBBorderStyle.kFBStandardSmoothBorder,
"StandardSmoothEdge" : FBBorderStyle.kFBStandardSmoothEdgeBorder
}
def OnInset(control,event):
for name, style in regionStyles.iteritems():
regionLyt.SetBorder(name,style,True, control.State,2,2,90,0)
def PopulateLayout(mainLyt):
x = FBAddRegionParam(10, FBAttachType.kFBAttachLeft, "")
y = FBAddRegionParam(10, FBAttachType.kFBAttachTop, "")
w = FBAddRegionParam(120,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(25,FBAttachType.kFBAttachNone,"")
cb = FBButton()
cb.Style = FBButtonStyle.kFBCheckbox
cb.Caption = "Inset"
cb.OnClick.Add(OnInset)
mainLyt.AddRegion("Inset", "Inset",x,y,w,h)
mainLyt.SetControl("Inset",cb)
global regionLyt
regionLyt = mainLyt
regionNames = regionStyles.keys()
yAttach = FBAttachType.kFBAttachBottom
yAttachTo = "Inset"
for i in range(3):
xAttach = FBAttachType.kFBAttachLeft
xAttachTo = ""
for j in range(4):
x = FBAddRegionParam(10, xAttach, xAttachTo)
y = FBAddRegionParam(10, yAttach, yAttachTo)
w = FBAddRegionParam(120,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(100,FBAttachType.kFBAttachNone,"")
regionName = regionNames[i * 4 + j]
mainLyt.AddRegion(regionName,regionName, x, y, w, h)
mainLyt.SetBorder(regionName,regionStyles[regionName],True, False,2,2,90,0)
xAttach = FBAttachType.kFBAttachRight
xAttachTo = regionName
yAttach = FBAttachType.kFBAttachBottom
yAttachTo = regionName
def CreateTool():
t = CreateUniqueTool("Regions")
t.StartSizeX = 600
t.StartSizeY = 400
PopulateLayout(t)
ShowTool(t)
CreateTool()