Merge pull request #42 from lovesnow/development

XML中的Font节点添加id属性,支持font自定义,同时兼容过去的索引方式
This commit is contained in:
Dylan 2019-06-12 10:20:29 +08:00 committed by GitHub
commit 8183d8133a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 208 additions and 179 deletions

View File

@ -14,7 +14,7 @@
<HBox height="auto"> <HBox height="auto">
<Button class="btn_global_blue_80x30" name="btn_back" text="后退" width="60"/> <Button class="btn_global_blue_80x30" name="btn_back" text="后退" width="60"/>
<Button class="btn_global_blue_80x30" name="btn_forward" text="前进" width="60" margin="5,0,5"/> <Button class="btn_global_blue_80x30" name="btn_forward" text="前进" width="60" margin="5,0,5"/>
<RichEdit class="simple prompt input" name="edit_url" width="stretch" height="28" valign="center" padding="5,5,5,5" font="1" prompttext="请输入网址"/> <RichEdit class="simple prompt input" name="edit_url" width="stretch" height="28" valign="center" padding="5,5,5,5" prompttext="请输入网址"/>
<Button class="btn_global_blue_80x30" name="btn_navigate" text="转到" width="60" margin="5"/> <Button class="btn_global_blue_80x30" name="btn_navigate" text="转到" width="60" margin="5"/>
<Button class="btn_global_blue_80x30" name="btn_refresh" text="刷新" width="60" margin="5"/> <Button class="btn_global_blue_80x30" name="btn_refresh" text="刷新" width="60" margin="5"/>
</HBox> </HBox>

View File

@ -55,7 +55,7 @@
<Control class="splitline_hor_level1"/> <Control class="splitline_hor_level1"/>
<!-- RichEdit --> <!-- RichEdit -->
<RichEdit class="prompt" name="edit" bkcolor="bk_wnd_lightcolor" width="stretch" height="stretch" <RichEdit class="prompt" name="edit" bkcolor="bk_wnd_lightcolor" width="stretch" height="stretch"
font="1" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true"
normaltextcolor="darkcolor" wantreturnmsg="true" rich="true"/> normaltextcolor="darkcolor" wantreturnmsg="true" rich="true"/>
</VBox> </VBox>
</VBox> </VBox>

View File

