From d84b98af3bc8dd960d8bf560e8338812e6372244 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 16 Jan 2014 17:06:19 +0300 Subject: [PATCH] Ticket #1483: Panel scrollbar move dlg_broadcast_msg_to() function to public visibility scope Signed-off-by: Slava Zanko --- lib/widget/dialog.c | 90 ++++++++++++++++++++++++--------------------- lib/widget/dialog.h | 2 + 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/lib/widget/dialog.c b/lib/widget/dialog.c index 12e899f3f..edd80cf0c 100644 --- a/lib/widget/dialog.c +++ b/lib/widget/dialog.c @@ -111,47 +111,6 @@ dlg_widget_prev (WDialog * h, GList * l) } /* --------------------------------------------------------------------------------------------- */ -/** - * broadcast a message to all the widgets in a dialog that have - * the options set to flags. If flags is zero, the message is sent - * to all widgets. - */ - -static void -dlg_broadcast_msg_to (WDialog * h, widget_msg_t msg, gboolean reverse, int flags) -{ - GList *p, *first; - - if (h->widgets == NULL) - return; - - if (h->current == NULL) - h->current = h->widgets; - - if (reverse) - p = dlg_widget_prev (h, h->current); - else - p = dlg_widget_next (h, h->current); - - first = p; - - do - { - Widget *w = WIDGET (p->data); - - if (reverse) - p = dlg_widget_prev (h, p); - else - p = dlg_widget_next (h, p); - - if ((flags == 0) || ((flags & w->options) != 0)) - send_message (w, NULL, msg, 0, NULL); - } - while (first != p); -} - -/* --------------------------------------------------------------------------------------------- */ - /** * Read histories from the ${XDG_CACHE_HOME}/mc/history file */ @@ -1331,3 +1290,52 @@ dlg_get_title (const WDialog * h, size_t len) } /* --------------------------------------------------------------------------------------------- */ +/** + * broadcast a message to all the widgets in a dialog that have + * the options set to flags. If flags is zero, the message is sent + * to all widgets. + */ + +cb_ret_t +dlg_broadcast_msg_to (WDialog * h, widget_msg_t msg, gboolean reverse, int flags) +{ + GList *p, *first; + cb_ret_t ret = MSG_NOT_HANDLED; + + if (h->widgets == NULL) + return ret; + + if (h->current == NULL) + h->current = h->widgets; + + if (reverse) + p = dlg_widget_prev (h, h->current); + else + p = dlg_widget_next (h, h->current); + + first = p; + + do + { + Widget *w = WIDGET (p->data); + + if (reverse) + p = dlg_widget_prev (h, p); + else + p = dlg_widget_next (h, p); + + if ((flags == 0) || ((flags & w->options) != 0)) + { + cb_ret_t widget_ret; + + widget_ret = send_message (w, NULL, msg, 0, NULL); + if (ret == MSG_NOT_HANDLED && widget_ret != MSG_NOT_HANDLED) + ret = widget_ret; + } + } + while (first != p); + + return ret; +} + +/* --------------------------------------------------------------------------------------------- */ diff --git a/lib/widget/dialog.h b/lib/widget/dialog.h index 20cb8b713..dae10a521 100644 --- a/lib/widget/dialog.h +++ b/lib/widget/dialog.h @@ -160,6 +160,8 @@ void dlg_broadcast_msg (WDialog * h, widget_msg_t message); /* Default callback for dialogs */ cb_ret_t dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data); +cb_ret_t dlg_broadcast_msg_to (WDialog * h, widget_msg_t msg, gboolean reverse, int flags); + /* Default paint routine for dialogs */ void dlg_default_repaint (WDialog * h);