|
发表于 2018-7-12 14:53:01
|
显示全部楼层
感谢tanker,改进了一下添加到aardio工具了,
import win.ui;
import gdip.fontAwesome;
/*DSG{{*/
var winform = win.form(text="fontAwesome图标字体浏览器 - 点击图标复制转义字符";right=1173;bottom=716;bgcolor=16777215)
winform.add(
custom={cls="custom";text="custom";left=1;top=0;right=901;bottom=714;bgcolor=15793151;db=1;dl=1;dr=1;dt=1;z=1};
editCssClass={cls="edit";left=987;top=344;right=1148;bottom=367;dr=1;dt=1;edge=1;z=2};
editText={cls="edit";left=987;top=168;right=1148;bottom=191;dr=1;dt=1;edge=1;z=4};
plus={cls="plus";left=960;top=26;right=1122;bottom=148;color=255;dr=1;dt=1;font=LOGFONT(name='FontAwesome';h=-96);z=6};
static={cls="static";text="CSS类名:";left=925;top=347;right=977;bottom=370;align="right";dr=1;dt=1;transparent=1;z=3};
static2={cls="static";text="转义字符:";left=925;top=171;right=977;bottom=194;align="right";dr=1;dt=1;transparent=1;z=5};
static3={cls="static";text='传统控件、plus控件等请在字体属性中指定"fontAwesome",并在text文本属性中使用单引号包含上面的转义字符,普通控件请在创建窗口前调用import win.fontAwesome,plus等使用GDI+的控件请在创建窗口前调用import gdip.fontAwesome';left=925;top=209;right=1137;bottom=327;dr=1;dt=1;transparent=1;z=7};
static4={cls="static";text="HTMLayout需要在打开网页前调用import web.layout.fontAwesome加载字体样式,其他浏览器控件直接调用import win.fontAwesome并且在fontAwesome网页样式中去掉font-face定义即可与传统控件共享字体文件,当然也可以按浏览器里的写法自带fontAwesome字体";left=925;top=383;right=1137;bottom=501;dr=1;dt=1;transparent=1;z=8}
)
/*}}*/
import web.layout;
import web.layout.fontAwesome;
//提取fontAwesome所有图标
gFontAwesomeIcons = string.search({}
,$"~\lib\web\layout\.res\fontAwesome.css"
,"\.fa-glass.+","\.(fa\-[\w\-]+)")
var wbLayout = web.layout(winform.custom);
wbLayout.html = /**
<!--http://bbs.aardio.com/forum.php? ... amp;tid=13569-->
<!doctype html>
<html>
<head>
<style type="text/css">
html,body{ height:100%; margin:10px;}
i {
behavior:button;
height:60px;
width:60px;
text-align:center;
vertical-align:middle;
font-size:24px;
color:#008080;
}
i:hover {
background:#ccc;
color:#F08000;
}
</style>
</head>
<body>
<?
for i,icon in table.eachIndex(gFontAwesomeIcons){
?>
<i name="fontAwesome" class="fa <?=icon?>" title="fa <?=icon?>"></i>
<?
}
?>
</body>
</html>
**/
import win.clip;
wbLayout.onButtonClick = {
fontAwesome = function (ltTarget,ltOwner,reason,behaviorParams) {
winform.editCssClass.text = ltTarget.class;
winform.editText.text = string.replace( string.escape( ltTarget.style.content,true,true ),"\\u5","\\uF");
winform.plus.text = string.unescape(winform.editText.text);
win.clip.write(winform.editText.text);
}
}
winform.show()
win.loopMessage();
|
|