@ -2,63 +2,63 @@
<Global> <Global>
<!--所有字体--> <!--所有字体-->
<!--0--> <!--0-->
<Font name="system" size="10"/> <Font id="system_12" name="system" size="12" default="true"/>
<!--1--> <!--1-->
<Font name="system" size="12"/> <Font id="system_10" name="system" size="10"/>
<!--2--> <!--2-->
<Font name="system" size="14"/> <Font id="system_14" name="system" size="14"/>
<!--3--> <!--3-->
<Font name="system" size="16"/> <Font id="system_16" name="system" size="16"/>
<!--4--> <!--4-->
<Font name="system" size="18"/> <Font id="system_18" name="system" size="18"/>
<!--5--> <!--5-->
<Font name="system" size="10" bold="true"/> <Font id="system_bold_10" name="system" size="10" bold="true"/>
<!--6--> <!--6-->
<Font name="system" size="12" bold="true"/> <Font id="system_bold_12" name="system" size="12" bold="true"/>
<!--7--> <!--7-->
<Font name="system" size="14" bold="true"/> <Font id="system_bold_14" name="system" size="14" bold="true"/>
<!--8--> <!--8-->
<Font name="system" size="16" bold="true"/> <Font id="system_bold_16" name="system" size="16" bold="true"/>
<!--9--> <!--9-->
<Font name="system" size="18" bold="true"/> <Font id="system_bold_18" name="system" size="18" bold="true"/>
<!--10--> <!--10-->
<Font name="arial" size="10"/> <Font id="arial_10" name="arial" size="10"/>
<!--11--> <!--11-->
<Font name="arial" size="12"/> <Font id="arial_12" name="arial" size="12"/>
<!--12--> <!--12-->
<Font name="arial" size="14"/> <Font id="arial_14" name="arial" size="14"/>
<!--13--> <!--13-->
<Font name="arial" size="16"/> <Font id="arial_16" name="arial" size="16"/>
<!--14--> <!--14-->
<Font name="arial" size="18"/> <Font id="arial_18" name="arial" size="18"/>
<!--15--> <!--15-->
<Font name="arial" size="10" bold="true"/> <Font id="arial_bold_10" name="arial" size="10" bold="true"/>
<!--16--> <!--16-->
<Font name="arial" size="12" bold="true"/> <Font id="arial_bold_12" name="arial" size="12" bold="true"/>
<!--17--> <!--17-->
<Font name="arial" size="14" bold="true"/> <Font id="arial_bold_14" name="arial" size="14" bold="true"/>
<!--18--> <!--18-->
<Font name="arial" size="16" bold="true"/> <Font id="arial_bold_16" name="arial" size="16" bold="true"/>
<!--19--> <!--19-->
<Font name="arial" size="18" bold="true"/> <Font id="arial_bold_18" name="arial" size="18" bold="true"/>
<!--20--> <!--20-->
<Font name="system" size="20"/> <Font id="system_20" name="system" size="20"/>
<!--21--> <!--21-->
<Font name="system" size="20" bold="true"/> <Font id="system_bold_20" name="system" size="20" bold="true"/>
<!--22--> <!--22-->
<Font name="system" size="22"/> <Font id="system_22" name="system" size="22"/>
<!--23--> <!--23-->
<Font name="system" size="22" bold="true"/> <Font id="system_bold_22" name="system" size="22" bold="true"/>
<!--24--> <!--24-->
<Font name="system" size="12" underline="true"/> <Font id="system_underline_12" name="system" size="12" underline="true"/>
<!--25--> <!--25-->
<Font name="system" size="24"/> <Font id="system_24" name="system" size="24"/>
<!--26--> <!--26-->
<Font name="system" size="14" underline="true"/> <Font id="system_underline_14" name="system" size="14" underline="true"/>
<!--27--> <!--27-->
<Font name="system" size="16" underline="true"/> <Font id="system_underline_16" name="system" size="16" underline="true"/>
<!--28--> <!--28-->
<Font name="system" size="32" /> <Font id="system_32" name="system" size="32" />
<!--一些常规固定颜色--> <!--一些常规固定颜色-->
<TextColor name="white" value="#ffffffff"/> <TextColor name="white" value="#ffffffff"/>
@ -117,76 +117,76 @@
<TextColor name="color_palette9" value="#ffffffff"/> <TextColor name="color_palette9" value="#ffffffff"/>
<!--字体大小--> <!--字体大小-->
<Class name="font_title" value="font=&quot;2&quot;" /> <Class name="font_title" font="system_14"/>
<!--标题栏--> <!--标题栏-->
<Class name="caption" value="height=&quot;34&quot; bkimage=&quot;file='../public/caption/caption_public.png' corner='0,0,0,1'&quot; padding=&quot;10,0,5,0&quot;"/> <Class name="caption" height="34" bkimage="file='../public/caption/caption_public.png' corner='0,0,0,1'" padding="10,0,5,0" />
<!--滚动条--> <!--滚动条-->
<Class name="vscrollbar" value="width=&quot;14&quot; fadealpha=&quot;true&quot; thumbnormalimage=&quot;file='../public/vscrollbar/thumb_normal.png' corner='0,8,0,8'&quot; thumbhotimage=&quot;file='../public/vscrollbar/thumb_hovered.png' corner='0,8,0,8'&quot; bkhotimage=&quot;file='../public/vscrollbar/bk_hovered.png' corner='0,4,0,4'&quot; showbutton1=&quot;false&quot; showbutton2=&quot;false&quot;"/> <Class name="vscrollbar" width="14" fadealpha="true" thumbnormalimage="file='../public/vscrollbar/thumb_normal.png' corner='0,8,0,8'" thumbhotimage="file='../public/vscrollbar/thumb_hovered.png' corner='0,8,0,8'" bkhotimage="file='../public/vscrollbar/bk_hovered.png' corner='0,4,0,4'" showbutton1="false" showbutton2="false" />
<Class name="hscrollbar" value="height=&quot;14&quot; fadealpha=&quot;true&quot; thumbnormalimage=&quot;file='../public/hscrollbar/thumb_normal.png' corner='8,0,8,0'&quot; thumbhotimage=&quot;file='../public/hscrollbar/thumb_hovered.png' corner='8,0,8,0'&quot; bkhotimage=&quot;file='../public/hscrollbar/bk_hovered.png' corner='4,0,4,0'&quot; showbutton1=&quot;false&quot; showbutton2=&quot;false&quot;"/> <Class name="hscrollbar" height="14" fadealpha="true" thumbnormalimage="file='../public/hscrollbar/thumb_normal.png' corner='8,0,8,0'" thumbhotimage="file='../public/hscrollbar/thumb_hovered.png' corner='8,0,8,0'" bkhotimage="file='../public/hscrollbar/bk_hovered.png' corner='4,0,4,0'" showbutton1="false" showbutton2="false"/>
<!--单选框--> <!--单选框-->
<Class name="option" value="selectednormalimage=&quot;../public/option/selected.png&quot; selectedhotimage=&quot;../public/option/selectedhover.png&quot; selectedpushedimage=&quot;../public/option/selectedhover.png&quot;"/> <Class name="option" selectednormalimage="../public/option/selected.png" selectedhotimage="../public/option/selectedhover.png" selectedpushedimage="../public/option/selectedhover.png"/>
<Class name="circle_option" value="normalimage=&quot;../public/option/circle_unselected.png&quot; disabledimage=&quot;../public/option/circle_unselected_disabled.png&quot; selectednormalimage=&quot;../public/option/circle_selected.png&quot;"/> <Class name="circle_option" normalimage="../public/option/circle_unselected.png" disabledimage="../public/option/circle_unselected_disabled.png"/>
<Class name="circle_option_2" value="height=&quot;18&quot; textpadding=&quot;25,0,0,0&quot; font=&quot;1&quot; normaltextcolor=&quot;darkcolor&quot; normalimage=&quot;file='../public/option/circle_unselected.png' dest='0,0,18,18'&quot; selectednormalimage=&quot;file='../public/option/circle_selected.png' dest='0,0,18,18'&quot;"/> <Class name="circle_option_2" height="18" textpadding="25,0,0,0" font="system_12" normaltextcolor="darkcolor" normalimage="file='../public/option/circle_unselected.png' dest='0,0,18,18'" selectednormalimage="file='../public/option/circle_selected.png' dest='0,0,18,18'"/>
<!--复选框--> <!--复选框-->
<Class name="checkbox_font12" value="height=&quot;16&quot; textpadding=&quot;20,0,0,0&quot; font=&quot;1&quot; normaltextcolor=&quot;darkcolor&quot; normalimage=&quot;file='../public/CheckBox/check_no.png' dest='0,0,16,16'&quot; disabledimage=&quot;file='../public/CheckBox/check_no.png' dest='0,0,16,16' fade='80'&quot; selectednormalimage=&quot;file='../public/CheckBox/check_yes.png' dest='0,0,16,16'&quot; selecteddisabledimage=&quot;file='../public/CheckBox/check_yes.png' dest='0,0,16,16' fade='80'&quot;"/> <Class name="checkbox_font12" height="16" textpadding="20,0,0,0" font="system_12" normaltextcolor="darkcolor" normalimage="file='../public/CheckBox/check_no.png' dest='0,0,16,16'" disabledimage="file='../public/CheckBox/check_no.png' dest='0,0,16,16' fade='80'" selectednormalimage="file='../public/CheckBox/check_yes.png' dest='0,0,16,16'" selecteddisabledimage="file='../public/CheckBox/check_yes.png' dest='0,0,16,16' fade='80'"/>
<Class name="checkbox_font14" value="height=&quot;20&quot; textpadding=&quot;20,0,0,0&quot; font=&quot;2&quot; normaltextcolor=&quot;darkcolor&quot; normalimage=&quot;file='../public/CheckBox/check_no.png' dest='0,2,16,18'&quot; disabledimage=&quot;file='../public/CheckBox/check_no.png' dest='0,2,16,18' fade='80'&quot; selectednormalimage=&quot;file='../public/CheckBox/check_yes.png' dest='0,2,16,18'&quot; selecteddisabledimage=&quot;file='../public/CheckBox/check_yes.png' dest='0,2,16,18' fade='80'&quot;"/> <Class name="checkbox_font14" height="20" textpadding="20,0,0,0" font="system_14" normaltextcolor="darkcolor" normalimage="file='../public/CheckBox/check_no.png' dest='0,2,16,18'" disabledimage="file='../public/CheckBox/check_no.png' dest='0,2,16,18' fade='80'" selectednormalimage="file='../public/CheckBox/check_yes.png' dest='0,2,16,18'" selecteddisabledimage="file='../public/CheckBox/check_yes.png' dest='0,2,16,18' fade='80'"/>
<Class name="checkbox_green" value="normalimage=&quot;file='../public/CheckBox/check_green_no.png'&quot; disabledimage=&quot;file='../public/CheckBox/check_green_no.png' fade='80'&quot; selectednormalimage=&quot;file='../public/CheckBox/check_green_yes.png'&quot; selecteddisabledimage=&quot;file='../public/CheckBox/check_green_yes.png' fade='80'&quot;"/> <Class name="checkbox_green" normalimage="file='../public/CheckBox/check_green_no.png'" disabledimage="file='../public/CheckBox/check_green_no.png' fade='80'" selectednormalimage="file='../public/CheckBox/check_green_yes.png'" selecteddisabledimage="file='../public/CheckBox/check_green_yes.png' fade='80'"/>
<!--按钮--> <!--按钮-->
<Class name="btn_global_blue_80x30" value="font=&quot;7&quot; normaltextcolor=&quot;white&quot; normalimage=&quot;file='../public/button/btn_global_blue_80x30_normal.png'&quot; hotimage=&quot;file='../public/button/btn_global_blue_80x30_hovered.png'&quot; pushedimage=&quot;file='../public/button/btn_global_blue_80x30_pushed.png'&quot; disabledimage=&quot;file='../public/button/btn_global_blue_80x30_normal.png' fade='80'&quot;"/> <Class name="btn_global_blue_80x30" font="system_bold_14" normaltextcolor="white" normalimage="file='../public/button/btn_global_blue_80x30_normal.png'" hotimage="file='../public/button/btn_global_blue_80x30_hovered.png'" pushedimage="file='../public/button/btn_global_blue_80x30_pushed.png'" disabledimage="file='../public/button/btn_global_blue_80x30_normal.png' fade='80'"/>
<Class name="btn_global_white_80x30" value="font=&quot;7&quot; normaltextcolor=&quot;dark_gray&quot; normalimage=&quot;file='../public/button/btn_global_white_80x30_normal.png'&quot; hotimage=&quot;file='../public/button/btn_global_white_80x30_hovered.png'&quot; pushedimage=&quot;file='../public/button/btn_global_white_80x30_pushed.png'&quot; disabledimage=&quot;file='../public/button/btn_global_white_80x30_normal.png' fade='128'&quot;"/> <Class name="btn_global_white_80x30" font="system_bold_14" normaltextcolor="dark_gray" normalimage="file='../public/button/btn_global_white_80x30_normal.png'" hotimage="file='../public/button/btn_global_white_80x30_hovered.png'" pushedimage="file='../public/button/btn_global_white_80x30_pushed.png'" disabledimage="file='../public/button/btn_global_white_80x30_normal.png' fade='128'"/>
<Class name="btn_global_red_80x30" value="font=&quot;7&quot; normaltextcolor=&quot;white&quot; normalimage=&quot;file='../public/button/btn_global_red_80x30_normal.png'&quot; hotimage=&quot;file='../public/button/btn_global_red_80x30_hovered.png'&quot; pushedimage=&quot;file='../public/button/btn_global_red_80x30_pushed.png'&quot; disabledimage=&quot;file='../public/button/btn_global_red_80x30_normal.png' fade='80'&quot;"/> <Class name="btn_global_red_80x30" font="system_bold_14" normaltextcolor="white" normalimage="file='../public/button/btn_global_red_80x30_normal.png'" hotimage="file='../public/button/btn_global_red_80x30_hovered.png'" pushedimage="file='../public/button/btn_global_red_80x30_pushed.png'" disabledimage="file='../public/button/btn_global_red_80x30_normal.png' fade='80'"/>
<!--窗口右上角按钮 灰色版 --> <!--窗口右上角按钮 灰色版 -->
<Class name="btn_wnd_min" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file='../public/button/btn_wnd_gray_min.png' dest='4,4,16,16'&quot; normalimage=&quot;&quot; hotimage=&quot;../public/button/btn_wnd_gray_min_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_gray_min_pushed.png&quot;"/> <Class name="btn_wnd_min" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_gray_min.png' dest='4,4,16,16'" normalimage="" hotimage="../public/button/btn_wnd_gray_min_hovered.png" pushedimage="../public/button/btn_wnd_gray_min_pushed.png"/>
<Class name="btn_wnd_close" value="width=&quot;20&quot; height=&quot;20&quot; normalimage=&quot;file='../public/button/btn_wnd_gray_close.png' dest='4,4,16,16'&quot; hotimage=&quot;../public/button/btn_wnd_white_close_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_white_close_pushed.png&quot; fadehot=&quot;false&quot;"/> <Class name="btn_wnd_close" width="20" height="20" normalimage="file='../public/button/btn_wnd_gray_close.png' dest='4,4,16,16'" hotimage="../public/button/btn_wnd_white_close_hovered.png" pushedimage="../public/button/btn_wnd_white_close_pushed.png" fadehot="false"/>
<Class name="btn_wnd_max" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file='../public/button/btn_wnd_gray_max.png' dest='4,4,16,16'&quot; normalimage=&quot;&quot; hotimage=&quot;../public/button/btn_wnd_gray_max_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_gray_max_pushed.png&quot;"/> <Class name="btn_wnd_max" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_gray_max.png' dest='4,4,16,16'" normalimage="" hotimage="../public/button/btn_wnd_gray_max_hovered.png" pushedimage="../public/button/btn_wnd_gray_max_pushed.png"/>
<Class name="btn_wnd_restore" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file='../public/button/btn_wnd_gray_restore.png' dest='4,4,16,16'&quot; normalimage=&quot;&quot; hotimage=&quot;../public/button/btn_wnd_gray_restore_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_gray_restore_pushed.png&quot;"/> <Class name="btn_wnd_restore" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_gray_restore.png' dest='4,4,16,16'" normalimage="" hotimage="../public/button/btn_wnd_gray_restore_hovered.png" pushedimage="../public/button/btn_wnd_gray_restore_pushed.png"/>
<Class name="btn_wnd_settings" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file=&apos;../public/button/btn_wnd_settings.png&apos; source=&apos;1,1,21,21&apos;&quot; hotimage=&quot;../public/button/btn_wnd_bk_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_bk_pushed.png&quot;"/> <Class name="btn_wnd_settings" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_settings.png' source=&apos;1,1,21,21&apos;" hotimage="../public/button/btn_wnd_bk_hovered.png" pushedimage="../public/button/btn_wnd_bk_pushed.png"/>
<!--窗口右上角按钮 白色版 --> <!--窗口右上角按钮 白色版 -->
<Class name="btn_wnd_white_min" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file='../public/button/btn_wnd_white_min.png'&quot; normalimage=&quot;&quot; hotimage=&quot;../public/button/btn_wnd_white_min_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_white_min_pushed.png&quot;"/> <Class name="btn_wnd_white_min" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_white_min.png'" normalimage="" hotimage="../public/button/btn_wnd_white_min_hovered.png" pushedimage="../public/button/btn_wnd_white_min_pushed.png"/>
<Class name="btn_wnd_white_close" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file='../public/button/btn_wnd_white_close.png'&quot; normalimage=&quot;&quot; hotimage=&quot;../public/button/btn_wnd_white_close_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_white_close_pushed.png&quot;"/> <Class name="btn_wnd_white_close" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_white_close.png'" normalimage="" hotimage="../public/button/btn_wnd_white_close_hovered.png" pushedimage="../public/button/btn_wnd_white_close_pushed.png"/>
<Class name="btn_wnd_white_max" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file='../public/button/btn_wnd_white_max.png' dest='4,4,16,16'&quot; normalimage=&quot;&quot; hotimage=&quot;../public/button/btn_wnd_white_max_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_white_max_pushed.png&quot;"/> <Class name="btn_wnd_white_max" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_white_max.png' dest='4,4,16,16'" normalimage="" hotimage="../public/button/btn_wnd_white_max_hovered.png" pushedimage="../public/button/btn_wnd_white_max_pushed.png"/>
<Class name="btn_wnd_white_menu" value="width=&quot;auto&quot; height=&quot;auto&quot; forenormalimage=&quot;file='../public/button/btn_wnd_white_menu.png' dest='4,5,16,15'&quot; normalimage=&quot;&quot; hotimage=&quot;../public/button/btn_wnd_white_menu_hovered.png&quot; pushedimage=&quot;../public/button/btn_wnd_white_menu_pushed.png&quot;"/> <Class name="btn_wnd_white_menu" width="auto" height="auto" forenormalimage="file='../public/button/btn_wnd_white_menu.png' dest='4,5,16,15'" normalimage="" hotimage="../public/button/btn_wnd_white_menu_hovered.png" pushedimage="../public/button/btn_wnd_white_menu_pushed.png"/>
<!--删除按钮通用样式--> <!--删除按钮通用样式-->
<Class name="btn_delete" value="normalimage=&quot;file='../public/button/funcicon.png' source='0,0,26,26'&quot; hotimage=&quot;file='../public/button/funcicon.png' source='31,0,57,26'&quot; pushedimage=&quot;file='../public/button/funcicon.png' source='62,0,88,26'&quot; disabledimage=&quot;file='../public/button/funcicon.png' source='93,0,119,26'&quot;"/> <Class name="btn_delete" normalimage="file='../public/button/funcicon.png' source='0,0,26,26'" hotimage="file='../public/button/funcicon.png' source='31,0,57,26'" pushedimage="file='../public/button/funcicon.png' source='62,0,88,26'" disabledimage="file='../public/button/funcicon.png' source='93,0,119,26'"/>
<Class name="btn_recycle" value="width=&quot;auto&quot; height=&quot;auto&quot; normalimage=&quot;file='../public/button/btn_recycle_normal.png'&quot; hotimage=&quot;file='../public/button/btn_recycle_hovered.png'&quot; pushedimage=&quot;file='../public/button/btn_recycle_pushed.png'&quot; disabledimage=&quot;file='../public/button/btn_recycle_normal.png' fade='80'&quot;"/> <Class name="btn_recycle" width="auto" height="auto" normalimage="file='../public/button/btn_recycle_normal.png'" hotimage="file='../public/button/btn_recycle_hovered.png'" pushedimage="file='../public/button/btn_recycle_pushed.png'" disabledimage="file='../public/button/btn_recycle_normal.png' fade='80'"/>
<Class name="btn_refresh" value="width=&quot;auto&quot; height=&quot;auto&quot; normalimage=&quot;file='../public/button/btn_refresh_normal.png'&quot; hotimage=&quot;file='../public/button/btn_refresh_hovered.png'&quot; pushedimage=&quot;file='../public/button/btn_refresh_pushed.png'&quot; disabledimage=&quot;file='../public/button/btn_refresh_normal.png' fade='80'&quot;"/> <Class name="btn_refresh" width="auto" height="auto" normalimage="file='../public/button/btn_refresh_normal.png'" hotimage="file='../public/button/btn_refresh_hovered.png'" pushedimage="file='../public/button/btn_refresh_pushed.png'" disabledimage="file='../public/button/btn_refresh_normal.png' fade='80'"/>
<Class name="btn_del_search" value="normalimage=&quot;../public/button/btn_del_search_normal_gray.png&quot; hotimage=&quot;../public/button/btn_del_search_hover_gray.png&quot; pushedimage=&quot;../public/button/btn_del_search_pushed_gray.png&quot;"/> <Class name="btn_del_search" normalimage="../public/button/btn_del_search_normal_gray.png" hotimage="../public/button/btn_del_search_hover_gray.png" pushedimage="../public/button/btn_del_search_pushed_gray.png"/>
<!--列表通用样式--> <!--列表通用样式-->
<Class name="list" value="bkcolor=&quot;bk_wnd_lightcolor&quot; vscrollbar=&quot;true&quot;"/> <Class name="list" bkcolor="bk_wnd_lightcolor" vscrollbar="true"/>
<Class name="listitem" value="hotcolor=&quot;bk_listitem_hovered&quot; pushedcolor=&quot;bk_listitem_selected&quot; selectednormalcolor=&quot;bk_listitem_selected&quot; fadehot=&quot;false&quot;"/> <Class name="listitem" hotcolor="bk_listitem_hovered" pushedcolor="bk_listitem_selected" selectednormalcolor="bk_listitem_selected" fadehot="false"/>
<Class name="list_topitem" value="normalcolor=&quot;bk_topitem_normal&quot; hotcolor=&quot;bk_topitem_hovered&quot; pushedcolor=&quot;bk_topitem_selected&quot; selectednormalcolor=&quot;bk_topitem_selected&quot; fadehot=&quot;false&quot;"/> <Class name="list_topitem" normalcolor="bk_topitem_normal" hotcolor="bk_topitem_hovered" pushedcolor="bk_topitem_selected" selectednormalcolor="bk_topitem_selected" fadehot="false"/>
<!--进度条通用样式--> <!--进度条通用样式-->
<Class name="progress_blue" value="valign=&quot;center&quot; value=&quot;0&quot; bkimage=&quot;../public/progress/progress_blue_bg.png&quot; height=&quot;3&quot; width=&quot;stretch&quot; hor=&quot;true&quot; max=&quot;100&quot; min=&quot;0&quot; progressimage=&quot;../public/progress/progress_blue_fg.png&quot;"/> <Class name="progress_blue" valign="center" value="0" bkimage="../public/progress/progress_blue_bg.png" height="3" width="stretch" hor="true" max="100" min="0" progressimage="../public/progress/progress_blue_fg.png"/>
<Class name="slider_green" value="width=&quot;stretch&quot; height=&quot;14&quot; margin=&quot;4,0,0,0&quot; valign=&quot;center&quot; thumbsize=&quot;14,14&quot; min=&quot;0&quot; max=&quot;255&quot; progressbarpadding=&quot;0,6,0,6&quot; bkimage=&quot;file=&apos;../public/slider/slider_hor_bk.png&apos; dest=&apos;0,6,1000,8&apos;&quot; progresscolor=&quot;bk_progress_progress&quot; thumbnormalimage=&quot;../public/slider/slider_thumb.png&quot;"/> <Class name="slider_green" width="stretch" height="14" margin="4,0,0,0" valign="center" thumbsize="14,14" min="0" max="255" progressbarpadding="0,6,0,6" bkimage="file=&apos;../public/slider/slider_hor_bk.png&apos; dest=&apos;0,6,1000,8&apos;" progresscolor="bk_progress_progress" thumbnormalimage="../public/slider/slider_thumb.png"/>
<!--菜单通用样式--> <!--菜单通用样式-->
<Class name="menu" value="width=&quot;auto&quot; height=&quot;auto&quot; bkcolor=&quot;bk_wnd_lightcolor&quot;"/> <Class name="menu" width="auto" height="auto" bkcolor="bk_wnd_lightcolor"/>
<Class name="menu_element" value="padding=&quot;20,0,20,0&quot; height=&quot;40&quot; hotcolor=&quot;bk_menuitem_hovered&quot; pushedcolor=&quot;bk_menuitem_selected&quot; selectednormalcolor=&quot;bk_menuitem_selected&quot;"/> <Class name="menu_element" padding="20,0,20,0" height="40" hotcolor="bk_menuitem_hovered" pushedcolor="bk_menuitem_selected" selectednormalcolor="bk_menuitem_selected"/>
<Class name="menu_text" value="normaltextcolor=&quot;darkcolor&quot; font=&quot;2&quot; valign=&quot;center&quot;"/> <Class name="menu_text" normaltextcolor="darkcolor" font="system_14" valign="center"/>
<!--分割线通用样式--> <!--分割线通用样式-->
<Class name="splitline_hor_level1" value="bkcolor=&quot;splitline_level1&quot; height=&quot;1&quot;"/> <Class name="splitline_hor_level1" bkcolor="splitline_level1" height="1"/>
<Class name="splitline_hor_level2" value="bkcolor=&quot;splitline_level2&quot; height=&quot;1&quot;"/> <Class name="splitline_hor_level2" bkcolor="splitline_level2" height="1"/>
<Class name="splitline_ver_level1" value="bkcolor=&quot;splitline_level1&quot; width=&quot;1&quot;"/> <Class name="splitline_ver_level1" bkcolor="splitline_level1" width="1"/>
<!--富文本控件通用样式--> <!--富文本控件通用样式-->
<Class name="simple" value="multiline=&quot;false&quot; autohscroll=&quot;true&quot; wantreturnmsg=&quot;true&quot; wanttab=&quot;false&quot; rich=&quot;false&quot; normaltextcolor=&quot;darkcolor&quot; disabledtextcolor=&quot;textdefaultdisablecolor&quot;"/> <Class name="simple" multiline="false" autohscroll="true" wantreturnmsg="true" wanttab="false" rich="false" normaltextcolor="darkcolor" disabledtextcolor="textdefaultdisablecolor"/>
<Class name="prompt" value="promptmode=&quot;true&quot; promptcolor=&quot;light_gray&quot;"/> <Class name="prompt" promptmode="true" promptcolor="light_gray"/>
<Class name="edit" value="hotimage=&quot;file='../public/edit/edit1.png' corner='10,10,10,10'&quot; focusedimage=&quot;file='../public/edit/edit2.png' corner='10,10,10,10'&quot;"/> <Class name="edit" hotimage="file='../public/edit/edit1.png' corner='10,10,10,10'" focusedimage="file='../public/edit/edit2.png' corner='10,10,10,10'"/>
<Class name="input" value="normalimage=&quot;file='../public/edit/edit0.png' corner='10,10,10,10'&quot; hotimage=&quot;file='../public/edit/edit0.png' corner='10,10,10,10'&quot; focusedimage=&quot;file='../public/edit/edit0.png' corner='10,10,10,10'&quot; disabledimage=&quot;file='../public/edit/edit0.png' corner='10,10,10,10' fade='80'&quot;"/> <Class name="input" normalimage="file='../public/edit/edit0.png' corner='10,10,10,10'" hotimage="file='../public/edit/edit0.png' corner='10,10,10,10'" focusedimage="file='../public/edit/edit0.png' corner='10,10,10,10'" disabledimage="file='../public/edit/edit0.png' corner='10,10,10,10' fade='80'"/>
<!--头像蒙版--> <!--头像蒙版-->
<Class name="icon_headimage_mask_40x40" value="width=&quot;40&quot; height=&quot;40&quot; bkimage=&quot;../public/headmask/icon_headimage_mask_40x40_normal.png&quot;"/> <Class name="icon_headimage_mask_40x40" width="40" height="40" bkimage="../public/headmask/icon_headimage_mask_40x40_normal.png"/>
</Global> </Global>

