lcdexec: parameter support using widgets enabled (currently only marginally
documented in lcdexec.conf)
This commit is contained in:
+42
-42
@@ -8,13 +8,13 @@
|
||||
* COPYING file distributed with this package.
|
||||
*
|
||||
* Copyright (c) 2002, Joris Robijn
|
||||
* Copyright (c) 2006, Peter Marschall
|
||||
*
|
||||
* Copyright (c) 2006-7, Peter Marschall
|
||||
*/
|
||||
|
||||
#ifndef LCDEXEC_MENU_H
|
||||
#define LCDEXEC_MENU_H
|
||||
|
||||
/* boolean values */
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
#endif
|
||||
@@ -22,6 +22,7 @@
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
|
||||
/** Symbolic names for the types of a MenuEntry */
|
||||
typedef enum {
|
||||
MT_UNKNOWN = 0x00, /**< Unknown MenuEntry type. */
|
||||
@@ -29,7 +30,7 @@ typedef enum {
|
||||
MT_EXEC = 0x20, /**< MenuEntry representing an executable command. */
|
||||
MT_ARGUMENT = 0x40, /**< Mask denoting a parameter of any type */
|
||||
MT_AUTOMATIC = 0x80, /**< BitFlag denoting automatically generated entries */
|
||||
#if defined(LCDEXEC_PARAMS)
|
||||
|
||||
MT_ARG_SLIDER = 0x41, /**< MenuEntry representing a slider parameter. */
|
||||
MT_ARG_RING = 0x42, /**< MenuEntry representing a ring parameter. */
|
||||
MT_ARG_NUMERIC = 0x43, /**< MenuEntry representing a numeric input parameter. */
|
||||
@@ -37,60 +38,59 @@ typedef enum {
|
||||
MT_ARG_IP = 0x45, /**< MenuEntry representing a IP input parameter. */
|
||||
MT_ARG_CHECKBOX = 0x46, /**< MenuEntry representing a checkbox input parameter. */
|
||||
MT_ARG_ACTION = 0x47, /**< MenuEntry representing a checkbox input parameter. */
|
||||
#endif
|
||||
} MenuType;
|
||||
|
||||
|
||||
/** Data structure to hold a menu entry in \c lcdexec */
|
||||
typedef struct menu_entry {
|
||||
// Variables necessary for multiple/all types
|
||||
char *name; /**< Name of the menu entry (from section name). */
|
||||
char *displayname; /**< isible name of the entry. */
|
||||
char *displayname; /**< Visible name of the entry. */
|
||||
int id; /**< Internal ID of the entry. */
|
||||
MenuType type; /**< Type of the entry. */
|
||||
struct menu_entry *parent; /**< Parent menu entry */
|
||||
int numChildren; /**< # of child entries */
|
||||
struct menu_entry *parent; /**< Parent menu entry. */
|
||||
int numChildren; /**< # of child entries. */
|
||||
struct menu_entry *children; /**< Subordinate menu entries (for type \c MT_MENU & \c MT_EXEC). */
|
||||
struct menu_entry *next; /**< Next sibling menu entry (for type \c MT_MENU). */
|
||||
|
||||
// variables necessary for multiple types
|
||||
struct menu_entry *children; /**< Subordinate menu entries (for MenuType \c MT_MENU & \c MT_EXEC). */
|
||||
struct menu_entry *next; /**< Next sibling menu entry (for MenuType \c MT_MENU). */
|
||||
|
||||
union {
|
||||
struct { // elements necessary for type MT_EXEC
|
||||
char *command; /**< Command to execute (for MenuType \c exec). */
|
||||
int feedback; /**< Feedback option (for MenuType \c exec). */
|
||||
// Variables specific to one special type
|
||||
union data {
|
||||
struct exec{ // elements necessary for type MT_EXEC
|
||||
char *command; /**< Command to execute. */
|
||||
int feedback; /**< Feedback flag. */
|
||||
} exec;
|
||||
#if defined(LCDEXEC_PARAMS)
|
||||
struct { // elements necessary for type MT_ARG_SLIDER
|
||||
int value;
|
||||
int minval;
|
||||
int maxval;
|
||||
int stepsize;
|
||||
char *mintext;
|
||||
char *maxtext;
|
||||
struct slider { // elements necessary for type MT_ARG_SLIDER
|
||||
int value; /**< Numeric value of slider. */
|
||||
int minval; /**< Minimal allowed value. */
|
||||
int maxval; /**< Maximal allowed value. */
|
||||
int stepsize; /**< Increments/decrement for value. */
|
||||
char *mintext; /**< Label for the min. value. */
|
||||
char *maxtext; /**< Label for the max. value. */
|
||||
} slider;
|
||||
struct { // elements necessary for type MT_ARG_RING
|
||||
int value;
|
||||
char **strings;
|
||||
struct ring { // elements necessary for type MT_ARG_RING
|
||||
int value; /**< Index into list of alternatives. */
|
||||
char **strings; /**< List of alternatives. */
|
||||
} ring;
|
||||
struct { // elements necessary for type MT_ARG_NUMERIC
|
||||
int value;
|
||||
int minval;
|
||||
int maxval;
|
||||
struct numeric { // elements necessary for type MT_ARG_NUMERIC
|
||||
int value; /**< Numeric input value. */
|
||||
int minval; /**< Minimal allowed value. */
|
||||
int maxval; /**< Maximal allowed value. */
|
||||
} numeric;
|
||||
struct { // elements necessary for type MT_ARG_ALPHA
|
||||
char *value;
|
||||
int minlen;
|
||||
int maxlen;
|
||||
char *allowed_chars;
|
||||
struct alpha { // elements necessary for type MT_ARG_ALPHA
|
||||
char *value; /**< Text value. */
|
||||
int minlen; /**< Maximal allowed length. */
|
||||
int maxlen; /**< Minimal required length. */
|
||||
char *allowed; /**< Characters allowed in input. */
|
||||
} alpha;
|
||||
struct { // elements necessary for type MT_ARG_IP
|
||||
char *value;
|
||||
int v6;
|
||||
struct ip { // elements necessary for type MT_ARG_IP
|
||||
char *value; /**< IP address value. */
|
||||
int v6; /**< Flag: use IPv6 editing logic. */
|
||||
} ip;
|
||||
struct { // elements necessary for type MT_ARG_CHECKBOX
|
||||
int value;
|
||||
int allow_gray;
|
||||
struct checkbox { // elements necessary for type MT_ARG_CHECKBOX
|
||||
int value; /**< Checkbox value. */
|
||||
int allow_gray; /**< Flag for tristate chechboxes. */
|
||||
char *map[3]; /**< Replacement strings for each value. */
|
||||
} checkbox;
|
||||
#endif
|
||||
} data;
|
||||
} MenuEntry;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user