mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
(dlg_widget_active): rename to widget_is_active()
...and move to lib/widget/widget-common.c. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
405143ba9f
commit
1672fa44dd
@ -184,15 +184,8 @@ void do_refresh (void);
|
||||
/* Used in load_prompt() */
|
||||
void update_cursor (WDialog * h);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
/* Return TRUE if the widget is active, FALSE otherwise */
|
||||
static inline gboolean
|
||||
dlg_widget_active (void *w)
|
||||
{
|
||||
return (w == WIDGET (w)->owner->current->data);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static inline unsigned long
|
||||
@ -201,4 +194,6 @@ dlg_get_current_widget_id (const struct WDialog *h)
|
||||
return WIDGET (h->current->data)->id;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#endif /* MC__DIALOG_H */
|
||||
|
@ -2,7 +2,7 @@
|
||||
Widgets for the Midnight Commander
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||
2004, 2005, 2006, 2007, 2009, 2010, 2011
|
||||
2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013
|
||||
The Free Software Foundation, Inc.
|
||||
|
||||
Authors:
|
||||
@ -11,7 +11,7 @@
|
||||
Jakub Jelinek, 1995
|
||||
Andrej Borsenkow, 1996
|
||||
Norbert Warmuth, 1997
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012, 2013
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -266,6 +266,20 @@ widget_erase (Widget * w)
|
||||
tty_fill_region (w->y, w->x, w->lines, w->cols, ' ');
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Check whether widget is active or not.
|
||||
* @param w the widget
|
||||
*
|
||||
* @return TRUE if the widget is active, FALSE otherwise
|
||||
*/
|
||||
|
||||
gboolean
|
||||
widget_is_active (const void *w)
|
||||
{
|
||||
return (w == WIDGET (w)->owner->current->data);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
@ -281,8 +295,8 @@ widget_redraw (Widget * w)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* get mouse pointer location within widget */
|
||||
|
||||
Gpm_Event
|
||||
mouse_get_local (const Gpm_Event * global, const Widget * w)
|
||||
{
|
||||
|
@ -144,12 +144,15 @@ void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
|
||||
void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey);
|
||||
void widget_redraw (Widget * w);
|
||||
void widget_erase (Widget * w);
|
||||
gboolean widget_is_active (const void *w);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** inline functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static inline cb_ret_t
|
||||
send_message (void *w, void *sender, widget_msg_t msg, int parm, void *data)
|
||||
@ -157,4 +160,6 @@ send_message (void *w, void *sender, widget_msg_t msg, int parm, void *data)
|
||||
return WIDGET (w)->callback (WIDGET (w), WIDGET (sender), msg, parm, data);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#endif /* MC__WIDGET_INTERNAL_H */
|
||||
|
@ -161,7 +161,7 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
Widget *wi;
|
||||
|
||||
wi = dlg_find_by_id (h, panel_listing_types_id);
|
||||
if (dlg_widget_active (wi))
|
||||
if (widget_is_active (wi))
|
||||
{
|
||||
WInput *in;
|
||||
|
||||
@ -172,7 +172,7 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
}
|
||||
|
||||
wi = dlg_find_by_id (h, panel_user_format_id);
|
||||
if (dlg_widget_active (wi))
|
||||
if (widget_is_active (wi))
|
||||
{
|
||||
h->ret_value = B_USER + 6;
|
||||
dlg_stop (h);
|
||||
@ -180,7 +180,7 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
}
|
||||
|
||||
wi = dlg_find_by_id (h, mini_user_format_id);
|
||||
if (dlg_widget_active (wi))
|
||||
if (widget_is_active (wi))
|
||||
{
|
||||
h->ret_value = B_USER + 7;
|
||||
dlg_stop (h);
|
||||
@ -193,10 +193,10 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
Widget *wi;
|
||||
|
||||
wi = dlg_find_by_id (h, panel_user_format_id);
|
||||
if (dlg_widget_active (wi))
|
||||
if (widget_is_active (wi))
|
||||
{
|
||||
wi = dlg_find_by_id (h, mini_user_format_id);
|
||||
if (dlg_widget_active (wi))
|
||||
if (widget_is_active (wi))
|
||||
{
|
||||
WRadio *r;
|
||||
|
||||
|
@ -1134,9 +1134,9 @@ swap_panels (void)
|
||||
panel_re_sort (current_panel);
|
||||
}
|
||||
|
||||
if (dlg_widget_active (panels[0].widget))
|
||||
if (widget_is_active (panels[0].widget))
|
||||
dlg_select_widget (panels[1].widget);
|
||||
else if (dlg_widget_active (panels[1].widget))
|
||||
else if (widget_is_active (panels[1].widget))
|
||||
dlg_select_widget (panels[0].widget);
|
||||
}
|
||||
else
|
||||
|
@ -3589,7 +3589,7 @@ panel_event (Gpm_Event * event, void *data)
|
||||
Widget *w = WIDGET (data);
|
||||
|
||||
const int lines = llines (panel);
|
||||
const gboolean is_active = dlg_widget_active (panel);
|
||||
const gboolean is_active = widget_is_active (panel);
|
||||
const gboolean mouse_down = (event->type & GPM_DOWN) != 0;
|
||||
Gpm_Event local;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user