Skip to content

Commit 215232e

Browse files
author
livecodeali
committed
[[ SVG Icon ]] Document svg icon widget
1 parent 4a00651 commit 215232e

File tree

2 files changed

+152
-2
lines changed

2 files changed

+152
-2
lines changed

docs/notes/bugfix-15808.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Widgets: SVG Icon widget not documented

extensions/widgets/svgpath/svgpath.lcb

Lines changed: 151 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,169 @@ private variable mMaintainAspectRatio as Boolean
2424
private variable mFlipVertically as Boolean // some SVG Paths need to be flipped (all font awesome SVG paths do, Illustrator SVG does not)
2525
private variable mAngle as Real
2626
variable mPathName as String
27+
28+
/*
29+
Syntax:
30+
set the iconColor of <widget> to <pColor>
31+
get the iconColor of <widget>
32+
33+
Summary: Determines the color of the icon.
34+
35+
Parameters:
36+
pColor: The color of the icon, in RGB or RGBA format
37+
38+
Example: set the iconColor of widget "SVG Icon" to "255,255,0,128"
39+
40+
Description:
41+
Use the iconColor property to set the color of the widget icon. The color is
42+
in the form of a 3 or 4 item string, the 4th optional item being the alpha value,
43+
all between 0 and 255.
44+
45+
*/
46+
2747
property iconColor get getColor set setColor
28-
metadata iconColor.editor is "com.livecode.pi.color"
48+
metadata iconColor.editor is "com.livecode.pi.colorwithalpha"
49+
50+
/*
51+
Syntax:
52+
set the iconHiliteColor of <widget> to <pColor>
53+
get the iconHiliteColor of <widget>
54+
55+
Summary: Determines the color of the icon when clicked.
56+
57+
Parameters:
58+
pColor: The color of the iconwhen clicked, in RGB or RGBA format
59+
60+
Example: set the iconHiliteColor of widget "SVG Icon" to "255,255,0,128"
61+
62+
Description:
63+
Use the iconHiliteColor property to set the color of the widget icon when clicked.
64+
The color is in the form of a 3 or 4 item string, the 4th optional item being the
65+
alpha value, all between 0 and 255.
66+
67+
*/
68+
2969
property iconHiliteColor get getHiliteColor set setHiliteColor
30-
metadata iconHiliteColor.editor is "com.livecode.pi.color"
70+
metadata iconHiliteColor.editor is "com.livecode.pi.colorwithalpha"
71+
72+
/*
73+
Syntax:
74+
set the iconPathPreset of <widget> to <pIconName>
75+
get the iconPathPreset of <widget>
76+
77+
Summary: One of the predefined SVG icon path names.
78+
79+
Parameters:
80+
pIconName: The name of the icon to display.
81+
82+
Example: set the iconPathPreset of widget "SVG Icon" to "thumbs up"
83+
84+
Description:
85+
Use the iconPathPreset property to set the icon of the widget to one of the
86+
predefined values. The complete list of preset values is available by executing
87+
88+
``` put iconNames()```
89+
90+
*/
91+
3192
property iconPathPreset get getPathPreset set setPathPreset
3293
metadata iconPathPreset.editor is "com.livecode.pi.enum"
3394
metadata iconPathPreset.options is "execute: get iconNames()"
3495
metadata iconPathPreset.default is "Star"
96+
97+
/*
98+
Syntax:
99+
set the iconPath of <widget> to <pSVGPath>
100+
get the iconPath of <widget>
101+
102+
Summary: Manipulates the svg path displayed by the icon.
103+
104+
Parameters:
105+
pSVGPath: The path of the icon to display.
106+
107+
Example:
108+
-- Create a filled triangle
109+
set the iconPath of widget "SVG Icon" to "M150 0 L75 200 L225 200 Z"
110+
111+
Description:
112+
Use the iconPath property to set the icon of the widget to an SVG path.
113+
114+
See http://www.w3schools.com/svg/svg_path.asp for more information on valid SVG path operations.
115+
*/
116+
35117
property iconPath get mPath set setPath
36118
metadata iconPath.editor is "com.livecode.pi.text"
119+
120+
/*
121+
Syntax:
122+
set the isHilited of <widget> to {true|false}
123+
get the isHilited of <widget>
124+
125+
Summary: Whether the icon is hilited or not.
126+
127+
Description:
128+
Use the isHilited property to hilite the icon or check if it is hilited from script.
129+
*/
130+
37131
property isHilited get mHilited set setIsHilited
132+
133+
/*
134+
Syntax:
135+
set the toggleHilite of <widget> to {true|false}
136+
get the toggleHilite of <widget>
137+
138+
Summary: Whether the icon has toggle behavior or not.
139+
140+
Description:
141+
Use the toggleHilite property to make the icon behave like a toggle. The
142+
default behavior is toggleHilite false, so that the icon returns to its
143+
unhilited state when the mouse button is released. When toggleHilite is true,
144+
clicking the icon causes it to remain hilited until clicked again.
145+
*/
38146
property toggleHilite get mToggleHilite set mToggleHilite
147+
148+
/*
149+
Syntax:
150+
set the maintainAspectRatio of <widget> to {true|false}
151+
get the maintainAspectRatio of <widget>
152+
153+
Summary: Whether the icon maintains its aspect ratio when resized.
154+
155+
Description:
156+
If the maintainAspectRatio of the icon widget is true, the icon will be its maximum
157+
size within its bounds while maintaining the original ratio of width to height. If
158+
false, it will stretch to fit the extent of its bounds.
159+
160+
*/
39161
property maintainAspectRatio get mMaintainAspectRatio set setMaintainAspectRatio
162+
163+
/*
164+
Syntax:
165+
set the flipVertically of <widget> to {true|false}
166+
get the flipVertically of <widget>
167+
168+
Summary: Whether the icon is flipped vertically.
169+
170+
Description:
171+
Use the flipped vertically to flip the icon upside down.
172+
173+
*/
40174
property flipVertically get mFlipVertically set setFlipVertically
175+
176+
/*
177+
Syntax:
178+
set the iconAngle of <widget> to <pAngle>
179+
get the iconAngle of <widget>
180+
181+
Parameters:
182+
pAngle: The angle of rotation in degrees.
183+
184+
Summary: The angle of rotation of the icon.
185+
186+
Description:
187+
Use the iconAngle property to rotate the icon <pAngle> degrees clockwise.
188+
*/
189+
41190
property iconAngle get mAngle set setAngle
42191
--
43192

0 commit comments

Comments
 (0)