Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 7c8d1b7

Browse files
author
runrevali
committed
[[ Packaged Extensions ]] Tweak docs of packaged extensions
1 parent c989492 commit 7c8d1b7

15 files changed

Lines changed: 916 additions & 1563 deletions

File tree

extensions/libraries/canvas/canvas.lcb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Description:
5656
Creates a canvas of the given size for the other handlers to use.
5757
*/
5858

59-
public handler canvasCreate(in pWidth as integer, in pHeight as integer) as undefined
59+
public handler canvasCreate(in pWidth as Integer, in pHeight as Integer) as undefined
6060
-- Create a new canvas, this will release any previous canvas.
6161
put a new canvas with size [ pWidth, pHeight ] into sCanvas
6262
-- Set the paint to opaque black and fill the whole area.
@@ -85,7 +85,7 @@ pAlpha: The alpha value of the color to set.
8585
Description:
8686
Sets the current color of the canvas to the given RGBA value.
8787
*/
88-
public handler canvasSetColor(in pRed as real, in pGreen as real, in pBlue as real, in pAlpha as real) as undefined
88+
public handler canvasSetColor(in pRed as Real, in pGreen as Real, in pBlue as Real, in pAlpha as Real) as undefined
8989
set the paint of sCanvas to solid paint with color [pRed, pGreen, pBlue, pRed]
9090
end handler
9191

@@ -97,7 +97,7 @@ pRadius: The radius of the circle.
9797
Description:
9898
Fills a circle of the given radius at the given position in the canvas.
9999
*/
100-
public handler canvasFillCircle(in pX as real, in pY as real, in pRadius as real) as undefined
100+
public handler canvasFillCircle(in pX as Real, in pY as Real, in pRadius as Real) as undefined
101101
fill circle path centered at point [pX, pY] with radius pRadius on sCanvas
102102
end handler
103103

@@ -108,7 +108,7 @@ pObjectId: A string which is an object chunk referring to an image.
108108
Description:
109109
This handler copies the current contents of the canvas to the specified image object.
110110
*/
111-
public handler canvasApplyToImage(in pObjectId as string) as undefined
111+
public handler canvasApplyToImage(in pObjectId as String) as undefined
112112
variable tObject as ScriptObject
113113

114114
-- Resolving the script object gets a weak reference to the specified

extensions/widgets/button/button.lcb

Lines changed: 17 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,20 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
1919
This widget is a push button that dispatches mouse events to its script object.
2020
This widget has three properties that can be set: theme; buttonStyle and label.
2121
*/
22-
22+
2323
-- declaring the extension as a widget, followed by the identifier
2424
widget com.livecode.extensions.livecode.button
2525
--
2626

27-
-- adding metadata to ensure the extension displays correctly in livecode
28-
metadata author is "LiveCode"
29-
metadata version is "1.0.2"
30-
metadata title is "Cross Platform Button"
31-
--
32-
3327
-- dependancy declarations
3428
use com.livecode.canvas
3529
use com.livecode.widget
3630
use com.livecode.engine
37-
--
31+
32+
-- metadata
33+
metadata author is "LiveCode"
34+
metadata version is "1.0.2"
35+
metadata title is "Cross Platform Button"
3836

3937
-- property declarations
4038
property theme get mTheme set setTheme
@@ -56,9 +54,7 @@ constant kWhite is [1,1,1]
5654
constant kBlack is [0,0,0]
5755
--
5856

59-
----------
60-
-- this handler is called when the widget is saved
61-
public handler OnSave(out rProperties as array)
57+
public handler OnSave(out rProperties as Array)
6258
put the empty array into rProperties
6359

6460
put mTheme into rProperties["theme"]
@@ -67,29 +63,20 @@ public handler OnSave(out rProperties as array)
6763

6864
return rProperties
6965
end handler
70-
----------
7166

72-
----------
73-
-- this handler is called when the widget is loaded
74-
public handler OnLoad(in pProperties as array)
67+
public handler OnLoad(in pProperties as Array)
7568
put pProperties["theme"] into mTheme
7669
put pProperties["buttonstyle"] into mStyle
7770
put pProperties["label"] into mLabel
7871
end handler
79-
----------
8072

81-
----------
82-
-- this handler is called when the widget is created
8373
public handler OnCreate() as undefined
8474
put "ios-8" into mTheme
8575
put "Button" into mLabel
8676
put "default" into mStyle
8777
put "none" into mState
8878
end handler
89-
----------
9079

91-
----------
92-
-- this handler is called whenever the widget is drawn
9380
public handler OnPaint() as undefined
9481

9582
// Draw the shadow
@@ -111,10 +98,7 @@ public handler OnPaint() as undefined
11198
set the paint of this canvas to getPaint_TextFill()
11299
fill text mLabel at center of my bounds on this canvas
113100
end handler
114-
----------
115101

116-
----------
117-
-- the following handlers are for mouse actions
118102
public handler OnMouseDown() as undefined
119103
put "pressed" into mState
120104
redraw all
@@ -140,18 +124,12 @@ public handler OnMouseLeave() as undefined
140124
redraw all
141125
end if
142126
end handler
143-
----------
144127

