extern MenuItem* create_menuitem(char* contents);
extern Menu* create_menu(char* menu_name, MenuItem** item_list);
+extern WINDOW* get_menu_win(Menu* menu);
extern int set_menu_win(Menu* menu, WINDOW* win);
+extern WINDOW* get_menu_subwin(Menu* menu);
extern MenuItem* get_menu_item(Menu* menu, int index);
extern int set_menu_focus(Menu* menu, bool focus);
extern int get_selected_item(Menu* menu);
return new_menu;
}
+WINDOW*
+get_menu_win(Menu* menu)
+{
+ return menu->menu_win;
+}
+
int
set_menu_win(Menu* menu, WINDOW* win)
{
return 0;
}
+WINDOW*
+get_menu_subwin(Menu* menu)
+{
+ return menu->sub_win;
+}
+
MenuItem*
get_menu_item(Menu* menu, int index)
{
int
swap_item(Menu* menu, int src_index, int dest_index)
{
- MenuItem* temp;
-
- temp = menu->menu_items[dest_index];
- menu->menu_items[dest_index] = menu->menu_items[src_index];
- menu->menu_items[src_index] = temp;
+ ar_swap_item(menu->menu_items, src_index, dest_index);
return 0;
}
#include "headers/utils.h"
#include "config.h"
+// this is temp
+#define MENU_WIDTH 40
+
typedef struct BoardMenu {
Menu** menu_list;
int menu_count;
MenuItem** todolist_to_menuitem(TodoItem** item_list, int list_length);
Menu** make_menus(Board* board, int todolist_length);
+int swap_menu(BoardMenu* boardmenu, int src_index, int dest_index);
int
main(int argc, char** argv)
break;
case BINDING_INSERT_BELOW:
menu_driver(active_menu, MENU_INSERT_BELOW);
+ break;
+ /* case BINDING_MOVE_MENU_LEFT: */
+ /* if (boardmenu->selected-1 < 0) break; */
+
+ /* swap_menu(boardmenu, boardmenu->selected, boardmenu->selected-1); */
+ /* boardmenu->selected -= 1; */
+ /* set_selected_menu(boardmenu, boardmenu->selected); */
+
+/* break; */
+/* case BINDING_MOVE_MENU_RIGHT: */
+/* if (boardmenu->selected >= boardmenu->menu_count-1) break; */
+/* swap_menu(boardmenu, boardmenu->selected, boardmenu->selected+1); */
+ /* boardmenu->selected += 1; */
+ /* set_selected_menu(boardmenu, boardmenu->selected); */
+
break;
case BINDING_EDIT_ITEM:
menu_driver(active_menu, MENU_EDIT);
Menu**
make_menus(Board* board, int todolist_length)
{
- // this is temp
- #define MENU_WIDTH 40
Menu** menu_list;
return menu_list;
}
+
+int
+swap_menu(BoardMenu* boardmenu, int src_index, int dest_index)
+{
+ /* reposition menus */
+ mvwin(get_menu_win(boardmenu->menu_list[src_index]),
+ 1, 1+MENU_WIDTH*dest_index
+ );
+ mvwin(get_menu_win(boardmenu->menu_list[dest_index]),
+ 1, 1+MENU_WIDTH*src_index
+ );
+ wrefresh(get_menu_win(boardmenu->menu_list[src_index]));
+ wrefresh(get_menu_win(boardmenu->menu_list[dest_index]));
+ /* wclear(get_menu_win(boardmenu->menu_list[src_index])); */
+ /* wclear(get_menu_win(boardmenu->menu_list[dest_index])); */
+ /* touchwin(get_menu_win(boardmenu->menu_list[src_index])); */
+ /* touchwin(get_menu_win(boardmenu->menu_list[dest_index])); */
+ clear();
+
+ /* swap in array */
+ ar_swap_item(boardmenu->menu_list, src_index, dest_index);
+
+ return 0;
+}
+