(widget_set_size_rect): reimplement

...to pass given WRect object directly to widget callback withowt
constuction/deconstuction of intermediate WRect object.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2022-04-30 18:45:15 +03:00
parent b265b388aa
commit 3978dee37c
2 changed files with 17 additions and 9 deletions

View File

@ -10,7 +10,7 @@
Jakub Jelinek, 1995
Andrej Borsenkow, 1996
Norbert Warmuth, 1997
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012, 2013
Andrew Borodin <aborodin@vmail.ru>, 2009-2022
This file is part of the Midnight Commander.
@ -447,6 +447,21 @@ widget_set_size (Widget * w, int y, int x, int lines, int cols)
widget_draw (w);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Change widget position and size.
*
* @param w widget
* @param r WRect obgect that holds position and size
*/
void
widget_set_size_rect (Widget * w, WRect * r)
{
send_message (w, NULL, MSG_RESIZE, 0, r);
widget_draw (w);
}
/* --------------------------------------------------------------------------------------------- */
void

View File

@ -210,6 +210,7 @@ cb_ret_t widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg,
void widget_set_options (Widget * w, widget_options_t options, gboolean enable);
void widget_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols);
void widget_set_size (Widget * w, int y, int x, int lines, int cols);
void widget_set_size_rect (Widget * w, WRect * r);
/* select color for widget in dependance of state */
void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey);
cb_ret_t widget_draw (Widget * w);
@ -426,14 +427,6 @@ widget_update_cursor (Widget * w)
/* --------------------------------------------------------------------------------------------- */
static inline void
widget_set_size_rect (Widget * w, const WRect * r)
{
widget_set_size (w, r->y, r->x, r->lines, r->cols);
}
/* --------------------------------------------------------------------------------------------- */
static inline void
widget_show (Widget * w)
{