Path: blob/main/contrib/bsddialog/examples_library/radiolist.c
39476 views
/*-1* SPDX-License-Identifier: CC0-1.02*3* Written in 2021 by Alfonso Sabato Siciliano.4* To the extent possible under law, the author has dedicated all copyright5* and related and neighboring rights to this software to the public domain6* worldwide. This software is distributed without any warranty, see:7* <http://creativecommons.org/publicdomain/zero/1.0/>.8*/910#include <bsddialog.h>11#include <stdio.h>1213int main()14{15int i, output;16struct bsddialog_conf conf;17struct bsddialog_menuitem items[5] = {18{"I", true, 0, "Name 1", "Desc 1", "Bottom Desc 1"},19{"II", false, 0, "Name 2", "Desc 2", "Bottom Desc 2"},20{"III", true, 0, "Name 3", "Desc 3", "Bottom Desc 3"},21{"IV", false, 0, "Name 4", "Desc 4", "Bottom Desc 4"},22{"V", true, 0, "Name 5", "Desc 5", "Bottom Desc 5"}23};2425if (bsddialog_init() == BSDDIALOG_ERROR) {26printf("Error: %s\n", bsddialog_geterror());27return (1);28}29bsddialog_initconf(&conf);30conf.title = "radiolist";31output = bsddialog_radiolist(&conf, "Example", 15, 30, 5, 5, items,32NULL);33bsddialog_end();34if (output == BSDDIALOG_ERROR) {35printf("Error: %s\n", bsddialog_geterror());36return (1);37}3839printf("Radiolist:\n");40for (i = 0; i < 5; i++)41printf(" (%c) %s\n", items[i].on ? '*' : ' ', items[i].name);4243return (0);44}4546