Пример #1
0
bool ScrollView::ScrollBar::handle_mouse_down(VGPoint coord) {
    
    clicked = true;
    click = coord;
    view->scrolling = true;
    capture_focus();
    
    return true;
}
Пример #2
0
// Mouse Events. Following three functions all work the same:
//  Returns true if the mouse-event is finished being handled.
//  If returns false, handling will continue up the chain.
//  May optionally call capture_focus() to become the target for keypresses.
bool DropDownMenu::handle_mouse_down(DispPoint coord) {
    
    capture_focus();
    
    if (clicked) {
        return false;
    }
    
    clicked = true;
    pre_click_pos = get_rel_pos();

    resize(get_w(), menu->get_h());
    fill_with_color(get_clear_color());

    int vert_adj = -selected_entry_idx * (text_size + vertical_padding*2); // (up)
    move_subview(menu, DispPoint()); // reset menu subview
    get_parent()->move_subview(this, get_rel_pos() + DispPoint(0,vert_adj));
    
    return true;
}