nim_duilib(20)之即刻(1)


note

一個基於nim_duilib仿wechat的IM。

主界面

樣式


美工差了

布局

整體為水平布局,左邊的深灰色區域(frame_left),右側的light white區域(frame_right)。
右側的區域(frame_right)分為垂直布局,其中,左側紅色用於顯示好友列表,右側綠色用於顯示聊天對話框

global xml中定義

定義了一些控件的樣式

    <!--左側窗口控件-->
    <Class name="left_btn_portrait" tooltiptext="頭像"  height="36" width="36" margin="10,20,10,10" bkcolor="color_light_white1" normalimage="file='../left_frame/portrait_32X32.png'" />
    <Class name="left_opt_msg" tooltiptext="消息" text="消息" height="36" width="36" margin="10,20,10,10" bkcolor="color_light_white1" 
                      selectednormalimage="file='../public/button/btn_global_red_80x30_normal.png'"
                      selecteddisabledimage="file='../public/button/btn_global_red_80x30_normal.png' fade='30'"/>
  
    <Class name="left_opt_contact" tooltiptext="聯系人" text="聯系人" height="36" width="36" margin="10,20,10,10" bkcolor="color_light_white1" 
                      selectednormalimage="file='../public/button/btn_global_red_80x30_normal.png'"
                      selecteddisabledimage="file='../public/button/btn_global_red_80x30_normal.png' fade='30'"/>
  
    <Class name="left_opt_file" tooltiptext="文件" text="文件" height="36" width="36" margin="10,20,10,10" bkcolor="color_light_white1" 
                      selectednormalimage="file='../public/button/btn_global_red_80x30_normal.png'"
                      selecteddisabledimage="file='../public/button/btn_global_red_80x30_normal.png' fade='30'"/>
  
    <Class name="left_btn_setting" tooltiptext="設置" height="36" width="36" margin="10,20,10,10" bkcolor="color_light_white1" normalimage="file='../left_frame/setting.png'" />

    <!--中間窗體控件-->
    <TextColor name="edit_tip" value="#ffa8a8a8"/>
    <TextColor name="edit_bk_color" value="#ffd7d9d8"/>
    <Class name="middle_rich_edit_search" bkcolor="edit_bk_color" font="system_14" multiline="false" promptmode="true" prompttext="搜索" promptcolor="edit_tip"/>
    <Class name="middle_btn_add" font="system_16" bkcolor="color_light_white1"/>

frame_left

frame_left為垂直布局。 xml文件如下

    <!--左側的frame-->
    <VBox class="frame_left" height ="stretch" width="60" >
      <!--頭像-->
      <Button class="left_btn_portrait"  />
      
      <!--消息-->
      <Option class = "left_opt_msg" group = "left_frame" />

      <!--通訊錄-->
      <Option class = "left_opt_contact" group = "left_frame" />

      <!--文件-->
      <Option class = "left_opt_file" group = "left_frame" />

      <Control />

      <!--設置-->
      <Button class = "left_btn_setting" />

    </VBox>

frame_right

xml內容

    <!--右側的frame-->
    <VBox class="frame_middle_vbox" height="stretch" width="stretch">

      <!---->
      <HBox width="stretch" height="55" >
        <!--搜索-->
        <HBox width="250" height="30" margin="0,20,0,20">
          <Control name="search_icon" width="auto" height="auto" valign="center" margin="10,0,0,0" alpha="192"
                   bkimage="file='../frame_middle/icon_search_gray.png' "/>

          <RichEdit class="middle_rich_edit_search" name="search_edit" height="auto" margin="8,0,10,0" valign="center" font="system_12" />
          <Button class="middle_btn_top_del" name="clear_input" visible="false" valign="center" margin="0,0,10,0" />
          <Button class="middle_btn_top_add" text="+" height="25" width="30" margin="0,0,10,10"/>
        </HBox>
        
        <!--標題-->
        <Label text="1234567890abcdefghijklmpqrstuvwxyz" font="system_16" margin="10,20,0,0"/>
        
        <Control />
        <!--右上角3個按鈕-->
        <Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0" />
        <Box width="21" margin="4,6,0,0">
          <Button class="btn_wnd_max" name="maxbtn" />
          <Button class="btn_wnd_restore" name="restorebtn" visible="false"/>
        </Box>
        <Button class="btn_wnd_close" name="closebtn" margin="4,6,8,0"/>
      </HBox>
      
      <!--右側:聯系人列表和聊天框-->
      <HBox>
        <!--聯系人列表-->
        <VBox bkcolor="red" width="250" height="stretch">
          
        </VBox>
        <!--聊天對話框-->
        <VBox bkcolor="green" width="stretch" height="stretch">
          
        </VBox>
      </HBox> 
    </VBox>

xml完整

<?xml version="1.0" encoding="UTF-8"?>
<Window mininfo="700, 500" size="700,500" caption="0,0,0,500" shadowattached="true" sizebox="4,5,5,5"  >

  <HBox bkcolor="color_light_white1" height="stretch" width="stretch">
    
   
    <!--左側的frame-->
    <VBox class="frame_left_vbox" height ="stretch" width="60" >
      <!--頭像-->
      <Button class="left_btn_portrait"  />
      <!--消息-->
      <Option class="left_opt_msg" group = "left_frame" />
      <!--通訊錄-->
      <Option class="left_opt_contact" group = "left_frame" />
      <!--文件-->
      <Option class="left_opt_file" group = "left_frame" />
      <Control />
      <!--設置-->
      <Button class="left_btn_setting" />
    </VBox>

    <!--右側的frame-->
    <VBox class="frame_middle_vbox" height="stretch" width="stretch">

      <!---->
      <HBox width="stretch" height="55" >
        <!--搜索-->
        <HBox width="250" height="30" margin="0,20,0,20">
          <Control name="search_icon" width="auto" height="auto" valign="center" margin="10,0,0,0" alpha="192"
                   bkimage="file='../frame_middle/icon_search_gray.png' "/>

          <RichEdit class="middle_rich_edit_search" name="search_edit" height="auto" margin="8,0,10,0" valign="center" font="system_12" />
          <Button class="middle_btn_top_del" name="clear_input" visible="false" valign="center" margin="0,0,10,0" />
          <Button class="middle_btn_top_add" text="+" height="25" width="30" margin="0,0,10,10"/>
        </HBox>
        
        <!--標題-->
        <Label text="1234567890abcdefghijklmpqrstuvwxyz" font="system_16" margin="10,20,0,0"/>
        
        <Control />
        <!--右上角3個按鈕-->
        <Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0" />
        <Box width="21" margin="4,6,0,0">
          <Button class="btn_wnd_max" name="maxbtn" />
          <Button class="btn_wnd_restore" name="restorebtn" visible="false"/>
        </Box>
        <Button class="btn_wnd_close" name="closebtn" margin="4,6,8,0"/>
      </HBox>
      
      <!--右側:聯系人列表和聊天框-->
      <HBox>
        <!--聯系人列表-->
        <VBox bkcolor="red" width="250" height="stretch">
          
        </VBox>
        <!--聊天對話框-->
        <VBox bkcolor="green" width="stretch" height="stretch">
          
        </VBox>
      </HBox> 
    </VBox>
    
  </HBox>

</Window>



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM