• TD属性总结


    一)控件类型:

    type=“window”  //窗口

    type=“button”  //按钮

    type="text"  //文本

    type="processbar" //进度条

    type="listview" //列表

    二)控件公共属性

    x:相对于父控件的x坐标

    y:相对于父控件的y坐标

    w:宽度

    h:高度

    style:控件的属性,写到rc文件中

    caption:显示文字

    flags:

       hide:隐藏控件;show:显示控件

      disable:五作用状态

      窗口属性: window_normal、window_dock、window_desktop、window_splash、window_toolbar

      window_normal://普通窗口类型(有边框和标题栏)

      window_dock ://Dock 窗口类型(一种不参与窗口管理的特殊窗口)

      window_desktop: 0x0003  //桌面

      window_splash://没有边框和标题栏的普通窗口类型

      window_toolbar://工具条,不参与互斥

     窗口的层次自上而下依次为:

     dock_fullscreen、dock_above、dock、above、dock_below、normal、below、desktop;

    music_main_window={
    type="window"
    x=290 y=65 w=510 h=340
    style="home_mainwin"
    caption="EQ"
    flags={
    window_desktop
    window_splash
    scroll_grab_mouse
    window_scroll
    hide_h_scrollbar
    no_v_scroll
    window_scroll_fix_bg
    hide
    disable
    }

    三)button属性

    [nads] 分表表示 正常、活动、disable、selected

    font:字体大小

    text_color:字体颜色

    text_aline:字体位置(text_left  text_right text_top   text_bottom  text_middle text_xfollow text_yfollow)

    style_radio.rc

    button.radio_bottom_ta_btn {
    font="default-24"
    text_color=rgb(255,255,255)
    text_aline=text_bottom
    [na]
    bg="./radio/radio_but_ta_n.png",stretch_normal
    [s]
    bg="./radio/radio_but_ta_p.png",stretch_normal
    bg_aline=image_top
    }

    三)text文本,属性类似Button

      music_process_curTime_text={
        type="text"
        x=25
        y=316
        w=80
        h=30
        style="player_process_curTime"
        caption="00:00:00"
        flags={
          disable
        }
      }

    四)进度条

    layout_audio.ini

      music_process_bar={
        type="processbar"
        x=110
        y=309
        w=596
        h=40
        style="music_process"
        flags={
          processbar_click_modify
          no_focus
        }
      }
    processbar_h_thumb:滑块
    processbar_h_carrie:水平进度条背景
    processbar_h_process:水平进度条动态

    style_media.rc

    processbar_h_thumb.music_process
    {
    [ands]
            bg="./media/slide_block_d.png"
    }
    processbar_h_carrier.music_process
    {
       bg= "./media/music_process_bg.png"
       border=rgb(255,0,0), border_blank, 0
    }
    processbar_h_process.music_process
    {
        bg= "./media/music_process.png"
    }

     mediaview.cpp 设置进度条的范围,设置进度条当前值,获取当前控件的值

    TwProcessbarSetRange((TWidget *)TObjectGetFromName("video_process_bar"), 0, m_totalTime);
    TwSetValue((TWidget *)TObjectGetFromName("video_process_bar"), m_curTime);
    int value = TwGetValue((TWidget *)TObjectGetFromName("video_process_bar"));

    五)List(滚动条)

    hide_scrollbar 隐藏左右滚动条

    1)在layout_audio.ini中添加list

      list_music_view={
        type="listview"
        x=25
        y=87
        w=602
        h=393
        style="player_list_transparent"
        flags={
          hide_h_scrollbar
          no_h_scroll
          scroll_grab_mouse
          no_focus
          hide
        }
      }

    2)添加资源文件

      scrollbar_h_left  //水平滚动条的最左端端风格

      scrollbar_h_right  //水平滚动条的最右端端风格

      scrollbar_h_thumb   //水平滚动条的滑块风格

      scrollbar_h_background  //水平滚动条的背景风格

      scrollbar_v_top   //垂直滚动条的顶端风格

      scrollbar_v_bottom  //垂直滚动条的底端风格

      scrollbar_v_thumb  //垂直滚动条的滑块风格

      scrollbar_v_background  //垂直滚动条的背景风格

    style_media.rc

    listview.player_list_transparent {
            bg="ParentRelative"
    }
    scrollbar_v_thumb.player_list_transparent {
    [nad]
        bg="./media/list/list_bar_n.png",stretch_hv2
        image_aline=image_right
    }
    scrollbar_v_top.player_list_transparent {
        bg="None"
    }
    scrollbar_v_bottom.player_list_transparent {
        bg="None"
    }
    scrollbar_v_background.player_list_transparent {
            bg="ParentRelative"
    }

    3)添加list mode样式,

        列表水平显示:layout=right_autowrap_down

     列表垂直显示:layout=wrap_down

    listlayout_mediaitem.ini

    file_list_root={
    
            audio_list_mode={
                    style="player_list_node"
                    w=590; h=54
                    layout=wrap_down;
                    audio={
                            value_key="mediaAudio"
                            x=20; y=10; w=40; h=35
                            style="player_list_item_audio"
                    }

                    {
                            value_key="fileName";
                            x=70; y=12; w=520; h=29
                            style="player_list_item_file"
                    }

                    {
                            value_key="dirPath";
                            style="none"
                    }
            }
    }

     4)config.ini中添加listlayout_mediaitem.ini文件

    [list_layout]
    "./bt/btlist_layout.ini"
    "./homeview/home_usblist_layout.ini"
    "./setup/list_layout_setup.ini"
    "./media/listlayout_mediaitem.ini"
    "./common/list_layout_select.ini"
    "./common/list_layout_device.ini"
    "./auxinview/list_layout_auxin.ini"
    "./radioview/radiolist_layout.ini"

     5)在代码中向mode添加数据

            if (audioListCount < (int)list->audioList.size())
            {
                for (auto it = list->audioList.begin(); it != list->audioList.end(); it++)
                {
                    ItemInfo item = *it;
                    if (item.index < audioListCount)
                        continue;
                    TwDMLock(m_dm);
                    TwDataNode *new_node;
                    TTable *value;
                    new_node = TwDMAddNode(m_proot, TStringID("audio_list_mode"));
                    char number[32] = {};
                    sprintf(number, "%d", item.index);
                    TwDMSetNodeName(new_node, number);
                    value = TwDMGetNodeValue(new_node, TRUE);
                    TTableAddInt(value, TStringID("number"), item.index);
                    TTableAddString(value, TStringID("fileName"), item.fileName.c_str(), -1);
                    TTableAddString(value, TStringID("dirPath"), item.dir.c_str(), -1);
    
                    TwDMUnlock(m_dm);
                }
            }

    六)TD信号与槽

    信号和槽的类都要继承 BaseObject

      signal0代表0个参数,signal1代表1个参数,signal2代表两个参数,signal3代表三个参数

    public:
    ...
    //slot
        void devicePlugIn(MediaType type,const string &name);
        void devicePlugOut(MediaType type,const string &name);
    //signals:
        signal1<const string&> deviceChanged;
        signal2<MediaType,const string> parserDeviceUnmounted;
        signal2<MediaType,const string> deviceMounted;
        signal2<MediaType,const string&> deviceUnMounted;
        signal1<const string> parseFinished;
        signal3<int,const string,const string> firstMediaFound;
        signal0<> startParserDevice;
        signal0<> deviceParserStopped;

    槽函数定义为public的普通函数就可以

    public:
        void onFirstMediaFound(int type,string dir,const string name);
        void onDeviceUnmount(MediaType type,const string& dev);

    关联信号与槽

        devParser = FileDeviceParser::getInstance(queue);
        connectex(devParser.get(),devParser->firstMediaFound,this,&MediaView::onFirstMediaFound);
        connectex(devParser.get(),devParser->deviceUnMounted,this,&MediaView::onDeviceUnmount);

    发送信号

    firstMediaFound.emit(FT_Photo, getFileList()->picList[0].dir, getFileList()->picList[0].fileName);

    七)翻译

        在要翻译的文字前面加上tr_,然后加上TwTrans

    string(TwTrans("tr_General"));
  • 相关阅读:
    Objective-C 复合
    useContext的使用
    context的使用
    redux使用(二)
    redux使用(一)
    React class & function component 的区别
    combineReducers使用
    gnvm使用(未使用成功)
    React相关知识点
    eslint简单使用&&eslint与webpack结合使用
  • 原文地址:https://www.cnblogs.com/senior-engineer/p/13856088.html
Copyright © 2020-2023  润新知