comparison libmenu/menu_cmdlist.c @ 18819:cd0491dc2afa

support for auto_close parameter in menu command list (geexbox patch)
author ben
date Sun, 25 Jun 2006 21:24:46 +0000
parents a2b064a48775
children ac69ba536915
comparison
equal deleted inserted replaced
18818:ab94d003023d 18819:cd0491dc2afa
33 char* right; 33 char* right;
34 }; 34 };
35 35
36 struct menu_priv_s { 36 struct menu_priv_s {
37 menu_list_priv_t p; 37 menu_list_priv_t p;
38 int auto_close;
38 }; 39 };
39 40
41 #define ST_OFF(m) M_ST_OFF(struct menu_priv_s, m)
42
40 static struct menu_priv_s cfg_dflt = { 43 static struct menu_priv_s cfg_dflt = {
41 MENU_LIST_PRIV_DFLT 44 MENU_LIST_PRIV_DFLT,
45 0,
42 }; 46 };
43 47
44 static m_option_t cfg_fields[] = { 48 static m_option_t cfg_fields[] = {
45 MENU_LIST_PRIV_FIELDS, 49 MENU_LIST_PRIV_FIELDS,
46 { "title",M_ST_OFF(struct menu_priv_s,p.title), CONF_TYPE_STRING, 0, 0, 0, NULL }, 50 { "title",M_ST_OFF(struct menu_priv_s,p.title), CONF_TYPE_STRING, 0, 0, 0, NULL },
51 { "auto-close", ST_OFF(auto_close), CONF_TYPE_FLAG, 0, 0, 1, NULL },
47 { NULL, NULL, NULL, 0,0,0,NULL } 52 { NULL, NULL, NULL, 0,0,0,NULL }
48 }; 53 };
49 54
50 #define mpriv (menu->priv) 55 #define mpriv (menu->priv)
51 56
59 } // fallback on ok if right is not defined 64 } // fallback on ok if right is not defined
60 case MENU_CMD_OK: { 65 case MENU_CMD_OK: {
61 if(mpriv->p.current->ok) { 66 if(mpriv->p.current->ok) {
62 mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->ok); 67 mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->ok);
63 if(c) 68 if(c)
69 {
70 if (mpriv->auto_close)
71 mp_input_queue_cmd (mp_input_parse_cmd ("menu hide"));
64 mp_input_queue_cmd(c); 72 mp_input_queue_cmd(c);
73 }
65 } 74 }
66 } break; 75 } break;
67 case MENU_CMD_LEFT: 76 case MENU_CMD_LEFT:
68 if(mpriv->p.current->left) { 77 if(mpriv->p.current->left) {
69 mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->left); 78 mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->left);