ncurses - 是否有 (n) 诅咒的任何树库/小部件

标签 ncurses curses

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












想改进这个问题?将问题更新为 on-topic对于堆栈溢出。

1年前关闭。




Improve this question




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

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

我检查了“核心”诅咒以及 CDK 之类的库 - 我似乎找不到任何东西。

如果不存在,我不反对建立自己的 - 但我似乎找不到任何体面的教程来做这件事,所以在这方面的任何帮助也将不胜感激。

谢谢,艾斯

最佳答案

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

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;

关于ncurses - 是否有 (n) 诅咒的任何树库/小部件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2374614/

相关文章:

c - ncurses 中建议的工作流程

c++ - 诅咒填充 block

c++ - Memset 似乎卡住了我的程序 C++ 和其他我没有看到的问题

c - 在 Mac OS X 上编译 ncurses 应用程序时出错

terminal - 从终端读取屏幕字符

Python 诅咒 : Make enter key terminate Textbox?

rust - 如何使用 ncurses crate 显示方框图字符?

python - 当 bkgd 字符为curses.ACS_CKBOARD 时,文本显示损坏

python - 如何防止curses应用程序出现故障?