about summary refs log tree commit diff stats
path: root/src/xmpp/form.h
Commit message (Expand)AuthorAgeFilesLines
* first step to remove libmesodeSteffen Jaeckel2021-10-271-6/+0
* Apply coding styleMichael Vetter2020-07-071-5/+5
* Revert "Apply coding style"Michael Vetter2020-07-071-5/+5
* Apply coding styleMichael Vetter2020-07-071-5/+5
* Add vim modelineMichael Vetter2019-11-131-0/+1
* Update copyright to include 2019Michael Vetter2019-01-221-1/+1
* Update copyrightJames Booth2018-01-211-1/+1
* Update CopyrightJames Booth2017-01-281-1/+1
* Tidy headersJames Booth2016-07-241-2/+3
* Make header defines consistentJames Booth2016-07-241-2/+2
* Update GPL link in headersJames Booth2016-07-241-1/+1
* Tidy xmpp headersJames Booth2016-05-041-0/+3
* Removed #AX_PREFIX_CONFIG_HJames Booth2016-03-311-0/+7
* Updated copyrightJames Booth2016-02-141-1/+1
* Applied coding style to src/xmpp/James Booth2015-10-261-1/+1
* Updated copyrightJames Booth2015-02-101-1/+1
* Fixed spelling mistake in form.hJames Booth2014-09-251-1/+1
* Added form testsJames Booth2014-09-141-0/+2
* Implemented /room config submit for saving room configurationJames Booth2014-09-101-0/+1
* Created form moduleJames Booth2014-09-051-0/+40
ik/teliva/commit/src/lcurseslib.c?id=cab996b1941014b78bdfafb1e6d20e159e035f53'>cab996b ^
2964a5e ^


ee85ad3 ^



40fdaf2 ^


ee85ad3 ^
40fdaf2 ^
ef9c420 ^
cab996b ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
                    
                   

                
 
 
                    
                                          






                                      
                                                         
                     

                           
                            

 
                               
                           

                                


                               



                                     


                                                                
 
                
                            
 
#include <ncurses.h>
#include <string.h>

#include "lua.h"


int menu_column = 0;
void draw_string_on_menu (const char* s) {
  mvaddstr(LINES-1, menu_column, " ");
  ++menu_column;
  mvaddstr(LINES-1, menu_column, s);
  menu_column += strlen(s);
  mvaddstr(LINES-1, menu_column, " ");
  ++menu_column;
}
void draw_menu_item (const char* key, const char* name) {
  attroff(A_REVERSE);
  draw_string_on_menu(key);
  attron(A_REVERSE);
  draw_string_on_menu(name);
}

void draw_menu (lua_State *L) {
  attron(A_BOLD|A_REVERSE);
  for (int x = 0; x < COLS; ++x)
    mvaddch(LINES-1, x, ' ');
  menu_column = 2;
  draw_menu_item("^x", "exit");
  draw_menu_item("^e", "edit");

  /* render any app-specific items */
  lua_getglobal(L, "menu");
  int table = lua_gettop(L);
  if (lua_istable(L, -1))
    for (lua_pushnil(L); lua_next(L, table) != 0; lua_pop(L, 1))
      draw_menu_item(lua_tostring(L, -2), lua_tostring(L, -1));

  lua_pop(L, 1);
  attroff(A_BOLD|A_REVERSE);
}