int XformPen::tap_cb(CGESTUREptr& tap, DrawState*& s) { assert(tap); if (tap->is_double_tap()) { // should never happen given order of arcs in XformPen constructor cerr << "XformPen::tap_cb: error: gesture is double tap" << endl; return 0; } // tap on cursor? BMESHray ray(tap->center()); _view->intersect(ray); Cursor3D* c = Cursor3D::upcast(ray.geom()); if (c) { err_adv(debug, "XformPen::tap_cb: hit axis"); c->handle_gesture(tap); return 0; } // tap on mesh? _mesh = 0; Bface* f = cur_face(); if (!f) { err_adv(debug, "XformPen::tap_cb: missed face"); return cancel_cb(tap, s); } BMESH* m = f->mesh(); if (!m) { err_adv(debug, "XformPen::tap_cb: hit face, no mesh"); return cancel_cb(tap, s); } GEOMptr g = bmesh_to_geom(m); if (!g) { err_adv(debug, "XformPen::tap_cb: hit mesh, no geom"); return cancel_cb(tap, s); } // skip floor: if (FLOOR::isa(g)) { err_adv(debug, "XformPen::tap_cb: hit floor, skipping..."); return cancel_cb(tap, s); } // tap on ordinary mesh (not floor): _mesh = m; assert(_mesh); BMESH::set_focus(_mesh, f->patch()); FLOOR::show(); FLOOR::realign(_mesh,0); // 0 = no undo command Cursor3D::attach(g); return 0; }
Elm_Url * _elm_url_download(const char *url, Elm_Url_Done done_cb, Elm_Url_Cancel cancel_cb, Elm_Url_Progress progress_cb, const void *data) { Ecore_Con_Url *target; Elm_Url *r; ecore_con_url_init(); target = ecore_con_url_new(url); if (!target) goto on_error; #if defined(HAVE_GETUID) && defined(HAVE_GETEUID) if (getuid() == geteuid()) #endif { if (getenv("http_proxy")) ecore_con_url_proxy_set(target, getenv("http_proxy")); if (getenv("https_proxy")) ecore_con_url_proxy_set(target, getenv("https_proxy")); if (getenv("ftp_proxy")) ecore_con_url_proxy_set(target, getenv("ftp_proxy")); } r = malloc(sizeof (Elm_Url)); if (!r) goto on_error; r->url = eina_stringshare_add(url); r->cb.done = done_cb; r->cb.cancel = cancel_cb; r->cb.progress = progress_cb; r->data = data; r->download = eina_binbuf_new(); r->target = target; r->handler.progress = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _elm_url_progress, r); r->handler.done = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _elm_url_done, r); r->handler.data = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _elm_url_data, r); if (!ecore_con_url_get(r->target)) { _elm_url_free(r); cancel_cb((void*) data, NULL, -1); return NULL; } return r; on_error: ecore_con_url_shutdown(); cancel_cb((void*) data, NULL, -1); return NULL; }
void ok_cb (GtkWidget * crap, gpointer * nothing) { apply_cb (crap, nothing); cancel_cb (crap, nothing); return; }
//******************************************************** WordsFind::WordsFind( QWidget *parent, const char *name , WordsEdit *w) : QWidget( parent, name ) { wordsedit = w; wordlist=w->wordlist; setCaption("Find"); Q3BoxLayout *all = new Q3VBoxLayout(this,10); Q3BoxLayout *txt = new Q3HBoxLayout(all,4); QLabel *label = new QLabel("Find what:",this); txt->addWidget(label); find_field = new QLineEdit(this); find_field->setMinimumWidth(200); connect( find_field, SIGNAL(returnPressed()), SLOT(find_first_cb()) ); txt->addWidget(find_field); Q3BoxLayout *left1 = new Q3HBoxLayout(all,10); Q3ButtonGroup *direction = new Q3ButtonGroup(2,Qt::Vertical,"Dir",this); up = new QRadioButton("Up",direction); up->setChecked(false); down = new QRadioButton("Down",direction); down->setChecked(true); left1->addWidget(direction); Q3ButtonGroup *from = new Q3ButtonGroup(2,Qt::Vertical,"From",this); start = new QRadioButton("Start",from); start->setChecked(true); current = new QRadioButton("Current",from); current->setChecked(false); left1->addWidget(from); Q3ButtonGroup *type = new Q3ButtonGroup(2,Qt::Vertical,"Match",this); exact = new QRadioButton("Exact",type); exact->setChecked(false); substring = new QRadioButton("Substr",type); substring->setChecked(true); left1->addWidget(type); Q3BoxLayout *right = new Q3VBoxLayout(left1,5); find_first = new QPushButton("Find",this); right->addWidget(find_first); connect( find_first, SIGNAL(clicked()), SLOT(find_first_cb()) ); find_next = new QPushButton("Find next",this); connect( find_next, SIGNAL(clicked()), SLOT(find_next_cb()) ); right->addWidget(find_next); cancel = new QPushButton("Cancel",this); connect( cancel, SIGNAL(clicked()), SLOT(cancel_cb()) ); right->addWidget(cancel); adjustSize(); FindLastWord=-1; FindLastGroup=-1; }
static void key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { if (event->keyval == GDK_Escape) cancel_cb(NULL); }
gint keypress_cb (GtkWidget *w, GdkEvent *e, void *v) { switch (e->key.keyval) { case GDK_Return: ok_cb (NULL, NULL); return (TRUE); case GDK_Escape: cancel_cb(NULL, NULL); return (TRUE); default: return (FALSE); } };
static void purple_keyring_cancel_requests(PurpleKeyring *keyring) { PurpleKeyringCancelRequests cancel_cb; g_return_if_fail(keyring != NULL); if (keyring->is_cancelling) return; keyring->is_cancelling = TRUE; cancel_cb = purple_keyring_get_cancel_requests(keyring); if (cancel_cb != NULL) cancel_cb(); keyring->is_cancelling = FALSE; if (keyring->close_after_cancel) { keyring->close_after_cancel = FALSE; purple_keyring_close(keyring); } }
void Cancellable::Cancel () { if (cancel_cb) cancel_cb (request, context); }