2010-11-12 11:03:57 +03:00
|
|
|
|
2012-08-31 18:05:29 +04:00
|
|
|
/** \file lib/widget/history.h
|
2010-11-12 11:03:57 +03:00
|
|
|
* \brief Header: save, load and show history
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MC__WIDGET_HISTORY_H
|
|
|
|
#define MC__WIDGET_HISTORY_H
|
|
|
|
|
2016-03-03 22:51:40 +03:00
|
|
|
#include "lib/mcconfig.h" /* mc_config_t */
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
|
|
|
|
2019-07-27 11:44:00 +03:00
|
|
|
/* forward declarations */
|
|
|
|
struct history_descriptor_t;
|
|
|
|
struct WLEntry;
|
|
|
|
struct WListbox;
|
|
|
|
|
|
|
|
typedef void (*history_create_item_func) (struct history_descriptor_t * hd, void *data);
|
|
|
|
typedef void *(*history_release_item_func) (struct history_descriptor_t * hd, struct WLEntry * le);
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
2019-07-27 11:44:00 +03:00
|
|
|
typedef struct history_descriptor_t
|
|
|
|
{
|
|
|
|
GList *list; /**< list with history items */
|
|
|
|
int y; /**< y-coordinate to place history window */
|
|
|
|
int x; /**< x-coordinate to place history window */
|
|
|
|
int current; /**< initially selected item in the history */
|
|
|
|
int action; /**< return action in the history */
|
|
|
|
char *text; /**< return text of selected item */
|
|
|
|
|
|
|
|
size_t max_width; /**< maximum width of sring in history */
|
|
|
|
struct WListbox *listbox; /**< listbox widget to draw history */
|
|
|
|
|
|
|
|
history_create_item_func create; /**< function to create item of @list */
|
|
|
|
history_release_item_func release; /**< function to release item of @list */
|
|
|
|
GDestroyNotify free; /**< function to destroy element of @list */
|
|
|
|
} history_descriptor_t;
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
2011-04-29 13:05:59 +04:00
|
|
|
extern int num_history_items_recorded;
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
2011-05-03 17:24:56 +04:00
|
|
|
/* read history to the mc_config, but don't save config to file */
|
2010-11-12 11:03:57 +03:00
|
|
|
GList *history_get (const char *input_name);
|
2015-10-25 07:40:34 +03:00
|
|
|
/* load history from the mc_config */
|
2016-03-03 22:51:40 +03:00
|
|
|
GList *history_load (mc_config_t * cfg, const char *name);
|
2011-04-29 13:05:59 +04:00
|
|
|
/* save history to the mc_config, but don't save config to file */
|
2016-03-03 22:51:40 +03:00
|
|
|
void history_save (mc_config_t * cfg, const char *name, GList * h);
|
2019-07-27 11:44:00 +03:00
|
|
|
|
|
|
|
void history_descriptor_init (history_descriptor_t * hd, int y, int x, GList * history,
|
|
|
|
int current);
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
/* for repositioning of history dialog we should pass widget to this
|
|
|
|
* function, as position of history dialog depends on widget's position */
|
2019-07-27 11:44:00 +03:00
|
|
|
void history_show (history_descriptor_t * hd);
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/*** inline functions ****************************************************************************/
|
|
|
|
|
|
|
|
#endif /* MC__WIDGET_HISTORY_H */
|