Beispiel #1
0
void
dlg_select_widget (void *w)
{
    Widget *widget = WIDGET (w);
    WDialog *h = widget->owner;

    do_select_widget (h, g_list_find (h->widgets, widget), SELECT_EXACT);
}
Beispiel #2
0
void
dlg_select_widget (void *w)
{
    const Widget *widget = (Widget *) w;
    Dlg_head *h = widget->owner;

    do_select_widget (h, g_list_find (h->widgets, widget), SELECT_EXACT);
}
Beispiel #3
0
void
dlg_set_top_widget (void *w)
{
    Widget *widget = WIDGET (w);
    WDialog *h = widget->owner;
    GList *l;

    l = g_list_find (h->widgets, w);
    if (l == NULL)
        abort ();               /* widget is not in dialog, this should not happen */

    /* unfocus prevoius widget and focus current one before widget reordering */
    if (h->state == DLG_ACTIVE)
        do_select_widget (h, l, SELECT_EXACT);

    /* widget reordering */
    h->widgets = g_list_remove_link (h->widgets, l);
    h->widgets = g_list_concat (h->widgets, l);
    h->current = l;
}
Beispiel #4
0
static cb_ret_t
dlg_try_hotkey (WDialog * h, int d_key)
{
    GList *hot_cur;
    Widget *current;
    cb_ret_t handled;
    int c;

    if (h->widgets == NULL)
        return MSG_NOT_HANDLED;

    if (h->current == NULL)
        h->current = h->widgets;

    /*
     * Explanation: we don't send letter hotkeys to other widgets if
     * the currently selected widget is an input line
     */

    current = WIDGET (h->current->data);

    if ((current->options & W_DISABLED) != 0)
        return MSG_NOT_HANDLED;

    if (current->options & W_IS_INPUT)
    {
        /* skip ascii control characters, anything else can valid character in
         * some encoding */
        if (d_key >= 32 && d_key < 256)
            return MSG_NOT_HANDLED;
    }

    /* If it's an alt key, send the message */
    c = d_key & ~ALT (0);
    if (d_key & ALT (0) && g_ascii_isalpha (c))
        d_key = g_ascii_tolower (c);

    handled = MSG_NOT_HANDLED;
    if ((current->options & W_WANT_HOTKEY) != 0)
        handled = send_message (current, NULL, MSG_HOTKEY, d_key, NULL);

    /* If not used, send hotkey to other widgets */
    if (handled == MSG_HANDLED)
        return MSG_HANDLED;

    hot_cur = dlg_widget_next (h, h->current);

    /* send it to all widgets */
    while (h->current != hot_cur && handled == MSG_NOT_HANDLED)
    {
        current = WIDGET (hot_cur->data);

        if ((current->options & W_WANT_HOTKEY) != 0 && (current->options & W_DISABLED) == 0)
            handled = send_message (current, NULL, MSG_HOTKEY, d_key, NULL);

        if (handled == MSG_NOT_HANDLED)
            hot_cur = dlg_widget_next (h, hot_cur);
    }

    if (handled == MSG_HANDLED)
        do_select_widget (h, hot_cur, SELECT_EXACT);

    return handled;
}
Beispiel #5
0
void
dlg_one_down (WDialog * h)
{
    if (h->widgets != NULL)
        do_select_widget (h, dlg_widget_next (h, h->current), SELECT_NEXT);
}
Beispiel #6
0
void
dlg_one_up (WDialog * h)
{
    if (h->widgets != NULL)
        do_select_widget (h, dlg_widget_prev (h, h->current), SELECT_PREV);
}