2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/** \file widget-common.h
|
|
|
|
* \brief Header: shared stuff of widgets
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MC__WIDGET_INTERNAL_H
|
|
|
|
#define MC__WIDGET_INTERNAL_H
|
|
|
|
|
2017-03-08 14:41:35 +03:00
|
|
|
#include "lib/keybind.h" /* global_keymap_t */
|
2011-03-21 16:43:56 +03:00
|
|
|
#include "lib/tty/mouse.h"
|
2016-03-06 09:44:16 +03:00
|
|
|
#include "lib/widget/mouse.h" /* mouse_msg_t, mouse_event_t */
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
|
|
|
|
2012-06-20 12:05:13 +04:00
|
|
|
#define WIDGET(x) ((Widget *)(x))
|
2016-02-20 17:29:21 +03:00
|
|
|
#define CONST_WIDGET(x) ((const Widget *)(x))
|
2012-06-20 12:05:13 +04:00
|
|
|
|
2019-10-16 13:07:24 +03:00
|
|
|
#define widget_gotoyx(w, _y, _x) tty_gotoyx (CONST_WIDGET(w)->y + (_y), CONST_WIDGET(w)->x + (_x))
|
2010-11-12 11:03:57 +03:00
|
|
|
/* Sets/clear the specified flag in the options field */
|
2016-04-10 10:31:42 +03:00
|
|
|
#define widget_want_cursor(w,i) widget_set_options(w, WOP_WANT_CURSOR, i)
|
|
|
|
#define widget_want_hotkey(w,i) widget_set_options(w, WOP_WANT_HOTKEY, i)
|
2016-05-08 20:25:29 +03:00
|
|
|
#define widget_want_tab(w,i) widget_set_options(w, WOP_WANT_TAB, i)
|
2016-04-10 12:35:43 +03:00
|
|
|
#define widget_idle(w,i) widget_set_state(w, WST_IDLE, i)
|
2016-04-10 12:26:48 +03:00
|
|
|
#define widget_disable(w,i) widget_set_state(w, WST_DISABLED, i)
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
|
|
|
/* Widget messages */
|
|
|
|
typedef enum
|
|
|
|
{
|
2012-09-28 15:05:43 +04:00
|
|
|
MSG_INIT = 0, /* Initialize widget */
|
|
|
|
MSG_FOCUS, /* Draw widget in focused state or widget has got focus */
|
|
|
|
MSG_UNFOCUS, /* Draw widget in unfocused state or widget has been unfocused */
|
2016-11-24 11:05:26 +03:00
|
|
|
MSG_CHANGED_FOCUS, /* Notification to owner about focus state change */
|
2016-04-10 12:26:48 +03:00
|
|
|
MSG_ENABLE, /* Change state to enabled */
|
|
|
|
MSG_DISABLE, /* Change state to disabled */
|
2012-09-28 15:05:43 +04:00
|
|
|
MSG_DRAW, /* Draw widget on screen */
|
|
|
|
MSG_KEY, /* Sent to widgets on key press */
|
|
|
|
MSG_HOTKEY, /* Sent to widget to catch preprocess key */
|
|
|
|
MSG_HOTKEY_HANDLED, /* A widget has got the hotkey */
|
|
|
|
MSG_UNHANDLED_KEY, /* Key that no widget handled */
|
|
|
|
MSG_POST_KEY, /* The key has been handled */
|
2016-01-21 11:04:46 +03:00
|
|
|
MSG_ACTION, /* Send to widget to handle command */
|
|
|
|
MSG_NOTIFY, /* Typically sent to dialog to inform it of state-change
|
|
|
|
* of listboxes, check- and radiobuttons. */
|
2012-09-28 15:05:43 +04:00
|
|
|
MSG_CURSOR, /* Sent to widget to position the cursor */
|
|
|
|
MSG_IDLE, /* The idle state is active */
|
|
|
|
MSG_RESIZE, /* Screen size has changed */
|
|
|
|
MSG_VALIDATE, /* Dialog is to be closed */
|
|
|
|
MSG_END, /* Shut down dialog */
|
|
|
|
MSG_DESTROY /* Sent to widget at destruction time */
|
2010-11-12 11:03:57 +03:00
|
|
|
} widget_msg_t;
|
|
|
|
|
|
|
|
/* Widgets are expected to answer to the following messages:
|
2012-09-28 15:05:43 +04:00
|
|
|
MSG_FOCUS: MSG_HANDLED if the accept the focus, MSG_NOT_HANDLED if they do not.
|
|
|
|
MSG_UNFOCUS: MSG_HANDLED if they accept to release the focus, MSG_NOT_HANDLED if they don't.
|
|
|
|
MSG_KEY: MSG_HANDLED if they actually used the key, MSG_NOT_HANDLED if not.
|
|
|
|
MSG_HOTKEY: MSG_HANDLED if they actually used the key, MSG_NOT_HANDLED if not.
|
2010-11-12 11:03:57 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
MSG_NOT_HANDLED = 0,
|
|
|
|
MSG_HANDLED = 1
|
|
|
|
} cb_ret_t;
|
|
|
|
|
|
|
|
/* Widget options */
|
|
|
|
typedef enum
|
|
|
|
{
|
2016-04-10 10:31:42 +03:00
|
|
|
WOP_DEFAULT = (0 << 0),
|
2016-06-07 15:03:20 +03:00
|
|
|
WOP_WANT_HOTKEY = (1 << 0),
|
|
|
|
WOP_WANT_CURSOR = (1 << 1),
|
|
|
|
WOP_WANT_TAB = (1 << 2), /* Should the tab key be sent to the dialog? */
|
|
|
|
WOP_IS_INPUT = (1 << 3),
|
|
|
|
WOP_SELECTABLE = (1 << 4),
|
2016-05-08 20:25:29 +03:00
|
|
|
WOP_TOP_SELECT = (1 << 5)
|
2010-11-12 11:03:57 +03:00
|
|
|
} widget_options_t;
|
|
|
|
|
2016-04-10 11:01:48 +03:00
|
|
|
/* Widget state */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
WST_DEFAULT = (0 << 0),
|
2016-04-10 12:35:43 +03:00
|
|
|
WST_DISABLED = (1 << 0), /* Widget cannot be selected */
|
2016-04-16 11:12:49 +03:00
|
|
|
WST_IDLE = (1 << 1),
|
|
|
|
WST_MODAL = (1 << 2), /* Widget (dialog) is modal */
|
2016-06-12 18:15:02 +03:00
|
|
|
WST_FOCUSED = (1 << 3),
|
2016-04-10 20:02:59 +03:00
|
|
|
|
2019-12-19 16:47:05 +03:00
|
|
|
WST_CONSTRUCT = (1 << 15), /* Widget has been constructed but not run yet */
|
2016-04-10 20:02:59 +03:00
|
|
|
WST_ACTIVE = (1 << 16), /* Dialog is visible and active */
|
|
|
|
WST_SUSPENDED = (1 << 17), /* Dialog is suspended */
|
|
|
|
WST_CLOSED = (1 << 18) /* Dialog is closed */
|
2016-04-10 11:01:48 +03:00
|
|
|
} widget_state_t;
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
/* Flags for widget repositioning on dialog resize */
|
|
|
|
typedef enum
|
|
|
|
{
|
2016-05-08 21:10:05 +03:00
|
|
|
WPOS_FULLSCREEN = (1 << 0), /* widget occupies the whole screen */
|
|
|
|
WPOS_CENTER_HORZ = (1 << 1), /* center widget in horizontal */
|
|
|
|
WPOS_CENTER_VERT = (1 << 2), /* center widget in vertical */
|
|
|
|
WPOS_CENTER = WPOS_CENTER_HORZ | WPOS_CENTER_VERT, /* center widget */
|
|
|
|
WPOS_TRYUP = (1 << 3), /* try to move two lines up the widget */
|
|
|
|
WPOS_KEEP_LEFT = (1 << 4), /* keep widget distance to left border of dialog */
|
|
|
|
WPOS_KEEP_RIGHT = (1 << 5), /* keep widget distance to right border of dialog */
|
|
|
|
WPOS_KEEP_TOP = (1 << 6), /* keep widget distance to top border of dialog */
|
|
|
|
WPOS_KEEP_BOTTOM = (1 << 7), /* keep widget distance to bottom border of dialog */
|
2010-11-12 11:03:57 +03:00
|
|
|
WPOS_KEEP_HORZ = WPOS_KEEP_LEFT | WPOS_KEEP_RIGHT,
|
|
|
|
WPOS_KEEP_VERT = WPOS_KEEP_TOP | WPOS_KEEP_BOTTOM,
|
2012-09-26 15:16:24 +04:00
|
|
|
WPOS_KEEP_ALL = WPOS_KEEP_HORZ | WPOS_KEEP_VERT,
|
|
|
|
WPOS_KEEP_DEFAULT = WPOS_KEEP_LEFT | WPOS_KEEP_TOP
|
2010-11-12 11:03:57 +03:00
|
|
|
} widget_pos_flags_t;
|
2016-05-08 21:10:05 +03:00
|
|
|
/* NOTES:
|
|
|
|
* If WPOS_FULLSCREEN is set then all other position flags are ignored.
|
|
|
|
* If WPOS_CENTER_HORZ flag is used, other horizontal flags (WPOS_KEEP_LEFT, WPOS_KEEP_RIGHT,
|
|
|
|
* and WPOS_KEEP_HORZ) are ignored.
|
2012-09-26 15:16:24 +04:00
|
|
|
* If WPOS_CENTER_VERT flag is used, other horizontal flags (WPOS_KEEP_TOP, WPOS_KEEP_BOTTOM,
|
2016-05-08 21:10:05 +03:00
|
|
|
* and WPOS_KEEP_VERT) are ignored.
|
2012-09-26 15:16:24 +04:00
|
|
|
*/
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
|
|
|
/* Widget callback */
|
2012-09-28 15:05:43 +04:00
|
|
|
typedef cb_ret_t (*widget_cb_fn) (Widget * widget, Widget * sender, widget_msg_t msg, int parm,
|
|
|
|
void *data);
|
2016-03-06 09:44:16 +03:00
|
|
|
/* Widget mouse callback */
|
|
|
|
typedef void (*widget_mouse_cb_fn) (Widget * w, mouse_msg_t msg, mouse_event_t * event);
|
2016-11-15 09:33:34 +03:00
|
|
|
/* translate mouse event and process it */
|
|
|
|
typedef int (*widget_mouse_handle_fn) (Widget * w, Gpm_Event * event);
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/* Every Widget must have this as its first element */
|
|
|
|
struct Widget
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
int cols, lines;
|
|
|
|
widget_pos_flags_t pos_flags; /* repositioning flags */
|
2016-04-10 12:26:48 +03:00
|
|
|
widget_options_t options;
|
|
|
|
widget_state_t state;
|
2016-09-28 13:37:31 +03:00
|
|
|
unsigned long id; /* uniq widget ID */
|
2012-06-26 11:52:21 +04:00
|
|
|
widget_cb_fn callback;
|
2016-03-06 09:44:16 +03:00
|
|
|
widget_mouse_cb_fn mouse_callback;
|
2016-09-27 13:53:17 +03:00
|
|
|
WGroup *owner;
|
2016-11-15 09:33:34 +03:00
|
|
|
|
2017-03-08 14:41:35 +03:00
|
|
|
/* Key-related fields */
|
|
|
|
const global_keymap_t *keymap; /* main keymap */
|
|
|
|
const global_keymap_t *ext_keymap; /* extended keymap */
|
|
|
|
gboolean ext_mode; /* use keymap or ext_keymap */
|
|
|
|
|
2015-11-26 01:28:08 +03:00
|
|
|
/* Mouse-related fields. */
|
2016-11-15 09:33:34 +03:00
|
|
|
widget_mouse_handle_fn mouse_handler;
|
2015-11-26 01:28:08 +03:00
|
|
|
struct
|
|
|
|
{
|
2016-03-23 19:17:05 +03:00
|
|
|
/* Public members: */
|
|
|
|
gboolean forced_capture; /* Overrides the 'capture' member. Set explicitly by the programmer. */
|
|
|
|
|
|
|
|
/* Implementation details: */
|
2015-11-26 01:28:08 +03:00
|
|
|
gboolean capture; /* Whether the widget "owns" the mouse. */
|
2016-03-23 19:17:05 +03:00
|
|
|
mouse_msg_t last_msg; /* The previous event type processed. */
|
2016-03-06 09:44:16 +03:00
|
|
|
int last_buttons_down;
|
|
|
|
} mouse;
|
2016-09-29 11:16:17 +03:00
|
|
|
|
|
|
|
GList *(*find) (const Widget * w, const Widget * what);
|
|
|
|
Widget *(*find_by_type) (const Widget * w, widget_cb_fn cb);
|
|
|
|
Widget *(*find_by_id) (const Widget * w, unsigned long id);
|
2019-11-17 17:02:52 +03:00
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
cb_ret_t (*set_state) (Widget * w, widget_state_t state, gboolean enable);
|
|
|
|
/* *INDENT-ON* */
|
2019-11-17 17:58:52 +03:00
|
|
|
|
|
|
|
const int *(*get_colors) (const Widget * w);
|
2010-11-12 11:03:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* structure for label (caption) with hotkey, if original text does not contain
|
|
|
|
* hotkey, only start is valid and is equal to original text
|
|
|
|
* hotkey is defined as char*, but mc support only singlebyte hotkey
|
|
|
|
*/
|
|
|
|
typedef struct hotkey_t
|
|
|
|
{
|
2019-12-14 12:53:44 +03:00
|
|
|
char *start; /* never NULL */
|
|
|
|
char *hotkey; /* can be NULL */
|
|
|
|
char *end; /* can be NULL */
|
2010-11-12 11:03:57 +03:00
|
|
|
} hotkey_t;
|
|
|
|
|
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
|
|
|
/* create hotkey from text */
|
2019-12-14 11:50:04 +03:00
|
|
|
hotkey_t hotkey_new (const char *text);
|
2010-11-12 11:03:57 +03:00
|
|
|
/* release hotkey, free all mebers of hotkey_t */
|
2019-12-14 11:50:04 +03:00
|
|
|
void hotkey_free (const hotkey_t hotkey);
|
2010-11-12 11:03:57 +03:00
|
|
|
/* return width on terminal of hotkey */
|
|
|
|
int hotkey_width (const hotkey_t hotkey);
|
2019-12-14 12:53:44 +03:00
|
|
|
/* compare two hotkeys */
|
|
|
|
gboolean hotkey_equal (const hotkey_t hotkey1, const hotkey_t hotkey2);
|
2010-11-12 11:03:57 +03:00
|
|
|
/* draw hotkey of widget */
|
2012-11-20 13:27:10 +04:00
|
|
|
void hotkey_draw (Widget * w, const hotkey_t hotkey, gboolean focused);
|
2019-12-14 16:32:26 +03:00
|
|
|
/* get text of hotkey */
|
|
|
|
char *hotkey_get_text (const hotkey_t hotkey);
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/* widget initialization */
|
2013-06-24 11:40:53 +04:00
|
|
|
void widget_init (Widget * w, int y, int x, int lines, int cols,
|
2016-03-06 09:44:16 +03:00
|
|
|
widget_cb_fn callback, widget_mouse_cb_fn mouse_callback);
|
2019-10-16 10:33:00 +03:00
|
|
|
void widget_destroy (Widget * w);
|
2010-11-12 11:03:57 +03:00
|
|
|
/* Default callback for widgets */
|
2012-11-20 13:27:10 +04:00
|
|
|
cb_ret_t widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
|
|
|
void *data);
|
|
|
|
void widget_set_options (Widget * w, widget_options_t options, gboolean enable);
|
2016-10-10 10:20:27 +03:00
|
|
|
void widget_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols);
|
2016-10-13 10:15:03 +03:00
|
|
|
void widget_set_size (Widget * w, int y, int x, int lines, int cols);
|
2010-11-12 11:03:57 +03:00
|
|
|
/* select color for widget in dependance of state */
|
2012-11-20 13:27:10 +04:00
|
|
|
void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey);
|
2016-10-30 12:40:20 +03:00
|
|
|
cb_ret_t widget_draw (Widget * w);
|
2010-11-12 11:03:57 +03:00
|
|
|
void widget_erase (Widget * w);
|
2013-06-24 10:47:03 +04:00
|
|
|
gboolean widget_is_active (const void *w);
|
2013-06-24 11:08:10 +04:00
|
|
|
gboolean widget_overlapped (const Widget * a, const Widget * b);
|
2013-06-24 10:57:01 +04:00
|
|
|
void widget_replace (Widget * old, Widget * new);
|
2016-07-16 21:00:28 +03:00
|
|
|
void widget_select (Widget * w);
|
|
|
|
void widget_set_bottom (Widget * w);
|
2013-06-24 10:57:01 +04:00
|
|
|
|
2017-03-08 14:41:35 +03:00
|
|
|
long widget_lookup_key (Widget * w, int key);
|
|
|
|
|
2016-09-29 11:16:17 +03:00
|
|
|
GList *widget_default_find (const Widget * w, const Widget * what);
|
|
|
|
Widget *widget_default_find_by_type (const Widget * w, widget_cb_fn cb);
|
|
|
|
Widget *widget_default_find_by_id (const Widget * w, unsigned long id);
|
|
|
|
|
2019-11-17 17:02:52 +03:00
|
|
|
cb_ret_t widget_default_set_state (Widget * w, widget_state_t state, gboolean enable);
|
|
|
|
|
2011-03-21 16:43:56 +03:00
|
|
|
/* get mouse pointer location within widget */
|
|
|
|
Gpm_Event mouse_get_local (const Gpm_Event * global, const Widget * w);
|
|
|
|
gboolean mouse_global_in_widget (const Gpm_Event * event, const Widget * w);
|
|
|
|
|
2013-06-24 10:47:03 +04:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
2010-11-12 11:03:57 +03:00
|
|
|
/*** inline functions ****************************************************************************/
|
2013-06-24 10:47:03 +04:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
static inline cb_ret_t
|
2012-09-28 15:05:43 +04:00
|
|
|
send_message (void *w, void *sender, widget_msg_t msg, int parm, void *data)
|
2010-11-12 11:03:57 +03:00
|
|
|
{
|
2014-02-09 12:52:06 +04:00
|
|
|
cb_ret_t ret = MSG_NOT_HANDLED;
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
if (w != NULL) /* This must be always true, but... */
|
|
|
|
#endif
|
|
|
|
ret = WIDGET (w)->callback (WIDGET (w), WIDGET (sender), msg, parm, data);
|
|
|
|
|
|
|
|
return ret;
|
2010-11-12 11:03:57 +03:00
|
|
|
}
|
|
|
|
|
2016-04-10 10:49:31 +03:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
/**
|
|
|
|
* Check whether one or several option flags are set or not.
|
|
|
|
* @param w widget
|
|
|
|
* @param options widget option flags
|
|
|
|
*
|
|
|
|
* @return TRUE if all requested option flags are set, FALSE otherwise.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
widget_get_options (const Widget * w, widget_options_t options)
|
|
|
|
{
|
|
|
|
return ((w->options & options) == options);
|
|
|
|
}
|
|
|
|
|
2013-06-24 10:47:03 +04:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
2016-04-10 11:01:48 +03:00
|
|
|
/**
|
|
|
|
* Check whether one or several state flags are set or not.
|
|
|
|
* @param w widget
|
|
|
|
* @param state widget state flags
|
|
|
|
*
|
|
|
|
* @return TRUE if all requested state flags are set, FALSE otherwise.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
widget_get_state (const Widget * w, widget_state_t state)
|
|
|
|
{
|
|
|
|
return ((w->state & state) == state);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
2016-09-29 11:16:17 +03:00
|
|
|
/**
|
|
|
|
* Find widget.
|
|
|
|
*
|
|
|
|
* @param w widget
|
|
|
|
* @param what widget to find
|
|
|
|
*
|
|
|
|
* @return result of @w->find()
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline GList *
|
|
|
|
widget_find (const Widget * w, const Widget * what)
|
|
|
|
{
|
|
|
|
return w->find (w, what);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find widget by widget type using widget callback.
|
|
|
|
*
|
|
|
|
* @param w widget
|
|
|
|
* @param cb widget callback
|
|
|
|
*
|
|
|
|
* @return result of @w->find_by_type()
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline Widget *
|
|
|
|
widget_find_by_type (const Widget * w, widget_cb_fn cb)
|
|
|
|
{
|
|
|
|
return w->find_by_type (w, cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
/**
|
|
|
|
* Find widget by widget ID.
|
|
|
|
*
|
|
|
|
* @param w widget
|
|
|
|
* @param id widget ID
|
|
|
|
*
|
|
|
|
* @return result of @w->find_by_id()
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline Widget *
|
|
|
|
widget_find_by_id (const Widget * w, unsigned long id)
|
|
|
|
{
|
|
|
|
return w->find_by_id (w, id);
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:02:52 +03:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
/**
|
|
|
|
* Modify state of widget.
|
|
|
|
*
|
|
|
|
* @param w widget
|
|
|
|
* @param state widget state flag to modify
|
|
|
|
* @param enable specifies whether to turn the flag on (TRUE) or off (FALSE).
|
|
|
|
* Only one flag per call can be modified.
|
|
|
|
* @return MSG_HANDLED if set was handled successfully, MSG_NOT_HANDLED otherwise.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline cb_ret_t
|
|
|
|
widget_set_state (Widget * w, widget_state_t state, gboolean enable)
|
|
|
|
{
|
|
|
|
return w->set_state (w, state, enable);
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:58:52 +03:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get color colors of widget.
|
|
|
|
*
|
|
|
|
* @param w widget
|
|
|
|
* @return color colors
|
|
|
|
*/
|
|
|
|
static inline const int *
|
|
|
|
widget_get_colors (const Widget * w)
|
|
|
|
{
|
|
|
|
return w->get_colors (w);
|
|
|
|
}
|
|
|
|
|
2016-09-30 11:03:57 +03:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
/**
|
|
|
|
* Update cursor position in the specified widget.
|
|
|
|
*
|
|
|
|
* @param w widget
|
|
|
|
*
|
|
|
|
* @return TRUE if cursor was updated successfully, FALSE otherwise
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
widget_update_cursor (Widget * w)
|
|
|
|
{
|
|
|
|
return (send_message (w, NULL, MSG_CURSOR, 0, NULL) == MSG_HANDLED);
|
|
|
|
}
|
|
|
|
|
2016-09-29 11:16:17 +03:00
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
2016-10-14 15:28:00 +03:00
|
|
|
static inline void
|
|
|
|
widget_set_size_rect (Widget * w, const WRect * r)
|
|
|
|
{
|
|
|
|
widget_set_size (w, r->y, r->x, r->lines, r->cols);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
#endif /* MC__WIDGET_INTERNAL_H */
|