View File

@ -14,33 +14,33 @@
</HBox> </HBox>
<HBox height="auto"> <HBox height="auto">
<Control /> <Control />
<Button name="register_account" margin="0,5,15,10" halign="right" text="注册" cursortype="hand" font="24" normaltextcolor="link_green"/> <Button name="register_account" margin="0,5,15,10" halign="right" text="注册" cursortype="hand" font="system_underline_12" normaltextcolor="link_green"/>
<Button name="enter_login" margin="0,5,15,10" halign="right" text="直接登录" cursortype="hand" font="24" normaltextcolor="link_green" visible="false"/> <Button name="enter_login" margin="0,5,15,10" halign="right" text="直接登录" cursortype="hand" font="system_underline_12" normaltextcolor="link_green" visible="false"/>
</HBox> </HBox>
<!--帐号和密码--> <!--帐号和密码-->
<VBox name="enter_panel" width="240" height="auto" margin="20,0,20,0" bkimage="user_password.png"> <VBox name="enter_panel" width="240" height="auto" margin="20,0,20,0" bkimage="user_password.png">
<HBox height="41" padding="14,1,10,0"> <HBox height="41" padding="14,1,10,0">
<Control name="usericon" width="16" height="16" valign="center" normalimage="user_1.png" disabledimage="user_2.png"/> <Control name="usericon" width="16" height="16" valign="center" normalimage="user_1.png" disabledimage="user_2.png"/>
<RichEdit class="simple prompt" name="username" width="stretch" height="auto" margin="10,0,10,0" valign="center" font="2" prompttext="帐号"/> <RichEdit class="simple prompt" name="username" width="stretch" height="auto" margin="10,0,10,0" valign="center" font="system_14" prompttext="帐号"/>
</HBox> </HBox>
<HBox name="nick_name_panel" height="40" padding="14,1,0,0" visible="false" margin="0,0,0,0"> <HBox name="nick_name_panel" height="40" padding="14,1,0,0" visible="false" margin="0,0,0,0">
<Control name="nick_name_icon" width="16" height="16" valign="center" normalimage="nickname.png" disabledimage="nickname.png"/> <Control name="nick_name_icon" width="16" height="16" valign="center" normalimage="nickname.png" disabledimage="nickname.png"/>
<RichEdit class="simple prompt" name="nickname" width="stretch" height="auto" margin="10,0,10,0" valign="center" font="2" prompttext="昵称"/> <RichEdit class="simple prompt" name="nickname" width="stretch" height="auto" margin="10,0,10,0" valign="center" font="system_14" prompttext="昵称"/>
</HBox> </HBox>
<HBox height="41" padding="14,0,10,1" margin="0,2,0,0"> <HBox height="41" padding="14,0,10,1" margin="0,2,0,0">
<Control name="passwordicon" width="16" height="16" valign="center" normalimage="password_1.png" disabledimage="password_2.png"/> <Control name="passwordicon" width="16" height="16" valign="center" normalimage="password_1.png" disabledimage="password_2.png"/>
<RichEdit class="simple prompt" name="password" width="stretch" height="auto" margin="10,0,10,0" valign="center" font="2" password="true" prompttext="密码"/> <RichEdit class="simple prompt" name="password" width="stretch" height="auto" margin="10,0,10,0" valign="center" font="system_14" password="true" prompttext="密码"/>
</HBox> </HBox>
</VBox> </VBox>
</VBox> </VBox>
<!--登录提示--> <!--登录提示-->
<Label name="login_ing_tip" margin="20,20,20,0" font="1" text="正在登录..." visible="false"/> <Label name="login_ing_tip" margin="20,20,20,0" font="system_12" text="正在登录..." visible="false"/>
<Label name="login_error_tip" margin="20,20,20,0" font="1" normaltextcolor="obvious_tip" visible="false"/> <Label name="login_error_tip" margin="20,20,20,0" font="system_12" normaltextcolor="obvious_tip" visible="false"/>
<!--登录和取消按钮--> <!--登录和取消按钮-->
<Box width="240" height="40" margin="20,20,20,20"> <Box width="240" height="40" margin="20,20,20,20">
<Button class="btn_global_blue_80x30" name="btn_login" width="240" height="40" font="8" text="登录"/> <Button class="btn_global_blue_80x30" name="btn_login" width="240" height="40" font="system_bold_16" text="登录"/>
<Button class="btn_global_blue_80x30" name="btn_register" width="240" height="40" font="8" text="注册" visible="false"/> <Button class="btn_global_blue_80x30" name="btn_register" width="240" height="40" font="system_bold_16" text="注册" visible="false"/>
<Button class="btn_global_red_80x30" name="btn_cancel" width="240" height="40" font="8" text="取消登录" visible="false"/> <Button class="btn_global_red_80x30" name="btn_cancel" width="240" height="40" font="system_bold_16" text="取消登录" visible="false"/>
</Box> </Box>
</VBox> </VBox>
</Box> </Box>

