static status eventBrowserSelectGesture(BrowserSelectGesture g, EventObj ev) { status rval; ListBrowser lb = get_list_browser(ev); /* Handle the browsers scrollbar */ if ( g->scrolling == ON ) { send(lb->scroll_bar, NAME_event, ev, EAV); if ( isUpEvent(ev) ) assign(g, scrolling, OFF); succeed; } if ( isDownEvent(ev) && insideEvent(ev, (Graphical)lb->scroll_bar) ) { assign(g, scrolling, ON); send(lb->scroll_bar, NAME_event, ev, EAV); succeed; } rval = eventGesture(g, ev); if ( g->status == NAME_active && (isAEvent(ev, NAME_locMove) || isAEvent(ev, NAME_wheel)) ) { send(g, NAME_drag, ev, EAV); succeed; } return rval; }
static status eventPopupGesture(PopupGesture g, EventObj ev) { if ( g->status == NAME_active && isUpEvent(ev) ) { PceWindow sw; if ( !(sw = getWindowGraphical(ev->receiver)) ) sw = ev->window; if ( notNil(g->current) && g->current->displayed == OFF ) { send(g->current, NAME_open, ev->receiver, getAreaPositionEvent(ev, DEFAULT), EAV); attributeObject(g, NAME_Stayup, ON); grabPointerWindow(sw, ON); focusWindow(sw, ev->receiver, (Recogniser) g, g->cursor, NIL); } else if ( valInt(getClickTimeEvent(ev)) < 400 && getAttributeObject(g, NAME_Stayup) != ON ) { attributeObject(g, NAME_Stayup, ON); grabPointerWindow(sw, ON); focusWindow(sw, ev->receiver, (Recogniser) g, g->cursor, NIL); } else { send(g, NAME_terminate, EAV); if ( isNil(g->current) ) { grabPointerWindow(sw, OFF); focusWindow(sw, NIL, NIL, NIL, NIL); deleteAttributeObject(g, NAME_Stayup); assign(g, status, NAME_inactive); } } succeed; } else if ( notNil(g->current) && g->current->displayed == ON ) return postEvent(ev, (Graphical) g->current, DEFAULT); if ( eventGesture(g, ev) ) succeed; if ( g->status == NAME_active && isAEvent(ev, NAME_keyboard) ) { Name key; TRY(updatePopupGesture(g, ev)); key = characterName(getIdEvent(ev)); if ( send(g->current, NAME_key, key, EAV) ) { Any context = g->context; PopupObj current = g->current; assign(g, context, NIL); assign(g, current, NIL); send(current, NAME_execute, context, EAV); succeed; } else send(g, NAME_cancel, ev, EAV); } fail; }
static status eventLabel(Label lb, EventObj ev) { if ( eventDialogItem(lb, ev) ) succeed; if ( notNil(lb->message) && lb->active == ON ) { makeButtonGesture(); return eventGesture(GESTURE_button, ev); } fail; }
static status eventEditTextGesture(EditTextGesture g, EventObj ev) { Graphical t = ev->receiver; if ( get(t, NAME_showCaret, EAV) == ON && isAEvent(ev, NAME_keyboard) ) return send(t, NAME_typed, ev, EAV); else if ( isAEvent(ev, NAME_obtainKeyboardFocus) ) return send(t, NAME_showCaret, ON, EAV); else if ( isAEvent(ev, NAME_releaseKeyboardFocus) ) return send(t, NAME_showCaret, OFF, EAV); return eventGesture(g, ev); }