分享

金山卫士界面源码解读及界面库分离

 DavinTang 2011-03-26


金山对其金山卫士进行了开源,目前已经公开了6个子项目。

不过也许很多人和我一样对安全部分的功能并不感兴趣,毕竟那需要比较艰辛的工作。

但对其所运用的界面库部分可能比较感兴趣,该库是基于目前比较流行的DIRECTUI技术,非常适合于工具软件的开发,例如互联网软件及娱乐软件等。

不过目前该库是作为源代码进行调用的,使用并不方便。所以我准备将其从金山卫士的项目中分离出来,作为独立的库进行调用,并同时撰写其使用文档资料,欢迎有此同好的朋友加入。

原来希望将库做成DLL形式的,后来发现全部是模版实现,没办法导出.

所以暂时先以源码形式调用,以后有机会再看如何处理成DLL的.

要阅读金山代码需要一定的WTL编程经验。

 使用方法可以先参考附件当中的样例代码,详细文档资料将陆续编写出来.

该界面库是典型的DirectUI的实现方法,相信TX的也是基本类似,不过TX肯定实现的更加深入一些,

但通过该框架,继续深入开发估计也不会太困难.

目前编写了两个预览界面,如下所示:

描述XML如下:

  1. <layer title="sample1" width="600" height="470" appwin="1">  
  2.     <header class="mainhead" width="full" height="23">  
  3.         <icon src="ICON_MAIN" mce_src="ICON_MAIN" pos="5,4"/>  
  4.         <text class="dlgtitle" pos="25,6">样例程序1</text>  
  5.         <imgbtn id="60003" class="linkimage" skin="minbtn" pos="-105,1"/>  
  6.         <imgbtn id="60002" class="linkimage" skin="maxbtn" pos="-73,1"/>  
  7.         <imgbtn id="60001" class="linkimage" skin="closeonlybtn" pos="-43,1"/>  
  8.     </header>  
  9.     <body class="mainbody" width="full" height="full">  
  10.         <dlg pos="0,0,-0,-0" crbg=F7FBBF>  
  11.         <text class="hellowordstyle" pos="50,200">hello world!</text>  
  12.         </dlg>  
  13.     </body>  
  14.     <footer class="mainfoot" width="full" height="23" crbg=FFB9B9>  
  15.     </footer>  
  16. </layer>  

XML如下:

  1. <layer title="sample1" width="600" height="470" appwin="1">  
  2.     <header class="mainhead" width="full" height="31">  
  3.         <icon src="ICON_MAIN" mce_src="ICON_MAIN" pos="5,4"/>  
  4.         <text class="dlgtitle" pos="25,6">样例程序1</text>  
  5.         <imgbtn id="60003" class="linkimage" skin="minbtn" pos="-105,0"/>  
  6.         <imgbtn id="60002" class="linkimage" skin="maxbtn" pos="-79,0"/>  
  7.         <imgbtn id="60001" class="linkimage" skin="closeonlybtn" pos="-53,0"/>  
  8.     </header>  
  9.     <body class="mainbody" width="full" height="full">  
  10.         <button id="1" class="normalbtn" pos="50,20,110,40">普通按钮</button>  
  11.         <text class="infostyle" pos="120,25,180">信息显示:</text>  
  12.         <text id="2" class="infostyle" pos="200,25">Ready</text>  
  13.         <hr style="dot" mce_style="dot" size=1 pos="50,50,250,50" crbg=888888 />  
  14.         <check id="3" check=4 pos="50,60">复选框1</check>  
  15.         <check id="4" pos="50,80">复选框2</check>  
  16.         <hr style="dot" mce_style="dot" size=1 pos="50,100,250,100" crbg=888888 />  
  17.         <radio id="5" check=4 pos="50,120">Radio按钮1</radio>  
  18.         <radio id="6" pos="50,140">Radio按钮2</radio>  
  19.         <radio id="7" pos="50,160">Radio按钮3</radio>  
  20.           
  21.         <progress id="8" pos="50,200,250,210" min="0" max="100" value="30" showpercent="1" bgskin="progressbg" posskin="progresspos" show="1" />  
  22.         <button id="9" class="normalbtn" pos="50,220,110,240">增加</button>  
  23.         <button id="10" class="normalbtn" pos="120,220,180,240">减少</button>  
  24.   
  25.         <img id="11" pos="50,250" skin="loading" sub="0"/>  
  26.         <text class="infostyle" pos="70,250">Loading...</text>  
  27.     </body>  
  28.     <footer class="mainfoot" width="full" height="34" crbg=FFB9B9>  
  29.     </footer>  
  30. </layer>  

两个界面都是比较基础的界面,没有使用典型的TAB布局,更加深入的文章请关注后续文章.

先看各位同学看代码,有哪方面的疑惑,我再针对反馈来写其他的介绍文章.

附件下载:

http://download.csdn.net/source/3108296

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多