View File

@ -8,7 +8,7 @@
<!-- 好友列表 --> <!-- 好友列表 -->
<VBox width="270" bkcolor="light_gray"> <VBox width="270" bkcolor="light_gray">
<Box padding="10,8,10,8" height="auto"> <Box padding="10,8,10,8" height="auto">
<RichEdit class="simple prompt input" name="nickname" width="stretch" height="35" padding="25,8,8,8" font="1" borderround="5,5" prompttext="搜索"/> <RichEdit class="simple prompt input" name="nickname" width="stretch" height="35" padding="25,8,8,8" borderround="5,5" prompttext="搜索"/>
<Control width="auto" height="auto" margin="6,9" bkimage="search_icon.png"/> <Control width="auto" height="auto" margin="6,9" bkimage="search_icon.png"/>
</Box> </Box>
<VBox> <VBox>

View File

@ -6,7 +6,7 @@
<Button class="btn_wnd_close" name="closebtn" margin="10,6,0,0"/> <Button class="btn_wnd_close" name="closebtn" margin="10,6,0,0"/>
</HBox> </HBox>
<RichEdit name="content" width="300" margin="20,30,20,30" font="3" multiline="true" vscrollbar="false" autovscroll="false" enabled="false" rich="true"/> <RichEdit name="content" width="300" margin="20,30,20,30" font="system_16" multiline="true" vscrollbar="false" autovscroll="false" enabled="false" rich="true"/>
<HBox height="auto" margin="0,0,20,20" childmargin="10"> <HBox height="auto" margin="0,0,20,20" childmargin="10">
<Control /> <Control />

View File

@ -10,14 +10,14 @@
</HBox> </HBox>
<HBox height="30" margin="10,2,10,2" childmargin="3"> <HBox height="30" margin="10,2,10,2" childmargin="3">
<Button class="btn_global_blue_80x30" name="btn_back" width="50" height="30" textid="STRID_CEF_BROWSER_BACKWARD" valign="center" font="1" /> <Button class="btn_global_blue_80x30" name="btn_back" width="50" height="30" textid="STRID_CEF_BROWSER_BACKWARD" valign="center" font="system_12" />
<Button class="btn_global_blue_80x30" name="btn_forward" width="50" height="30" textid="STRID_CEF_BROWSER_FORWARD" valign="center" font="1" /> <Button class="btn_global_blue_80x30" name="btn_forward" width="50" height="30" textid="STRID_CEF_BROWSER_FORWARD" valign="center" font="system_12" />
<Button class="btn_global_blue_80x30" name="btn_refresh" width="50" height="30" textid="STRID_CEF_BROWSER_REFRESH" valign="center" font="1" /> <Button class="btn_global_blue_80x30" name="btn_refresh" width="50" height="30" textid="STRID_CEF_BROWSER_REFRESH" valign="center" font="system_12" />
<RichEdit class="simple prompt" name="edit_url" width="400" height="30" padding="5,2,5,0" valign="center" <RichEdit class="simple prompt" name="edit_url" width="400" height="30" padding="5,2,5,0" valign="center"
bordercolor="gray" bordersize="1" font="2" prompttextid="STRID_CEF_BROWSER_INPUT_ADDRESS" vscrollbar="false" autovscroll="false" hscrollbar="false" autohscroll="true" wantreturnmsg="true" /> bordercolor="gray" bordersize="1" font="system_14" prompttextid="STRID_CEF_BROWSER_INPUT_ADDRESS" vscrollbar="false" autovscroll="false" hscrollbar="false" autohscroll="true" wantreturnmsg="true" />
<!-- 顶部标签列表 --> <!-- 顶部标签列表 -->
<HListBox class="list" name="tab_list" > <HListBox class="list" name="tab_list" >
<Button class="btn_global_blue_80x30" name="btn_add" text="+" width="20" height="20" valign="center" font="3" /> <Button class="btn_global_blue_80x30" name="btn_add" text="+" width="20" height="20" valign="center" font="system_16" />
</HListBox> </HListBox>
</HBox> </HBox>
<Control class="splitline_hor_level1" margin="0,0,0,0" /> <Control class="splitline_hor_level1" margin="0,0,0,0" />

