-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAppleTextbox.lua
More file actions
53 lines (45 loc) · 1.69 KB
/
AppleTextbox.lua
File metadata and controls
53 lines (45 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- AppleTextbox.lua
AppleTextbox = class(Panel)
function AppleTextbox:init(label,x,y,w,args)
local h = 50
Panel.init(self,x,y)
-- create the label
args = args or {}
args.text = args.text or {}
args.text.fontSize = 21
args.text.textMode = CORNER
self.banner = TextBanner(label,0,0,w,h,args)
local tw,th = self.banner.textElem:textSize()
self.banner.textElem:translate(15 - self.banner.textElem.x,-th/2)
self:add(self.banner)
-- add the textbox
local tx = tw+30
self.textbox = Textbox(tx,0,w-tx-1)
self.textbox.background = color(0,0,0,0)
self.textbox.cursorColor = color(0, 9, 255, 255)
self.textbox.cursorWidth = 3
self.textbox.cursorMarginY = -1
self.textbox.fontProperties.fill=color(46, 112, 112, 255)
self.textbox.fontProperties.font = "ArialRoundedMTBold"
self.textbox.align = "LEFT"
self.textbox:setFontSize(21)
self.textbox:translate(0,(h-self.textbox.h)/2)
self:add(self.textbox)
end
function AppleTextbox:touched(t)
Panel.touched(self,t)
-- deal with shadow text
if not self.textbox.selected and self.textbox.text == "" and self.shadowText then
self.textbox.text = self.shadowText
self.textbox.textIsShadow = true
self.textbox.fontProperties.font = "Arial-BoldItalicMT"
self.textbox.fontProperties.fill=color(129, 140, 140, 255)
end
if self.textbox.selected and self.textbox.textIsShadow then
self.textbox.text = ""
self.textbox.cursorPos = 0
self.textbox.textIsShadow = false
self.textbox.fontProperties.font = "ArialRoundedMTBold"
self.textbox.fontProperties.fill=color(46, 112, 112, 255)
end
end