virtual bool EventFilter(GG::Wnd*, const GG::WndEvent& event)
        {
            bool retval = false;
            if (event.Type() == GG::WndEvent::MouseEnter) {
                // TODO set cursor to edit_number_t::scrubby_cursor()
                retval = true;
            } else if (event.Type() == GG::WndEvent::MouseLeave) {
                // TODO set cursor to original
                retval = true;
            } else if (event.Type() == GG::WndEvent::LDrag) {
                GG::Pt point = event.Point();
                GG::Y delta(m_data.last_point_m.y - point.y);

                if (m_data.last_point_m.y != 0 && delta != 0)
                {
                    modifiers_t modifiers(modifier_state());

                    if (modifiers & modifiers_any_shift_s)
                        delta *= 10;

                    m_data.increment_n(Value(delta));
                }

                m_data.last_point_m = point;
                retval = true;
            } else if (event.Type() == GG::WndEvent::LButtonDown) {
                m_data.last_point_m = GG::Pt();
                retval = true;
            }
            return retval;
        }
Exemple #2
0
bool button_t::handle_key(key_type key, bool pressed, modifiers_t /* modifiers */)
{
    if (pressed == false)
        return false;

    modifiers_m = modifier_state();

    //
    // Look up the state which this modifier should trigger.
    //
    button_state_set_t::iterator state(button_modifier_state(state_set_m,
                                                             modifier_mask_m,
                                                             modifiers_m));

    if (state == state_set_m.end())
        state = button_default_state(state_set_m);

    //
    // Set the window text.
    //
    control_m->SetText(state->name_m);

    //
    // Set the alt text if need be.
    //
    if (!state->alt_text_m.empty())
        implementation::set_control_alt_text(control_m, state->alt_text_m);

    if (state->hit_proc_m.empty() || enabled_m == false)
        return false;

    if ((key.first == GG::GGK_RETURN || key.first == GG::GGK_KP_ENTER) && is_default_m)
        state->hit_proc_m(state->value_m, state->contributing_m);
    else if (key.first == GG::GGK_ESCAPE && is_cancel_m)
        state->hit_proc_m(state->value_m, state->contributing_m);
    else
        return false;

    return true;
}
Exemple #3
0
rtb_modkey_t
rtb_get_modkeys(struct rtb_window *win)
{
	return modifier_state(RTB_WINDOW_AS(win, xrtb_window)->xrtb);
}