View File

@ -6,7 +6,7 @@
<Control name="tab_item_icon" width="38" height="38" borderround="38,38,38,38" margin="1,1,0,0"/> <Control name="tab_item_icon" width="38" height="38" borderround="38,38,38,38" margin="1,1,0,0"/>
<Control class="icon_headimage_mask_40x40"/> <Control class="icon_headimage_mask_40x40"/>
</Box> </Box>
<Label name="tab_item_name" width="stretch" valign="center" font="1" mouse="false"/> <Label name="tab_item_name" width="stretch" valign="center" font="system_12" mouse="false"/>
<Box width="auto" height="auto" float="true" halign="right" valign="center"> <Box width="auto" height="auto" float="true" halign="right" valign="center">
<Button class="btn_del_search" name="tab_item_close" width="16" height="16" halign="center" valign="center" visible="false"/> <Button class="btn_del_search" name="tab_item_close" width="16" height="16" halign="center" valign="center" visible="false"/>

View File

@ -2,7 +2,7 @@
<Window size="400,600" caption="0,0,0,35"> <Window size="400,600" caption="0,0,0,35">
<VBox bkcolor="bk_wnd_darkcolor"> <VBox bkcolor="bk_wnd_darkcolor">
<HBox width="stretch" height="35" bkcolor="bk_wnd_lightcolor"> <HBox width="stretch" height="35" bkcolor="bk_wnd_lightcolor">
<Label text="自定义列表示例" font="2" valign="center" margin="8"/> <Label text="自定义列表示例" font="system_14" valign="center" margin="8"/>
<Control /> <Control />
<Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0"/> <Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0"/>
<Box width="21" margin="4,6,0,0"> <Box width="21" margin="4,6,0,0">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Window size="340,180" caption="0,0,0,600" shadowattached="false" custom_shadow="10,10,10,10"> <Window size="340,180" caption="0,0,0,600" shadowattached="false" custom_shadow="10,10,10,10">
<Box width="340" height="auto" bkimage="file='win_bg.png' corner='15,15,15,15'"> <Box width="340" height="auto" bkimage="file='win_bg.png' corner='15,15,15,15'">
<RichEdit name="content" width="300" minheight="30" margin="20,20,20,20" font="2" multiline="true" vscrollbar="false" autovscroll="false" enabled="false" rich="false" mouse="false" disabledtextcolor="light_gray"/> <RichEdit name="content" width="300" minheight="30" margin="20,20,20,20" font="system_14" multiline="true" vscrollbar="false" autovscroll="false" enabled="false" rich="false" mouse="false" disabledtextcolor="light_gray"/>
<Button name="close_btn" width="25" height="24" valign="top" halign="right" visible="false" normalimage="file='close.png' source='0,0,24,24'" hotimage="file='close.png' source='25,0,49,24'" pushedimage="file='close.png' source='50,0,74,24'" disabledimage="file='close.png' source='75,0,99,24'"/> <Button name="close_btn" width="25" height="24" valign="top" halign="right" visible="false" normalimage="file='close.png' source='0,0,24,24'" hotimage="file='close.png' source='25,0,49,24'" pushedimage="file='close.png' source='50,0,74,24'" disabledimage="file='close.png' source='75,0,99,24'"/>
</Box> </Box>
</Window> </Window>

View File

@ -225,7 +225,7 @@ void CheckBoxTemplate<InheritType>::PaintText(IRenderContext* pRender)
std::wstring newTextColor = m_dwSelectedTextColor.empty() ? this->m_textColorMap[kControlStateNormal] : m_dwSelectedTextColor; std::wstring newTextColor = m_dwSelectedTextColor.empty() ? this->m_textColorMap[kControlStateNormal] : m_dwSelectedTextColor;
DWORD dwTextColor = GlobalManager::GetTextColor(newTextColor); DWORD dwTextColor = GlobalManager::GetTextColor(newTextColor);
DWORD dwDisabledTextColor = GlobalManager::GetTextColor(this->m_textColorMap[kControlStateDisabled]); DWORD dwDisabledTextColor = GlobalManager::GetTextColor(this->m_textColorMap[kControlStateDisabled]);
pRender->DrawText(rc, this->GetText(), this->IsEnabled() ? dwTextColor : dwDisabledTextColor, this->m_iFont, this->m_uTextStyle); pRender->DrawText(rc, this->GetText(), this->IsEnabled() ? dwTextColor : dwDisabledTextColor, this->m_sFontId, this->m_uTextStyle);
} }
template<typename InheritType> template<typename InheritType>

View File

