代码之家  ›  专栏  ›  技术社区  ›  phatmanace

有(n)个诅咒的树库/小部件吗

  •  7
  • phatmanace  · 技术社区  · 16 年前

    我想知道是否有任何树库可用于(n)诅咒。

    我正在尝试编写一个显示文件夹树的组件&我很好奇是否有一个预构建的curses组件可以做到这一点。

    我已经检查了“核心”诅咒以及像CDK这样的库,但我似乎什么也找不到。

    谢谢,艾斯

    4 回复  |  直到 16 年前
        1
  •  2
  •   mrflash818    9 年前

    “我正在尝试编写一个显示文件夹树的组件”

    CDK拥有 CDKFSELECT 小装置。

    它显示可能适合您的目录和文件列表,或 CDKFSELECT的源代码可以用于您自己的自定义编写 解决方案

    CDKFSELECT *fSelect = 0;
    
    /*
    Height of zero means to extent of xterm
    Width of zero means to extent of xterm
    */
    int HEIGHT = 0;
    int WIDTH = 0;
    
    char *title = new char[strlen("Pick a file to open") + 1];
    strcpy(title, "Pick a file to open");
    
    char *prompt = new char[strlen("==> ") + 1];
    strcpy(prompt, "==> ");
    
    char *directoryAttribute = new char[strlen("</B>") + 1]; /* bold */
    strcpy(directoryAttribute, "</B>");
    
    char *fileAttribute = new char[strlen("</N>") + 1]; /* normal */
    strcpy(fileAttribute, "</N>");
    
    char *linkAttribute = new char[strlen("</D>") + 1]; /* dim */
    strcpy(linkAttribute, "</D>");
    
    char *sockAttribute = new char[strlen("</D>") + 1]; /* dim */
    strcpy(sockAttribute, "</D>");
    
    boolean displayBox = TRUE;
    boolean displayShadow = FALSE;
    
    fSelect = newCDKFselect(pCdkScreen,
              TOP, LEFT, HEIGHT, WIDTH,
              title, prompt,
              A_NORMAL, '_', A_REVERSE,
              directoryAttribute, fileAttribute, linkAttribute, sockAttribute,
              displayBox, displayShadow);
    
    char *filename = activateCDKFselect(fSelect, 0);
    /*
    2014-06-13, using DDD, filename being correctly populated
    by CDK
    */
    
    /* do other stuff... */
    
    /*
     free the memory of any dynamically created objects
     that were created with new or malloc, or such
    */
    destroyCDKFselect(fSelect);
    
    delete [] title;
    delete [] prompt;
    delete [] directoryAttribute;
    delete [] fileAttribute;
    delete [] linkAttribute;
    delete [] sockAttribute;
    
        2
  •  2
  •   Thomas Dickey    9 年前

    这个 dialog 程序(具有文档化的库接口)具有 "tree" 小装置。该程序使用(n)个诅咒,与 CDK

    dialog - tree view

    它也有一个 file(/directory) 选择小部件。

    dialog - file-selection

    还有 wcd mc 的可重用性 图书馆

    screenshot converted from wcd page

    关于 urwid 这是有争议的。在引擎盖下,你可能实际上没有诅咒。值得一提的是,一个 控件 脚本:

    urwid treeview

    在我的Debian/测试系统上,脚本不使用ncurses。它是硬编码的(即使用 raw_display

        3
  •  2
  •   robla Gilles Quénot    6 年前

    Urwid 有一个树控件,FWIW。

    乌尔维德 仍然有树小部件,但这些天,我会看看 Python's prompt-toolkit one of the alternatives .

        4
  •  1
  •   kalyan    16 年前

    http://www.midnight-commander.org/ )它有一个树存储小部件。