145-
----------
146-
-- this handler returns the stroke width
147-
private handler getStrokeWidth() as integer
128+
private handler getStrokeWidth() as Integer
148129
return 1
149130
end handler
150-
----------
151131

152-
----------
153-
-- this handler returns the corner radius
154-
private handler getCornerRadius() as integer
132+
private handler getCornerRadius() as Integer
155133
if mTheme is "ios-8" then
156134
return 9
157135
else if mTheme is "macos-10.10" then
@@ -160,22 +138,16 @@ private handler getCornerRadius() as integer
160138

161139
return 10
162140
end handler
163-
----------
164141

165-
----------
166-
-- this handler returns a font name as a string
167-
private handler getFontName() as string
142+
private handler getFontName() as String
168143
if mTheme is "ios-8" then
169144
return "Helvetica Neue"
170145
end if
171146

172147
return the name of the font of this canvas
173148
end handler
174-
----------
175149

176-
----------
177-
-- this handler returns the font size
178-
private handler getFontSize() as integer
150+
private handler getFontSize() as Integer
179151
if mTheme is "ios-8" then
180152
if my height >= kMaxHeight then
181153
return 42
@@ -188,10 +160,7 @@ private handler getFontSize() as integer
188160

189161
return 11
190162
end handler
191-
----------
192163

193-
----------
194-
-- this handler returns a paint for the background fill
195164
private handler getPaint_BackgroundFill() as Paint
196165
if mTheme is "ios-8" then
197166
if mState is "pressed" then
@@ -201,7 +170,7 @@ private handler getPaint_BackgroundFill() as Paint
201170
end if
202171

203172
else if mTheme is "macos-10.10" then
204-
variable tStops as list
173+
variable tStops as List
205174
if mStyle is "default" and mState is "pressed" then
206175
put [ gradient stop at 0.0 with color [76/255,150/255,252/255], gradient stop at 1.0 with color [16/255,103/255,227/255] ] into tStops
207176
else if mStyle is "default" then
@@ -224,15 +193,12 @@ private handler getPaint_BackgroundFill() as Paint
224193

225194
return solid paint with color kWhite
226195
end handler
227-
----------
228196

229-
----------
230-
-- this handler returns a paint for the background stroke
231197
private handler getPaint_BackgroundStrokeFill() as Paint
232198
if mTheme is "ios-8" then
233199
return solid paint with color kWhite
234200
else if mTheme is "macos-10.10" then
235-
variable tStops as list
201+
variable tStops as List
236202
if mStyle is "default" and mState is "pressed" then
237203
put [ gradient stop at 0.0 with color [40/255,125/255,253/255], gradient stop at 1.0 with color [8/255,63/255,220/255] ] into tStops
238204
else if mStyle is "default" then
@@ -255,10 +221,7 @@ private handler getPaint_BackgroundStrokeFill() as Paint
255221

256222
return solid paint with color kWhite
257223
end handler
258-
----------
259224

260-
----------
261-
-- this handler returns a paint for the text
262225
private handler getPaint_TextFill() as Paint
263226
if mTheme is "ios-8" then
264227
return solid paint with color [51/255,153/255,1]
@@ -275,63 +238,22 @@ private handler getPaint_TextFill() as Paint
275238

276239
return solid paint with color kBlack
277240
end handler
278-
----------
279-
280-
----------
281-
-- this handler sets the theme of the button
282-
283-
/*
284-
Summary: Sets the theme of the button
285241

286-
Parameters:
287-
pThemeName: The name of the theme.
288-
289-
Description:
290-
Sets the theme property of the button to either "macos-10" or "ios-8".
291-
*/
292-
293-
public handler setTheme(in pThemeName as string) as undefined
242+
public handler setTheme(in pThemeName as String) as undefined
294243
put pThemeName into mTheme
295244
redraw all
296245
end handler
297-
----------
298246

299-
/*
300-
Summary: Sets the label of the button
301-
302-
Parameters:
303-
pLabel: The text of the label.
304-
305-
Description:
306-
Sets the text of the label property to any string.
307-
*/
308-
309-
----------
310-
-- this handler sets the label of the button
311-
private handler setLabel(in pLabel as string) as undefined
247+
private handler setLabel(in pLabel as String) as undefined
312248
put pLabel into mLabel
313249
redraw all
314250
end handler
315-
----------
316-
317-
/*
318-
Summary: Sets the style of the button
319-
320-
Parameters:
321-
pStyle: The name of the style.
322-
323-
Description:
324-
Sets the style property of the button to either "standard" or "default".
325-
*/
326251

327-
----------
328-
-- this handler sets the style of the button
329-
private handler setStyle(in pStyle as string) as undefined
252+
private handler setStyle(in pStyle as String) as undefined
330253
if pStyle is in ["standard","default"] then
331254
put pStyle into mStyle
332255
redraw all
333256
end if
334257
end handler
335-
----------
336258

337259
end widget

0 commit comments

Comments
 (0)