@ -56,14 +56,14 @@ public:
* @brief * @brief
* @return global.xml * @return global.xml
*/ */
int GetFont() const; std::wstring GetFont() const;
/** /**
* @brief * @brief
* @param[in] index global.xml * @param[in] index global.xml
* @return * @return
*/ */
void SetFont(int index); void SetFont(const std::wstring& strFontId);
/** /**
* @brief * @brief
@ -105,7 +105,7 @@ public:
void SetLineLimit(bool bLineLimit); void SetLineLimit(bool bLineLimit);
protected: protected:
int m_iFont; std::wstring m_sFontId;
UINT m_uTextStyle; UINT m_uTextStyle;
bool m_bSingleLine; bool m_bSingleLine;
bool m_bLineLimit; bool m_bLineLimit;
@ -119,7 +119,7 @@ protected:
template<typename InheritType> template<typename InheritType>
LabelTemplate<InheritType>::LabelTemplate() : LabelTemplate<InheritType>::LabelTemplate() :
m_iFont(1), m_sFontId(),
m_uTextStyle(DT_LEFT | DT_TOP | DT_END_ELLIPSIS | DT_NOCLIP | DT_SINGLELINE), m_uTextStyle(DT_LEFT | DT_TOP | DT_END_ELLIPSIS | DT_NOCLIP | DT_SINGLELINE),
m_bSingleLine(true), m_bSingleLine(true),
m_bLineLimit(false), m_bLineLimit(false),
@ -226,7 +226,7 @@ CSize LabelTemplate<InheritType>::EstimateText(CSize szAvailable, bool& bReEstim
CSize fixedSize; CSize fixedSize;
if (!GetText().empty()) { if (!GetText().empty()) {
auto pRender = this->m_pWindow->GetRenderContext(); auto pRender = this->m_pWindow->GetRenderContext();
UiRect rect = pRender->MeasureText(GetText(), m_iFont, m_uTextStyle, width); UiRect rect = pRender->MeasureText(GetText(), m_sFontId, m_uTextStyle, width);
if (this->GetFixedWidth() == DUI_LENGTH_AUTO) { if (this->GetFixedWidth() == DUI_LENGTH_AUTO) {
fixedSize.cx = rect.right - rect.left + m_rcTextPadding.left + m_rcTextPadding.right; fixedSize.cx = rect.right - rect.left + m_rcTextPadding.left + m_rcTextPadding.right;
} }
@ -239,7 +239,7 @@ CSize LabelTemplate<InheritType>::EstimateText(CSize szAvailable, bool& bReEstim
int maxWidth = szAvailable.cx - m_rcTextPadding.left - m_rcTextPadding.right; int maxWidth = szAvailable.cx - m_rcTextPadding.left - m_rcTextPadding.right;
if (estimateWidth > maxWidth) { if (estimateWidth > maxWidth) {
estimateWidth = maxWidth; estimateWidth = maxWidth;
UiRect newRect = pRender->MeasureText(GetText(), m_iFont, m_uTextStyle, estimateWidth); UiRect newRect = pRender->MeasureText(GetText(), m_sFontId, m_uTextStyle, estimateWidth);
estimateHeight = newRect.bottom - newRect.top; estimateHeight = newRect.bottom - newRect.top;
} }
} }
@ -288,7 +288,7 @@ void LabelTemplate<InheritType>::SetAttribute(const std::wstring& strName, const
else if (strName == _T("singleline")) SetSingleLine(strValue == _T("true")); else if (strName == _T("singleline")) SetSingleLine(strValue == _T("true"));
else if (strName == _T("text")) SetText(strValue); else if (strName == _T("text")) SetText(strValue);
else if (strName == _T("textid")) SetTextId(strValue); else if (strName == _T("textid")) SetTextId(strValue);
else if (strName == _T("font")) SetFont(_ttoi(strValue.c_str())); else if (strName == _T("font")) SetFont(strValue);
else if (strName == _T("normaltextcolor")) SetStateTextColor(kControlStateNormal, strValue); else if (strName == _T("normaltextcolor")) SetStateTextColor(kControlStateNormal, strValue);
else if (strName == _T("hottextcolor")) SetStateTextColor(kControlStateHot, strValue); else if (strName == _T("hottextcolor")) SetStateTextColor(kControlStateHot, strValue);
else if (strName == _T("pushedtextcolor")) SetStateTextColor(kControlStatePushed, strValue); else if (strName == _T("pushedtextcolor")) SetStateTextColor(kControlStatePushed, strValue);
@ -339,14 +339,14 @@ void LabelTemplate<InheritType>::PaintText(IRenderContext* pRender)
std::wstring clrColor = GetStateTextColor(kControlStateNormal); std::wstring clrColor = GetStateTextColor(kControlStateNormal);
if (!clrColor.empty()) { if (!clrColor.empty()) {
DWORD dwClrColor = GlobalManager::GetTextColor(clrColor); DWORD dwClrColor = GlobalManager::GetTextColor(clrColor);
pRender->DrawText(rc, GetText(), dwClrColor, m_iFont, m_uTextStyle, 255, m_bLineLimit); pRender->DrawText(rc, GetText(), dwClrColor, m_sFontId, m_uTextStyle, 255, m_bLineLimit);
} }
if (this->m_nHotAlpha > 0) { if (this->m_nHotAlpha > 0) {
std::wstring clrColor = GetStateTextColor(kControlStateHot); std::wstring clrColor = GetStateTextColor(kControlStateHot);
if (!clrColor.empty()) { if (!clrColor.empty()) {
DWORD dwClrColor = GlobalManager::GetTextColor(clrColor); DWORD dwClrColor = GlobalManager::GetTextColor(clrColor);
pRender->DrawText(rc, GetText(), dwClrColor, m_iFont, m_uTextStyle, (BYTE)this->m_nHotAlpha, m_bLineLimit); pRender->DrawText(rc, GetText(), dwClrColor, m_sFontId, m_uTextStyle, (BYTE)this->m_nHotAlpha, m_bLineLimit);
} }
} }
@ -354,7 +354,7 @@ void LabelTemplate<InheritType>::PaintText(IRenderContext* pRender)
} }
} }
pRender->DrawText(rc, GetText(), dwClrColor, m_iFont, m_uTextStyle, 255, m_bLineLimit); pRender->DrawText(rc, GetText(), dwClrColor, m_sFontId, m_uTextStyle, 255, m_bLineLimit);
} }
template<typename InheritType> template<typename InheritType>
@ -387,15 +387,15 @@ void LabelTemplate<InheritType>::SetStateTextColor(ControlStateType stateType, c
} }
template<typename InheritType> template<typename InheritType>
int LabelTemplate<InheritType>::GetFont() const std::wstring LabelTemplate<InheritType>::GetFont() const
{ {
return m_iFont; return m_sFontId;
} }
template<typename InheritType> template<typename InheritType>
void LabelTemplate<InheritType>::SetFont(int index) void LabelTemplate<InheritType>::SetFont(const std::wstring& strFontId)
{ {
m_iFont = index; m_sFontId = strFontId;
this->Invalidate(); this->Invalidate();
} }

View File

@ -1172,7 +1172,7 @@ RichEdit::RichEdit() :
m_iCaretPosY(0), m_iCaretPosY(0),
m_iCaretWidth(0), m_iCaretWidth(0),
m_iCaretHeight(0), m_iCaretHeight(0),
m_iFont(0), m_sFontId(),
m_iLimitText(0), m_iLimitText(0),
m_lTwhStyle(ES_MULTILINE), m_lTwhStyle(ES_MULTILINE),
m_textVerAlignType(kVerAlignTop), m_textVerAlignType(kVerAlignTop),
@ -1274,16 +1274,16 @@ void RichEdit::SetWordWrap(bool bWordWrap)
if( m_pTwh ) m_pTwh->SetWordWrap(bWordWrap); if( m_pTwh ) m_pTwh->SetWordWrap(bWordWrap);
} }
int RichEdit::GetFont() std::wstring RichEdit::GetFont() const
{ {
return m_iFont; return m_sFontId;
} }
void RichEdit::SetFont(int index) void RichEdit::SetFont(const std::wstring& strFontId)
{ {
m_iFont = index; m_sFontId = strFontId;
if( m_pTwh ) { if( m_pTwh ) {
m_pTwh->SetFont(GlobalManager::GetFont(m_iFont)); m_pTwh->SetFont(GlobalManager::GetFont(m_sFontId));
} }
} }
@ -2745,7 +2745,7 @@ void RichEdit::SetAttribute(const std::wstring& strName, const std::wstring& str
else if (strName == _T("prompttext")) SetPromptText(strValue); else if (strName == _T("prompttext")) SetPromptText(strValue);
else if (strName == _T("prompttextid")) SetPromptTextId(strValue); else if (strName == _T("prompttextid")) SetPromptTextId(strValue);
else if (strName == _T("focusedimage")) SetFocusedImage(strValue); else if (strName == _T("focusedimage")) SetFocusedImage(strValue);
else if (strName == _T("font")) SetFont(_ttoi(strValue.c_str())); else if (strName == _T("font")) SetFont(strValue);
else if (strName == _T("text")) SetText(strValue.c_str()); else if (strName == _T("text")) SetText(strValue.c_str());
else if (strName == _T("textid")) SetTextId(strValue.c_str()); else if (strName == _T("textid")) SetTextId(strValue.c_str());
else if (strName == _T("wanttab")) SetWantTab(strValue == _T("true")); else if (strName == _T("wanttab")) SetWantTab(strValue == _T("true"));
@ -2899,7 +2899,7 @@ void RichEdit::PaintPromptText(IRenderContext* pRender)
DWORD dwClrColor = GlobalManager::GetTextColor(m_sPromptColor); DWORD dwClrColor = GlobalManager::GetTextColor(m_sPromptColor);
UINT dwStyle = DT_NOCLIP; UINT dwStyle = DT_NOCLIP;
pRender->DrawText(rc, strPrompt, dwClrColor, m_iFont, dwStyle); pRender->DrawText(rc, strPrompt, dwClrColor, m_sFontId, dwStyle);
} }
std::wstring RichEdit::GetFocusedImage() std::wstring RichEdit::GetFocusedImage()
@ -2995,23 +2995,23 @@ void RichEdit::AddLinkColorText(const std::wstring &str, const std::wstring &col
GetDefaultCharFormat(cf); GetDefaultCharFormat(cf);
SetSelectionCharFormat(cf); SetSelectionCharFormat(cf);
} }
void RichEdit::AddLinkColorTextEx(const std::wstring& str, const std::wstring &color, const std::wstring &linkInfo, int font) void RichEdit::AddLinkColorTextEx(const std::wstring& str, const std::wstring &color, const std::wstring &linkInfo, const std::wstring& strFontId)
{ {
if (!m_bRich || str.empty() || color.empty()) { if (!m_bRich || str.empty() || color.empty()) {
ASSERT(FALSE); ASSERT(FALSE);
return; return;
} }
int ifont = font >= 0 ? font : m_iFont;
std::string link; std::string link;
std::string text; std::string text;
std::string font_face; std::string font_face;
StringHelper::UnicodeToMBCS(linkInfo, link); StringHelper::UnicodeToMBCS(linkInfo, link);
StringHelper::UnicodeToMBCS(str, text); StringHelper::UnicodeToMBCS(str, text);
auto hFont = GlobalManager::GetFont(ifont); auto hFont = GlobalManager::GetFont(strFontId);
if (hFont == NULL) if (hFont == NULL)
hFont = GlobalManager::GetFont(m_iFont); hFont = GlobalManager::GetFont(m_sFontId);
if (hFont == NULL) if (hFont == NULL)
hFont = GlobalManager::GetFont(0); hFont = GlobalManager::GetFont(L"");
LOGFONT lf; LOGFONT lf;
::GetObject(hFont, sizeof(LOGFONT), &lf); ::GetObject(hFont, sizeof(LOGFONT), &lf);
StringHelper::UnicodeToMBCS(lf.lfFaceName, font_face); StringHelper::UnicodeToMBCS(lf.lfFaceName, font_face);

View File

@ -118,14 +118,14 @@ public:
* @brief * @brief
* @return global.xml * @return global.xml
*/ */
int GetFont(); std::wstring GetFont() const;
/** /**
* @brief * @brief
* @param[in] index global.xml * @param[in] index global.xml
* @return * @return
*/ */
void SetFont(int index); void SetFont(const std::wstring& strFontId);
void SetFont(HFONT font); void SetFont(HFONT font);
/** /**
* @brief * @brief
@ -875,7 +875,7 @@ public:
* @param[in] font * @param[in] font
* @return * @return
*/ */
void AddLinkColorTextEx(const std::wstring& str, const std::wstring &color, const std::wstring &linkInfo = L"", int font = -1); void AddLinkColorTextEx(const std::wstring& str, const std::wstring &color, const std::wstring &linkInfo = L"", const std::wstring& strFontId = L"");
/** /**
* @brief hittest * @brief hittest
@ -956,7 +956,7 @@ protected:
int m_iCaretPosY; int m_iCaretPosY;
int m_iCaretWidth; int m_iCaretWidth;
int m_iCaretHeight; int m_iCaretHeight;
int m_iFont; std::wstring m_sFontId;
int m_iLimitText; int m_iLimitText;
LONG m_lTwhStyle; LONG m_lTwhStyle;
VerAlignType m_textVerAlignType; VerAlignType m_textVerAlignType;

View File

@ -14,7 +14,8 @@ CreateControlCallback GlobalManager::m_createControlCallback;
GlobalManager::MapStringToImagePtr GlobalManager::m_mImageHash; GlobalManager::MapStringToImagePtr GlobalManager::m_mImageHash;
std::map<std::wstring, DWORD> GlobalManager::m_mapTextColor; std::map<std::wstring, DWORD> GlobalManager::m_mapTextColor;
std::map<std::wstring, std::wstring> GlobalManager::m_mGlobalClass; std::map<std::wstring, std::wstring> GlobalManager::m_mGlobalClass;
std::vector<TFontInfo*> GlobalManager::m_aCustomFonts; std::map<std::wstring, TFontInfo*> GlobalManager::m_mCustomFonts;
std::wstring GlobalManager::m_sDefaultFontId;
short GlobalManager::m_H = 180; short GlobalManager::m_H = 180;
short GlobalManager::m_S = 100; short GlobalManager::m_S = 100;
@ -366,8 +367,17 @@ void GlobalManager::RemoveAllImages()
m_mImageHash.clear(); m_mImageHash.clear();
} }
HFONT GlobalManager::AddFont(const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic) HFONT GlobalManager::AddFont(const std::wstring& strFontId, const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic, bool bDefault)
{ {
std::wstring strNewFontId = strFontId;
if (strNewFontId.empty())
{
strNewFontId = std::to_wstring(m_mCustomFonts.size());
}
auto iter = m_mCustomFonts.find(strNewFontId);
ASSERT(iter == m_mCustomFonts.end());
static bool bOsOverXp = IsWindowsVistaOrGreater(); static bool bOsOverXp = IsWindowsVistaOrGreater();
std::wstring fontName = strFontName; std::wstring fontName = strFontName;
if ( fontName == L"system" ) { if ( fontName == L"system" ) {
@ -395,23 +405,32 @@ HFONT GlobalManager::AddFont(const std::wstring& strFontName, int nSize, bool bB
pFontInfo->bItalic = bItalic; pFontInfo->bItalic = bItalic;
::ZeroMemory(&pFontInfo->tm, sizeof(pFontInfo->tm)); ::ZeroMemory(&pFontInfo->tm, sizeof(pFontInfo->tm));
m_aCustomFonts.push_back(pFontInfo); m_mCustomFonts.insert(std::make_pair(strNewFontId, pFontInfo));
if (bDefault) m_sDefaultFontId = strNewFontId;
return hFont; return hFont;
} }
TFontInfo* GlobalManager::GetTFontInfo(std::size_t index) TFontInfo* GlobalManager::GetTFontInfo(const std::wstring& strFontId)
{ {
ASSERT(index >= 0 || index < m_aCustomFonts.size()); std::wstring strFindId = strFontId;
if (index < 0 && index >= m_aCustomFonts.size()) if (strFindId.empty())
return NULL; {
TFontInfo* pFontInfo = static_cast<TFontInfo*>(m_aCustomFonts[index]); ASSERT(!m_sDefaultFontId.empty());
strFindId = m_sDefaultFontId;
}
auto iter = m_mCustomFonts.find(strFindId);
ASSERT(iter != m_mCustomFonts.end());
TFontInfo* pFontInfo = static_cast<TFontInfo*>(iter->second);
return pFontInfo; return pFontInfo;
} }
HFONT GlobalManager::GetFont(std::size_t index) HFONT GlobalManager::GetFont(const std::wstring& strFontId)
{ {
TFontInfo* pFontInfo = GetTFontInfo(index); TFontInfo* pFontInfo = GetTFontInfo(strFontId);
if (pFontInfo) if (pFontInfo)
return pFontInfo->hFont; return pFontInfo->hFont;
return nullptr; return nullptr;
@ -419,8 +438,8 @@ HFONT GlobalManager::GetFont(std::size_t index)
HFONT GlobalManager::GetFont(const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic) HFONT GlobalManager::GetFont(const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic)
{ {
for( auto it = m_aCustomFonts.begin(); it != m_aCustomFonts.end(); it++ ) { for (auto it = m_mCustomFonts.begin(); it != m_mCustomFonts.end(); it++) {
auto pFontInfo = *it; auto pFontInfo = it->second;
if( pFontInfo->sFontName == strFontName && pFontInfo->iSize == nSize && if( pFontInfo->sFontName == strFontName && pFontInfo->iSize == nSize &&
pFontInfo->bBold == bBold && pFontInfo->bUnderline == bUnderline && pFontInfo->bItalic == bItalic) pFontInfo->bBold == bBold && pFontInfo->bUnderline == bUnderline && pFontInfo->bItalic == bItalic)
return pFontInfo->hFont; return pFontInfo->hFont;
@ -428,12 +447,9 @@ HFONT GlobalManager::GetFont(const std::wstring& strFontName, int nSize, bool bB
return NULL; return NULL;
} }
TFontInfo* GlobalManager::GetFontInfo(std::size_t index, HDC hDcPaint) TFontInfo* GlobalManager::GetFontInfo(const std::wstring& strFontId, HDC hDcPaint)
{ {
ASSERT(index >= 0 || index < m_aCustomFonts.size()); TFontInfo* pFontInfo = GetTFontInfo(strFontId);
if (index < 0 && index >= m_aCustomFonts.size())
return NULL;
TFontInfo* pFontInfo = static_cast<TFontInfo*>(m_aCustomFonts[index]);
if( pFontInfo->tm.tmHeight == 0 ) { if( pFontInfo->tm.tmHeight == 0 ) {
HFONT hOldFont = (HFONT) ::SelectObject(hDcPaint, pFontInfo->hFont); HFONT hOldFont = (HFONT) ::SelectObject(hDcPaint, pFontInfo->hFont);
::GetTextMetrics(hDcPaint, &pFontInfo->tm); ::GetTextMetrics(hDcPaint, &pFontInfo->tm);
@ -444,8 +460,8 @@ TFontInfo* GlobalManager::GetFontInfo(std::size_t index, HDC hDcPaint)
TFontInfo* GlobalManager::GetFontInfo(HFONT hFont, HDC hDcPaint) TFontInfo* GlobalManager::GetFontInfo(HFONT hFont, HDC hDcPaint)
{ {
for( auto it = m_aCustomFonts.begin(); it != m_aCustomFonts.end(); it++ ) { for( auto it = m_mCustomFonts.begin(); it != m_mCustomFonts.end(); it++ ) {
auto pFontInfo = *it; auto pFontInfo = it->second;
if( pFontInfo->hFont == hFont ) { if( pFontInfo->hFont == hFont ) {
if( pFontInfo->tm.tmHeight == 0 ) { if( pFontInfo->tm.tmHeight == 0 ) {
HFONT hOldFont = (HFONT) ::SelectObject(hDcPaint, pFontInfo->hFont); HFONT hOldFont = (HFONT) ::SelectObject(hDcPaint, pFontInfo->hFont);
@ -462,8 +478,8 @@ TFontInfo* GlobalManager::GetFontInfo(HFONT hFont, HDC hDcPaint)
bool GlobalManager::FindFont(HFONT hFont) bool GlobalManager::FindFont(HFONT hFont)
{ {
for( auto it = m_aCustomFonts.begin(); it != m_aCustomFonts.end(); it++ ) { for( auto it = m_mCustomFonts.begin(); it != m_mCustomFonts.end(); it++ ) {
auto pFontInfo = *it; auto pFontInfo = it->second;
if( pFontInfo->hFont == hFont ) if( pFontInfo->hFont == hFont )
return true; return true;
} }
@ -472,8 +488,8 @@ bool GlobalManager::FindFont(HFONT hFont)
bool GlobalManager::FindFont(const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic) bool GlobalManager::FindFont(const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic)
{ {
for( auto it = m_aCustomFonts.begin(); it != m_aCustomFonts.end(); it++ ) { for (auto it = m_mCustomFonts.begin(); it != m_mCustomFonts.end(); it++) {
auto pFontInfo = *it; auto pFontInfo = it->second;
if( pFontInfo->sFontName == strFontName && pFontInfo->iSize == nSize && if( pFontInfo->sFontName == strFontName && pFontInfo->iSize == nSize &&
pFontInfo->bBold == bBold && pFontInfo->bUnderline == bUnderline && pFontInfo->bItalic == bItalic) pFontInfo->bBold == bBold && pFontInfo->bUnderline == bUnderline && pFontInfo->bItalic == bItalic)
return true; return true;
@ -481,24 +497,28 @@ bool GlobalManager::FindFont(const std::wstring& strFontName, int nSize, bool bB
return false; return false;
} }
bool GlobalManager::RemoveFontAt(std::size_t index) bool GlobalManager::RemoveFontAt(const std::wstring& strFontId)
{ {
if( index < 0 || index >= m_aCustomFonts.size() ) return false; auto iter = m_mCustomFonts.find(strFontId);
TFontInfo* pFontInfo = static_cast<TFontInfo*>(m_aCustomFonts[index]); if (iter == m_mCustomFonts.end()) return false;
TFontInfo* pFontInfo = static_cast<TFontInfo*>(iter->second);
::DeleteObject(pFontInfo->hFont); ::DeleteObject(pFontInfo->hFont);
delete pFontInfo; delete pFontInfo;
m_aCustomFonts.erase(m_aCustomFonts.begin() + index);
m_mCustomFonts.erase(iter);
return true; return true;
} }
void GlobalManager::RemoveAllFonts() void GlobalManager::RemoveAllFonts()
{ {
for( auto it = m_aCustomFonts.begin(); it != m_aCustomFonts.end(); it++ ) { for (auto it = m_mCustomFonts.begin(); it != m_mCustomFonts.end(); it++) {
auto pFontInfo = *it; auto pFontInfo = it->second;
::DeleteObject(pFontInfo->hFont); ::DeleteObject(pFontInfo->hFont);
delete pFontInfo; delete pFontInfo;
} }
m_aCustomFonts.clear(); m_mCustomFonts.clear();
} }
std::wstring GlobalManager::GetDefaultDisabledTextColor() std::wstring GlobalManager::GetDefaultDisabledTextColor()

View File

@ -200,29 +200,30 @@ public:
/** /**
* @brief * @brief
* @param[in] strFontId ID标记
* @param[in] strFontName * @param[in] strFontName
* @param[in] nSize * @param[in] nSize
* @param[in] bBold * @param[in] bBold
* @param[in] bUnderline 线 * @param[in] bUnderline 线
* @param[in] bItalic * @param[in] bItalic
* @param[in] bDefault
* @return HFONT * @return HFONT
*/ */
static HFONT AddFont(const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic); static HFONT AddFont(const std::wstring& strFontId, const std::wstring& strFontName, int nSize, bool bBold, bool bUnderline, bool bItalic, bool bDefault);
/** /**
* @brief * @brief
* @param[in] index * @param[in] strFontId ID
* @return TFontInfo * @return TFontInfo
*/ */
static TFontInfo* GetTFontInfo(std::size_t index); static TFontInfo* GetTFontInfo(const std::wstring& strFontId);
/** /**
* @brief * @brief ID返回一个字体对
* @param[in] index * @param[in] strFontId ID
* @return HFONT * @return HFONT
*/ */
static HFONT GetFont(std::size_t index); static HFONT GetFont(const std::wstring& strFontId);
/** /**
* @brief * @brief
* @param[in] strFontName * @param[in] strFontName
@ -236,11 +237,11 @@ public:
/** /**
* @brief * @brief
* @param[in] index * @param[in] strFontId ID
* @param[in] hDcPaint * @param[in] hDcPaint
* @return TFontInfo * @return TFontInfo
*/ */
static TFontInfo* GetFontInfo(std::size_t index, HDC hDcPaint); static TFontInfo* GetFontInfo(const std::wstring& strFontId, HDC hDcPaint);
/** /**
* @brief * @brief
@ -274,12 +275,12 @@ public:
/** /**
* @brief * @brief
* @param[in] index * @param[in] strFontId ID
* @return * @return
* @retval true * @retval true
* @retval false * @retval false
*/ */
static bool RemoveFontAt(std::size_t index); static bool RemoveFontAt(const std::wstring& strFontId);
/** /**
* @brief * @brief
@ -457,7 +458,9 @@ private:
static MapStringToImagePtr m_mImageHash; static MapStringToImagePtr m_mImageHash;
static std::map<std::wstring, DWORD> m_mapTextColor; static std::map<std::wstring, DWORD> m_mapTextColor;
static std::map<std::wstring, std::wstring> m_mGlobalClass; static std::map<std::wstring, std::wstring> m_mGlobalClass;
static std::vector<TFontInfo*> m_aCustomFonts; static std::map<std::wstring, TFontInfo*> m_mCustomFonts;
static std::wstring m_sDefaultFontId;
static short m_H; static short m_H;
static short m_S; static short m_S;

View File

@ -193,15 +193,21 @@ Box* WindowBuilder::Create(CreateControlCallback pCallback, Window* pManager, Bo
} }
else if( strClass == _T("Font") ) { else if( strClass == _T("Font") ) {
nAttributes = node.GetAttributeCount(); nAttributes = node.GetAttributeCount();
std::wstring strFontId;
std::wstring strFontName; std::wstring strFontName;
int size = 12; int size = 12;
bool bold = false; bool bold = false;
bool underline = false; bool underline = false;
bool italic = false; bool italic = false;
bool isDefault = false;
for( int i = 0; i < nAttributes; i++ ) { for( int i = 0; i < nAttributes; i++ ) {
strName = node.GetAttributeName(i); strName = node.GetAttributeName(i);
strValue = node.GetAttributeValue(i); strValue = node.GetAttributeValue(i);
if( strName == _T("name") ) { if (strName == _T("id"))
{
strFontId = strValue;
}
else if( strName == _T("name") ) {
strFontName = strValue; strFontName = strValue;
} }
else if( strName == _T("size") ) { else if( strName == _T("size") ) {
@ -217,11 +223,11 @@ Box* WindowBuilder::Create(CreateControlCallback pCallback, Window* pManager, Bo
italic = (strValue == _T("true")); italic = (strValue == _T("true"));
} }
else if( strName == _T("default") ) { else if( strName == _T("default") ) {
ASSERT(FALSE);//·ÏÆú isDefault = (strValue == _T("true"));
} }
} }
if( !strFontName.empty() ) { if( !strFontName.empty() ) {
GlobalManager::AddFont(strFontName, size, bold, underline, italic); GlobalManager::AddFont(strFontId, strFontName, size, bold, underline, italic, isDefault);
} }
} }
else if( strClass == _T("Class") ) { else if( strClass == _T("Class") ) {

View File

@ -204,12 +204,12 @@ public:
virtual void DrawLine(const IPen* pen, int x1, int y1, int x2, int y2) = 0; virtual void DrawLine(const IPen* pen, int x1, int y1, int x2, int y2) = 0;
virtual void DrawBezier(const IPen* pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) = 0; virtual void DrawBezier(const IPen* pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) = 0;
virtual void DrawRect(const UiRect& rc, int nSize, DWORD dwPenColor) = 0; virtual void DrawRect(const UiRect& rc, int nSize, DWORD dwPenColor) = 0;
virtual void DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, int iFont, UINT uStyle, BYTE uFade = 255, bool bLineLimit = false) = 0; virtual void DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, const std::wstring& strFontId, UINT uStyle, BYTE uFade = 255, bool bLineLimit = false) = 0;
virtual void DrawEllipse(const UiRect& rc, int nSize, DWORD dwColor) = 0; virtual void DrawEllipse(const UiRect& rc, int nSize, DWORD dwColor) = 0;
virtual void FillEllipse(const UiRect& rc, DWORD dwColor) = 0; virtual void FillEllipse(const UiRect& rc, DWORD dwColor) = 0;
virtual UiRect MeasureText(const std::wstring& strText, int iFont, UINT uStyle, int width = DUI_NOSET_VALUE) = 0; virtual UiRect MeasureText(const std::wstring& strText, const std::wstring& strFontId, UINT uStyle, int width = DUI_NOSET_VALUE) = 0;
virtual void DrawPath(const IPath* path, const IPen* pen) = 0; virtual void DrawPath(const IPath* path, const IPen* pen) = 0;
virtual void FillPath(const IPath* path, const IBrush* brush) = 0; virtual void FillPath(const IPath* path, const IBrush* brush) = 0;

View File

@ -470,13 +470,13 @@ void RenderContext_GdiPlus::DrawRect(const UiRect& rc, int nSize, DWORD dwPenCol
graphics.DrawRectangle(&pen, rc.left, rc.top, rc.GetWidth(), rc.GetHeight()); graphics.DrawRectangle(&pen, rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
} }
void RenderContext_GdiPlus::DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, int iFont, UINT uStyle, BYTE uFade /*= 255*/, bool bLineLimit /*= false*/) void RenderContext_GdiPlus::DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, const std::wstring& strFontId, UINT uStyle, BYTE uFade /*= 255*/, bool bLineLimit /*= false*/)
{ {
ASSERT(::GetObjectType(m_hDC)==OBJ_DC || ::GetObjectType(m_hDC)==OBJ_MEMDC); ASSERT(::GetObjectType(m_hDC)==OBJ_DC || ::GetObjectType(m_hDC)==OBJ_MEMDC);
if( strText.empty() ) return; if( strText.empty() ) return;
Gdiplus::Graphics graphics( m_hDC ); Gdiplus::Graphics graphics( m_hDC );
Gdiplus::Font font(m_hDC, GlobalManager::GetFont(iFont)); Gdiplus::Font font(m_hDC, GlobalManager::GetFont(strFontId));
Gdiplus::RectF rcPaint((Gdiplus::REAL)rc.left, (Gdiplus::REAL)rc.top, (Gdiplus::REAL)(rc.right - rc.left), (Gdiplus::REAL)(rc.bottom - rc.top)); Gdiplus::RectF rcPaint((Gdiplus::REAL)rc.left, (Gdiplus::REAL)rc.top, (Gdiplus::REAL)(rc.right - rc.left), (Gdiplus::REAL)(rc.bottom - rc.top));
int alpha = dwTextColor >> 24; int alpha = dwTextColor >> 24;
uFade *= double(alpha) / 255; uFade *= double(alpha) / 255;
@ -519,7 +519,7 @@ void RenderContext_GdiPlus::DrawText(const UiRect& rc, const std::wstring& strTe
stringFormat.SetLineAlignment(Gdiplus::StringAlignmentNear); stringFormat.SetLineAlignment(Gdiplus::StringAlignmentNear);
} }
else if ((uStyle & DT_VCENTER) != 0) { else if ((uStyle & DT_VCENTER) != 0) {
TFontInfo* fontInfo = GlobalManager::GetTFontInfo(iFont); TFontInfo* fontInfo = GlobalManager::GetTFontInfo(strFontId);
if (fontInfo->sFontName == L"ÐÂËÎÌå") { if (fontInfo->sFontName == L"ÐÂËÎÌå") {
if (rcPaint.Height >= fontInfo->iSize + 2) { if (rcPaint.Height >= fontInfo->iSize + 2) {
rcPaint.Offset(0, 1); rcPaint.Offset(0, 1);
@ -567,10 +567,10 @@ void RenderContext_GdiPlus::FillPath(const IPath* path, const IBrush* brush)
graphics.FillPath(((Brush_Gdiplus*)brush)->GetBrush(), ((Path_Gdiplus*)path)->GetPath()); graphics.FillPath(((Brush_Gdiplus*)brush)->GetBrush(), ((Path_Gdiplus*)path)->GetPath());
} }
ui::UiRect RenderContext_GdiPlus::MeasureText(const std::wstring& strText, int iFont, UINT uStyle, int width /*= DUI_NOSET_VALUE*/) ui::UiRect RenderContext_GdiPlus::MeasureText(const std::wstring& strText, const std::wstring& strFontId, UINT uStyle, int width /*= DUI_NOSET_VALUE*/)
{ {
Gdiplus::Graphics graphics(m_hDC); Gdiplus::Graphics graphics(m_hDC);
Gdiplus::Font font(m_hDC, GlobalManager::GetFont(iFont)); Gdiplus::Font font(m_hDC, GlobalManager::GetFont(strFontId));
Gdiplus::RectF bounds; Gdiplus::RectF bounds;
Gdiplus::StringFormat stringFormat = Gdiplus::StringFormat::GenericTypographic(); Gdiplus::StringFormat stringFormat = Gdiplus::StringFormat::GenericTypographic();

View File

@ -51,12 +51,12 @@ public:
virtual void DrawLine(const IPen* pen, int x1, int y1, int x2, int y2) override; virtual void DrawLine(const IPen* pen, int x1, int y1, int x2, int y2) override;
virtual void DrawBezier(const IPen* pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) override; virtual void DrawBezier(const IPen* pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) override;
virtual void DrawRect(const UiRect& rc, int nSize, DWORD dwPenColor) override; virtual void DrawRect(const UiRect& rc, int nSize, DWORD dwPenColor) override;
virtual void DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, int iFont, UINT uStyle, BYTE uFade = 255, bool bLineLimit = false) override; virtual void DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, const std::wstring& strFontId, UINT uStyle, BYTE uFade = 255, bool bLineLimit = false) override;
virtual void DrawEllipse(const UiRect& rc, int nSize, DWORD dwColor) override; virtual void DrawEllipse(const UiRect& rc, int nSize, DWORD dwColor) override;
virtual void FillEllipse(const UiRect& rc, DWORD dwColor) override; virtual void FillEllipse(const UiRect& rc, DWORD dwColor) override;
virtual UiRect MeasureText(const std::wstring& strText, int iFont, UINT uStyle, int width = DUI_NOSET_VALUE) override; virtual UiRect MeasureText(const std::wstring& strText, const std::wstring& strFontId, UINT uStyle, int width = DUI_NOSET_VALUE) override;
virtual void DrawPath(const IPath* path, const IPen* pen) override; virtual void DrawPath(const IPath* path, const IPen* pen) override;
virtual void FillPath(const IPath* path, const IBrush* brush) override; virtual void FillPath(const IPath* path, const IBrush* brush) override;