summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--simplegui.mod/simplegui.bmx116
1 files changed, 58 insertions, 58 deletions
diff --git a/simplegui.mod/simplegui.bmx b/simplegui.mod/simplegui.bmx
index 39cd5f5..e7e2319 100644
--- a/simplegui.mod/simplegui.bmx
+++ b/simplegui.mod/simplegui.bmx
@@ -39,7 +39,7 @@ Import noddybox.bitmapfont
Rem
bbdoc: Defines the @TBitmapFont to be used by the GUI.
EndRem
-Type TGUIFont
+Type TSGUIFont
Rem
bbdoc: The font to use.
EndRem
@@ -250,15 +250,15 @@ Type TLabel Extends TWidget
o.consumes=0
o.x=x
o.y=y
- o.w=TGUIFont.font.TextWidth(text)+2
- o.h=TGUIFont.font.MaxHeight()+1
+ o.w=TSGUIFont.font.TextWidth(text)+2
+ o.h=TSGUIFont.font.MaxHeight()+1
o.text=text
gui.Register(o)
Return o
End Function
Method Draw()
- TGUIFont.font.Draw(text,x+1,y+1)
+ TSGUIFont.font.Draw(text,x+1,y+1)
End Method
End Type
@@ -316,8 +316,8 @@ Type TText Extends TWidget
o.x=x
o.y=y
o.maxlen=maxlen
- o.w=TGUIFont.font.MaxWidth()*(maxlen+1)+2
- o.h=TGUIFont.font.MaxHeight()+2
+ o.w=TSGUIFont.font.MaxWidth()*(maxlen+1)+2
+ o.h=TSGUIFont.font.MaxHeight()+2
o.text=text
o.callback=callback
o.mode=mode
@@ -405,7 +405,7 @@ Type TText Extends TWidget
DrawRect(x,y,w,h)
- TGUIFont.font.Draw(s,x+1,y+1)
+ TSGUIFont.font.Draw(s,x+1,y+1)
End Method
End Type
@@ -432,8 +432,8 @@ Type TCheckbox Extends TWidget
o.consumes=HAS_CLICK
o.x=x
o.y=y
- o.w=TGUIFont.font.TextWidth(" "+text)+4+TGUIFont.font.MaxHeight()
- o.h=TGUIFont.font.MaxHeight()+2
+ o.w=TSGUIFont.font.TextWidth(" "+text)+4+TSGUIFont.font.MaxHeight()
+ o.h=TSGUIFont.font.MaxHeight()+2
o.text=text
o.callback=callback
gui.Register(o)
@@ -455,14 +455,14 @@ Type TCheckbox Extends TWidget
SetColor(200,200,200)
EndIf
- DrawBox(x,y,TGUIFont.font.MaxHeight(),TGUIFont.font.MaxHeight())
+ DrawBox(x,y,TSGUIFont.font.MaxHeight(),TSGUIFont.font.MaxHeight())
If checked
SetColor(255,100,100)
- DrawRect(x+1,y+1,TGUIFont.font.MaxHeight()-2,TGUIFont.font.MaxHeight()-2)
+ DrawRect(x+1,y+1,TSGUIFont.font.MaxHeight()-2,TSGUIFont.font.MaxHeight()-2)
EndIf
- TGUIFont.font.Draw(" "+text,x+2+TGUIFont.font.MaxHeight(),y+1)
+ TSGUIFont.font.Draw(" "+text,x+2+TSGUIFont.font.MaxHeight(),y+1)
End Method
End Type
@@ -490,8 +490,8 @@ Type TButton Extends TWidget
o.w=w
o.h=h
o.text=text
- o.ox=x+w/2-TGUIFont.font.TextWidth(text)/2
- o.oy=y+h/2-TGUIFont.font.TextHeight(text)/2
+ o.ox=x+w/2-TSGUIFont.font.TextWidth(text)/2
+ o.oy=y+h/2-TSGUIFont.font.TextHeight(text)/2
o.callback=callback
gui.Register(o)
Return o
@@ -511,7 +511,7 @@ Type TButton Extends TWidget
Draw3DBox(x+1,y+1,w-2,h-2,False,2)
- TGUIFont.font.Draw(text,ox,oy)
+ TSGUIFont.font.Draw(text,ox,oy)
End Method
End Type
@@ -546,11 +546,11 @@ Type TButtonList Extends TWidget
o.text=options[selected]
For Local s:String=EachIn options
- maxw=Max(maxw,TGUIFont.font.TextWidth(s))
+ maxw=Max(maxw,TSGUIFont.font.TextWidth(s))
Next
- o.w=maxw+TGUIFont.font.MaxHeight()+4
- o.h=TGUIFont.font.MaxHeight()+2
+ o.w=maxw+TSGUIFont.font.MaxHeight()+4
+ o.h=TSGUIFont.font.MaxHeight()+2
o.callback=callback
gui.Register(o)
Return o
@@ -578,7 +578,7 @@ Type TButtonList Extends TWidget
DrawRect(x,y,w,h)
Draw3DBox(x+2,y+2,h-4,h-4,False,1)
- TGUIFont.font.Draw(text,x+TGUIFont.font.MaxHeight()+3,y+1)
+ TSGUIFont.font.Draw(text,x+TSGUIFont.font.MaxHeight()+3,y+1)
End Method
End Type
@@ -639,7 +639,7 @@ Type TTextList Extends TWidget
o.rows=rows
o.w=w
- o.h=TGUIFont.font.MaxHeight()*rows
+ o.h=TSGUIFont.font.MaxHeight()*rows
o.callback=callback
gui.Register(o)
Return o
@@ -716,7 +716,7 @@ Type TTextList Extends TWidget
Method HandleClick()
If options<>Null
- Local sel:Int=top+(MouseY()-y)/TGUIFont.font.MaxHeight()
+ Local sel:Int=top+(MouseY()-y)/TSGUIFont.font.MaxHeight()
If sel<num
selected=sel
@@ -741,19 +741,19 @@ Type TTextList Extends TWidget
Local ty:Int=y
For Local f:Int=top Until top+rows
- SetViewport(x,ty,w,TGUIFont.font.MaxHeight())
+ SetViewport(x,ty,w,TSGUIFont.font.MaxHeight())
If f=selected
- If mouse_over And MouseY()>=ty And MouseY()<ty+TGUIFont.font.MaxHeight()
+ If mouse_over And MouseY()>=ty And MouseY()<ty+TSGUIFont.font.MaxHeight()
SetColor(200,128,128)
Else
SetColor(128,128,128)
EndIf
- DrawRect(x,ty,w,TGUIFont.font.MaxHeight())
+ DrawRect(x,ty,w,TSGUIFont.font.MaxHeight())
Else
- If mouse_over And MouseY()>=ty And MouseY()<ty+TGUIFont.font.MaxHeight() And f<num
+ If mouse_over And MouseY()>=ty And MouseY()<ty+TSGUIFont.font.MaxHeight() And f<num
SetColor(128,0,0)
- DrawRect(x,ty,w,TGUIFont.font.MaxHeight())
+ DrawRect(x,ty,w,TSGUIFont.font.MaxHeight())
EndIf
EndIf
@@ -762,14 +762,14 @@ Type TTextList Extends TWidget
If li<>Null
For Local f:Int=0 Until li.Columns()
- TGUIFont.font.Draw(li.ColumnData(f),x+li.ColumnOffset(f),ty)
+ TSGUIFont.font.Draw(li.ColumnData(f),x+li.ColumnOffset(f),ty)
Next
Else
- TGUIFont.font.Draw(options[f].ToString(),x,ty)
+ TSGUIFont.font.Draw(options[f].ToString(),x,ty)
EndIf
EndIf
- ty:+TGUIFont.font.MaxHeight()
+ ty:+TSGUIFont.font.MaxHeight()
Next
SetViewport(vx,vy,vw,vh)
@@ -818,8 +818,8 @@ Type TNumberDouble Extends TWidget
o.change=10
o.x=x
o.y=y
- o.w=TGUIFont.font.MaxHeight()*2+8
- o.h=TGUIFont.font.MaxHeight()+2
+ o.w=TSGUIFont.font.MaxHeight()*2+8
+ o.h=TSGUIFont.font.MaxHeight()+2
o.callback=callback
gui.Register(o)
Return o
@@ -860,7 +860,7 @@ Type TNumberDouble Extends TWidget
Draw3DBox(x+2,y+2,h-4,h-4,False,1)
Draw3DBox(x+w-h,y+2,h-4,h-4,False,1)
- TGUIFont.font.Draw(value,x+w+2,y+1)
+ TSGUIFont.font.Draw(value,x+w+2,y+1)
End Method
End Type
@@ -906,8 +906,8 @@ Type TNumberInt Extends TWidget
o.change=10
o.x=x
o.y=y
- o.w=TGUIFont.font.MaxHeight()*2+8
- o.h=TGUIFont.font.MaxHeight()+2
+ o.w=TSGUIFont.font.MaxHeight()*2+8
+ o.h=TSGUIFont.font.MaxHeight()+2
o.callback=callback
gui.Register(o)
Return o
@@ -948,7 +948,7 @@ Type TNumberInt Extends TWidget
Draw3DBox(x+2,y+2,h-4,h-4,False,1)
Draw3DBox(x+w-h,y+2,h-4,h-4,False,1)
- TGUIFont.font.Draw(value,x+w+2,y+1)
+ TSGUIFont.font.Draw(value,x+w+2,y+1)
End Method
End Type
@@ -1264,10 +1264,10 @@ Function GUINotify(s:String, i:TImage=Null)
Local txt:TSplitText=TSplitText.Create(s)
Local w:Int=Max(txt.width+10,GraphicsWidth()/4)
- Local h:Int=txt.Height+TGUIFont.font.MaxHeight()*4
+ Local h:Int=txt.Height+TSGUIFont.font.MaxHeight()*4
Local x:Int=GraphicsWidth()/2-w/2
Local y=GraphicsHeight()/2-h/2
- Local by=y+h-TGUIFont.font.MaxHeight()*2.5
+ Local by=y+h-TSGUIFont.font.MaxHeight()*2.5
Local gui:TGUIHandler=TGUIHandler.Create()
@@ -1275,10 +1275,10 @@ Function GUINotify(s:String, i:TImage=Null)
For Local t:String=EachIn txt.lines
Local label:TLabel=TLabel.Create(gui,x+5,ty,t)
- ty:+TGUIFont.font.TextHeight(t)
+ ty:+TSGUIFont.font.TextHeight(t)
Next
- Local button:TButton=TButton.Create(gui,x+5,by,w-10,TGUIFont.font.MaxHeight()*2,"OK",Null)
+ Local button:TButton=TButton.Create(gui,x+5,by,w-10,TSGUIFont.font.MaxHeight()*2,"OK",Null)
Local click:TWidget=Null
@@ -1312,10 +1312,10 @@ Function GUIYesNo:Int(s:String, i:TImage=Null)
Local txt:TSplitText=TSplitText.Create(s)
Local w:Int=Max(txt.width+10,GraphicsWidth()/4)
- Local h:Int=txt.Height+TGUIFont.font.MaxHeight()*4
+ Local h:Int=txt.Height+TSGUIFont.font.MaxHeight()*4
Local x:Int=GraphicsWidth()/2-w/2
Local y=GraphicsHeight()/2-h/2
- Local by=y+h-TGUIFont.font.MaxHeight()*2.5
+ Local by=y+h-TSGUIFont.font.MaxHeight()*2.5
Local gui:TGUIHandler=TGUIHandler.Create()
@@ -1323,11 +1323,11 @@ Function GUIYesNo:Int(s:String, i:TImage=Null)
For Local t:String=EachIn txt.lines
Local label:TLabel=TLabel.Create(gui,x+5,ty,t)
- ty:+TGUIFont.font.TextHeight(t)
+ ty:+TSGUIFont.font.TextHeight(t)
Next
- Local yes:TButton=TButton.Create(gui,x+5,by,w/2-10,TGUIFont.font.MaxHeight()*2,"Yes",Null)
- Local no:TButton=TButton.Create(gui,x+w/2+5,by,w/2-10,TGUIFont.font.MaxHeight()*2,"No",Null)
+ Local yes:TButton=TButton.Create(gui,x+5,by,w/2-10,TSGUIFont.font.MaxHeight()*2,"Yes",Null)
+ Local no:TButton=TButton.Create(gui,x+w/2+5,by,w/2-10,TSGUIFont.font.MaxHeight()*2,"No",Null)
Local click:TWidget=Null
@@ -1363,12 +1363,12 @@ Function GUIMenu(title:String, options:String[], x:Int, y:Int, i:TImage=Null)
Local back:TImage=CreateImage(GraphicsWidth(),GraphicsHeight(),1,0)
GrabImage(back,0,0)
- Local st:Int=TGUIFont.font.MaxHeight()*2
- Local h:Int=TGUIFont.font.MaxHeight()*3
- Local w:Int=TGUIFont.font.TextWidth(title)+30
+ Local st:Int=TSGUIFont.font.MaxHeight()*2
+ Local h:Int=TSGUIFont.font.MaxHeight()*3
+ Local w:Int=TSGUIFont.font.TextWidth(title)+30
For f=0 Until options.length
- w=Max(w,TGUIFont.font.TextWidth(options[f])+30)
+ w=Max(w,TSGUIFont.font.TextWidth(options[f])+30)
h:+st
Next
@@ -1381,7 +1381,7 @@ Function GUIMenu(title:String, options:String[], x:Int, y:Int, i:TImage=Null)
Local button:TButton[]=New TButton[options.length]
For f=0 Until options.length
- button[f]=TButton.Create(gui,x+5,y+TGUIFont.font.MaxHeight()*2+f*st,w-10,st-2,options[f],Null)
+ button[f]=TButton.Create(gui,x+5,y+TSGUIFont.font.MaxHeight()*2+f*st,w-10,st-2,options[f],Null)
Next
Local click:TWidget=Null
@@ -1427,8 +1427,8 @@ Function GUIFileSelect:String(title:String, file:String, save:Int, i:TImage=Null
Local fn:String
Local sw:Int=GraphicsWidth()
Local sh:Int=GraphicsHeight()
- Local fh:Int=TGUIFont.font.MaxHeight()
- Local fw:Int=TGUIFont.font.MaxWidth()
+ Local fh:Int=TSGUIFont.font.MaxHeight()
+ Local fw:Int=TSGUIFont.font.MaxWidth()
Local rows:Int=(sh-fh*10)/fh
If file<>Null And file<>""
@@ -1464,7 +1464,7 @@ Function GUIFileSelect:String(title:String, file:String, save:Int, i:TImage=Null
fntext=TText.Create(gui,20,sh-fh*6,fn,(sw-40)/fw,TText.READONLY)
EndIf
- Local bw:Int=TGUIFont.font.MaxWidth()*9
+ Local bw:Int=TSGUIFont.font.MaxWidth()*9
Local cancel:TButton=TButton.Create(gui,sw-bw-20,sh-fh*3.5,bw,fh*2.5,"Cancel",Null)
Local ok:Tbutton=TButton.Create(gui,cancel.x-bw-10,cancel.y,bw,fh*2.5,"OK",Null)
@@ -1479,7 +1479,7 @@ Function GUIFileSelect:String(title:String, file:String, save:Int, i:TImage=Null
gui.EventLoop()
- TGUIFont.font.Draw(CurrentDir(),list.x,list.y+list.h+3)
+ TSGUIFont.font.Draw(CurrentDir(),list.x,list.y+list.h+3)
Local click:TWidget=gui.Clicked()
@@ -1588,8 +1588,8 @@ Type TSplitText
Local c:Int=s[f]
If c=Asc("|")
o.lines.AddLast(sub)
- o.width=Max(o.width,TGUIFont.font.TextWidth(sub))
- o.height:+TGUIFont.font.TextHeight(sub)
+ o.width=Max(o.width,TSGUIFont.font.TextWidth(sub))
+ o.height:+TSGUIFont.font.TextHeight(sub)
sub=""
Else
sub:+Chr(c)
@@ -1598,8 +1598,8 @@ Type TSplitText
If sub.length>0
o.lines.AddLast(sub)
- o.width=Max(o.width,TGUIFont.font.TextWidth(sub))
- o.height:+TGUIFont.font.TextHeight(sub)
+ o.width=Max(o.width,TSGUIFont.font.TextWidth(sub))
+ o.height:+TSGUIFont.font.TextHeight(sub)
EndIf
Return o
@@ -1651,7 +1651,7 @@ Type TDirEntry Extends TTextListItem
If i=0
Return 0
Else
- Return GraphicsWidth()-TGUIFont.font.MaxWidth()*20
+ Return GraphicsWidth()-TSGUIFont.font.MaxWidth()*20
EndIf
End Method