1 #ifndef INTERFACE_ELEMENTS_H 2 #define INTERFACE_ELEMENTS_H 3 4 #ifdef HAVE_NCURSESW_H 5 # include <ncursesw/curses.h> 6 #elif HAVE_NCURSES_H 7 # include <ncurses.h> 8 #elif HAVE_CURSES_H 9 # include <curses.h> 10 #endif 11 12 #include <wctype.h> 13 #include <wchar.h> 14 15 #include "lists.h" 16 #include "files.h" 17 #include "keys.h" 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 /* Interface's menus */ 24 enum iface_menu 25 { 26 IFACE_MENU_PLIST, 27 IFACE_MENU_DIR 28 }; 29 30 typedef void t_user_reply_callback (const char *reply, void *data); 31 32 enum entry_type 33 { 34 ENTRY_SEARCH, 35 ENTRY_PLIST_SAVE, 36 ENTRY_GO_DIR, 37 ENTRY_GO_URL, 38 ENTRY_ADD_URL, 39 ENTRY_PLIST_OVERWRITE, 40 ENTRY_USER_QUERY 41 }; 42 43 struct iface_key 44 { 45 /* Type of the key */ 46 enum 47 { 48 IFACE_KEY_CHAR, /* Regular char */ 49 IFACE_KEY_FUNCTION /* Function key (arrow, F12, etc. */ 50 } type; 51 52 union { 53 wchar_t ucs; /* IFACE_KEY_CHAR */ 54 int func; /* IFACE_KEY_FUNCTION */ 55 } key; 56 }; 57 58 void windows_init (); 59 void windows_reset (); 60 void windows_end (); 61 void iface_set_option_state (const char *name, const int value); 62 void iface_set_mixer_name (const char *name); 63 void iface_set_status (const char *msg); 64 void iface_set_dir_content (const enum iface_menu iface_menu, 65 const struct plist *files, 66 const lists_t_strs *dirs, 67 const lists_t_strs *playlists); 68 void iface_update_dir_content (const enum iface_menu iface_menu, 69 const struct plist *files, 70 const lists_t_strs *dirs, 71 const lists_t_strs *playlists); 72 void iface_set_curr_item_title (const char *title); 73 void iface_get_key (struct iface_key *k); 74 int iface_key_is_resize (const struct iface_key *k); 75 void iface_menu_key (const enum key_cmd cmd); 76 enum file_type iface_curritem_get_type (); 77 int iface_in_dir_menu (); 78 int iface_in_plist_menu (); 79 int iface_in_theme_menu (); 80 char *iface_get_curr_file (); 81 void iface_update_item (const enum iface_menu menu, const struct plist *plist, 82 const int n); 83 void iface_set_curr_time (const int time); 84 void iface_set_total_time (const int time); 85 void iface_set_block (const int start_time, const int end_time); 86 void iface_set_state (const int state); 87 void iface_set_bitrate (const int bitrate); 88 void iface_set_rate (const int rate); 89 void iface_set_channels (const int channels); 90 void iface_set_played_file (const char *file); 91 void iface_set_played_file_title (const char *title); 92 void iface_set_mixer_value (const int value); 93 void iface_set_files_in_queue (const int num); 94 void iface_tick (); 95 void iface_switch_to_plist (); 96 void iface_switch_to_dir (); 97 void iface_add_to_plist (const struct plist *plist, const int num); 98 void iface_error (const char *msg); 99 void iface_resize (); 100 void iface_refresh (); 101 void iface_update_show_time (); 102 void iface_update_show_format (); 103 void iface_clear_plist (); 104 void iface_del_plist_item (const char *file); 105 enum entry_type iface_get_entry_type (); 106 int iface_in_entry (); 107 void iface_make_entry (const enum entry_type type); 108 void iface_entry_handle_key (const struct iface_key *k); 109 void iface_entry_set_text (const char *text); 110 char *iface_entry_get_text (); 111 void iface_entry_history_add (); 112 void iface_entry_disable (); 113 void iface_entry_set_file (const char *file); 114 char *iface_entry_get_file (); 115 void iface_message (const char *msg); 116 void iface_disable_message (); 117 void iface_user_query (const char *msg, const char *prompt, t_user_reply_callback *callback, void *data); 118 void iface_user_reply (const char *reply); 119 void iface_user_history_add (const char *text); 120 void iface_plist_set_total_time (const int time, const int for_all_files); 121 void iface_set_title (const enum iface_menu menu, const char *title); 122 void iface_select_file (const char *file); 123 int iface_in_help (); 124 void iface_switch_to_help (); 125 void iface_handle_help_key (const struct iface_key *k); 126 int iface_in_lyrics (); 127 void iface_switch_to_lyrics (); 128 void iface_handle_lyrics_key (const struct iface_key *k); 129 void iface_toggle_layout (); 130 void iface_toggle_percent (); 131 void iface_swap_plist_items (const char *file1, const char *file2); 132 void iface_make_visible (const enum iface_menu menu, const char *file); 133 void iface_switch_to_theme_menu (); 134 void iface_add_file (const char *file, const char *title, 135 const enum file_type type); 136 void iface_temporary_exit (); 137 void iface_restore (); 138 void iface_load_lyrics (const char *file); 139 void iface_update_queue_positions (const struct plist *queue, 140 struct plist *playlist, struct plist *dir_list, 141 const char *deleted_file); 142 void iface_clear_queue_positions (const struct plist *queue, 143 struct plist *playlist, struct plist *dir_list); 144 void iface_update_queue_position_last (const struct plist *queue, 145 struct plist *playlist, struct plist *dir_list); 146 void iface_update_attrs (); 147 void iface_update_theme_selection (const char *file); 148 149 #ifdef __cplusplus 150 } 151 #endif 152 153 #endif 154