Beispiel #1
0
void mostrar_scroll(CDKSCREEN *cdkScreen)
{
    char *lista[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
//    char** items[2];
 //   items[0]="asdf";
  //  items[1]="edfsdaf";
    char *titulo="dios";
    char salir;
    int elegido;
/*
  	CDKSCREEN *	 cdkscreen ,
		int		 xpos ,
		int		 ypos ,
		int		 spos ,
		int		 height ,
		int		 width ,
		char *		 title ,
		char **		 itemList ,
		int		 items ,
		boolean		 numbers ,
		chtype		 highlight ,
		boolean		 Box ,
		boolean		 shadow );
*/
    CDKSCROLL *menucito;
do
    {
    menucito=newCDKScroll(cdkScreen,
                        CENTER,
                         CENTER,
                        RIGHT,
                        10,
                        15,
                        titulo,
                        lista,
                        7,
                        FALSE,
                        A_REVERSE,
                        TRUE,
                        FALSE);
    elegido=activateCDKScroll(menucito,0);
 // destroyCDKScroll (menucito);





    popupLabel(cdkScreen,&lista[elegido],1);

  //  hacer(elegido);
   // break;


} while((salir=(getch())!='q'));
     destroyCDKScroll (menucito);
 //    mostrar_info(cdkScreen);
   // hacer(elegido);
     endCDK();
}
Beispiel #2
0
static int
show_section (CmdConfig *cmd_config, CameraWidget *section)
{
	CameraWidget *child, *parent;
	CameraWidgetType type;
	CDKSCROLL *scroll = NULL;
	const char *label;
	char *items[100];
	int count, x, selection;
	char title[1024];
	int show_parent = 0, show_child = 0;

	/* Create the scroll list */
	gp_widget_get_type (section, &type);
	gp_widget_get_label (section, &label);
	snprintf (title, sizeof (title), "<C></5>%s", label);
	if (type == GP_WIDGET_WINDOW)
		items[0] = copyChar (_("Exit"));
	else
		items[0] = copyChar (_("Back"));
	count = gp_widget_count_children (section);
	for (x = 0; x < count; x++) {
		gp_widget_get_child (section, x, &child);
		gp_widget_get_label (child, &label);
		items[x + 1] = copyChar ((char *) label);
	}
	count++;
	scroll = newCDKScroll (cmd_config->screen, CENTER, CENTER, RIGHT,
			       10, 50, title,
			       items, count, NUMBERS, A_REVERSE, TRUE, FALSE);
	if (!scroll)
		return (GP_ERROR);

	selection = activateCDKScroll (scroll, 0);
	if (scroll->exitType == vNORMAL) {
		if (selection)
			show_child = selection;
		else if (type != GP_WIDGET_WINDOW)
			show_parent = 1;
	}

	/* Clean up */
	destroyCDKScroll (scroll);

	if (show_parent) {
		gp_widget_get_parent (section, &parent);
		show_widget (cmd_config, parent);
	} else if (show_child) {
		gp_widget_get_child (section, show_child - 1, &child);
		show_widget (cmd_config, child);
	}

	return (GP_OK);
}
Beispiel #3
0
Meta* BrowseCurses::browse(clc::List* meta)
{
    const unsigned int nItems = meta->size();
    char* items[nItems];

    for (unsigned int i = 0; i < nItems; ++i) {
        Meta* m = (Meta*)meta->get(i);
        items[i] = m->relPath.c_str();
    }

    CDKSCROLL* scroll = newCDKScroll(m_screen, LEFT, TOP, RIGHT, 0, 0, "Select a book...",
            items, nItems, 0, 0, 1, 1);
    int r = activateCDKScroll(scroll, NULL);
    destroyCDKScroll(scroll);
    if (r == -1) {
        return (Meta*)0;
    } else {
        return (Meta*)meta->get(r);
    }
}
Beispiel #4
0
int Simpletui::choice(string text, vector<string> choices)
{
	const char **choiceChars=new const char*[choices.size()];
	unsigned int width=0;
	for(size_t i=0;i<choices.size();i++)
	{
		choiceChars[i]=choices[i].c_str();
		if(choices[i].length()>width)
			width=choices[i].length();
	}
	SplitString sText(text);
	CDKSCROLL *scroll=newCDKScroll(reinterpret_cast<CDKSCREEN*>(cdk),CENTER,CENTER,RIGHT,choices.size()+sText.getLength()+2,width,const_cast<char*>(text.c_str()),const_cast<char**>(choiceChars),choices.size(),FALSE,A_STANDOUT,TRUE,FALSE);
	int result=activateCDKScroll(scroll,NULL);
	if(scroll->exitType!=vNORMAL)
	{
		destroyCDKScroll(scroll);
		throw STActionAborted();
	}
	destroyCDKScroll(scroll);
	delete[] choiceChars;	// deep-delete unnecessary, references will be destroyed when strings are
	return result;
}
Beispiel #5
0
void CDKScroll::activate (void)
{
    activateCDKScroll (scroll, 0);
}
Beispiel #6
0
int main(int argc, char *argv[]){
    /* Read config file */
    clit_config *config = malloc(sizeof(clit_config));
    parse_config(config);
    printf("key:%s,secret:%s\n",config->key,config->secret);
    /* If no user info exists, intialize oauth process */
    init_oauth(config->key,config->secret);

    create_filters();

    home = malloc(sizeof(statuses));
    home->count = 0;

    setlocale(LC_ALL,"");
    CDKSCREEN *cdkscreen = 0;
    CDKSCROLL *home_scroll = 0;
    WINDOW *cursesWin = 0;
    char *title = "<C><\5>Home";
    char **home_items = 0;
    int selection,count;

    char *tmpfile = get_home();
    count = load_timeline(tmpfile,home);
    printf("count:%d\n",count);
    home_items = malloc(count*sizeof(char *));

    CDK_PARAMS params;
    CDKparseParams (argc, argv, &params, "cs:t:" CDK_CLI_PARAMS);

    cursesWin = initscr();
    cdkscreen = initCDKScreen(cursesWin);
    initCDKColor();

    status *p = home->head;
    for(int i=0;i<count;++i){
        if(p){
            home_items[i] = p->text;
            p = p->next;
        }
        else break;
    }
//    count = CDKgetDirectoryContents (".", &home_items);

    home_scroll = newCDKScroll(cdkscreen,
                               CDKparamValue (&params, 'X', CENTER),
                               CDKparamValue (&params, 'Y', CENTER),
                               CDKparsePosition(CDKparamString2(&params, 's', "RIGHT")),
                               CDKparamValue (&params, 'H', 0),
                               CDKparamValue (&params, 'W', 0),
                               CDKparamString2(&params, 't', title),
                               CDKparamNumber(&params, 'c') ? 0 : home_items,
                               CDKparamNumber(&params, 'c') ? 0 : count,
                               TRUE,
                               A_REVERSE,
                               CDKparamValue (&params, 'N', TRUE),
                               CDKparamValue (&params, 'S', FALSE));
    if(home_scroll == 0){
        destroyCDKScreen(cdkscreen);
        endCDK();
        exit(EXIT_FAILURE);
    }
    if (CDKparamNumber(&params, 'c')){
        setCDKScrollItems (home_scroll, home_items, count, TRUE);
    }
    selection = activateCDKScroll (home_scroll, 0);

    char ch = '\0';
    while((ch = getch()) != 'q'){
        switch(ch){
            case 'n':
                break;
        }
    }

    //CDKfreeStrings (home_items);
    destroyCDKScroll(home_scroll);
    destroyCDKScreen(cdkscreen);
    endCDK();
    exit(EXIT_SUCCESS);
}
Beispiel #7
0
void menu_scroll(CDKSCREEN *cdkScreen)

{

/*    WINDOW *scrollwin;
    scrollwin=newwin(20,20,10,10);
    box(scrollwin,0,0);
    mvwaddstr(scrollwin,2,2,"dios");
    wrefresh
            (scrollwin);*/
   // refresh();
    char *opciones[]={"Proveedores","Tecnicos","Clientes","salir"};
    CDKSCROLL *scroll;
    int elegido;
    do{
        scroll=newCDKScroll (cdkScreen, 2, 2, RIGHT,10, 20,
				     "<C>Menu",
                                        opciones,
                                                4,
        				     TRUE,
                			     A_REVERSE,
                        		     TRUE,
                                	     FALSE
                            );
elegido=activateCDKScroll(scroll,0);
//refreshCDKScreen(cdkScreen);
//
//refresh();

switch(elegido)
{
        case 0:
            destroyCDKScroll(scroll);
            //unregisterCDKObject(vSCROLL,scroll);
           // refreshCDKScreen(cdkScreen);
            //getch();
              proveedores();
          //  registerCDKObject(cdkScreen,vSCROLL,scroll);
            //produccion();
            break;
        case 1:
            destroyCDKScroll(scroll);
            tecnicos();
            //administracion();
            break;
        case 2:
      //        mvwaddstr(cdkScreen->window,2,2,"dios");
    // wrefresh(cdkScreen->window);
    // getch();
          clientes();
          break;
        case 3:
        endCDK();

        exit(0);

}


}while(elegido!=3);
getch();
}