void notifyResults(CURLcode res) { long http_code = 0; curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_code); ADHttp::ResponsePtr response = reader->getResponse(); response->setCode(http_code); if(res == CURLE_OK) { cocos2d::CCLog("Req Success: %d", http_code); response->setIsOk(true); } else { cocos2d::CCLog("Req Failed: %d", http_code); response->setIsOk(false); } reader->closeFile(); ADHttp::Callback callback_copy = callback; ADCocosThread::onCocos2dThread([response, callback_copy](){ callback_copy(response); }); }
void callback_on_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data){ if(event->state & GDK_CONTROL_MASK){ switch (event->keyval){ case GDK_KEY_a: callback_mark_all(widget, data); break; case GDK_KEY_d: callback_unmark_all(widget, data); break; case GDK_KEY_s: callback_save(widget, data); break; case GDK_KEY_l: callback_load(widget, data); break; case GDK_KEY_i: callback_mark_inverse(widget, data); break; case GDK_KEY_c: callback_copy(widget, data); break; case GDK_KEY_v: callback_paste(widget, data); break; case GDK_KEY_KP_1: callback_mark_row(widget, (gpointer)0); break; case GDK_KEY_KP_2: callback_mark_row(widget, (gpointer)1); break; case GDK_KEY_KP_3: callback_mark_row(widget, (gpointer)2); break; case GDK_KEY_KP_4: callback_mark_row(widget, (gpointer)3); break; case GDK_KEY_KP_5: callback_mark_row(widget, (gpointer)4); break; case GDK_KEY_KP_6: callback_mark_row(widget,(gpointer) 5); break; case GDK_KEY_1: callback_mark_row(widget, (gpointer)0); break; case GDK_KEY_2: callback_mark_row(widget, (gpointer)1); break; case GDK_KEY_3: callback_mark_row(widget, (gpointer)2); break; case GDK_KEY_4: callback_mark_row(widget, (gpointer)3); break; case GDK_KEY_5: callback_mark_row(widget, (gpointer)4); break; case GDK_KEY_6: callback_mark_row(widget,(gpointer) 5); break; case GDK_KEY_Left: callback_insert_before(widget, data); break; case GDK_KEY_Right: callback_insert_behind(widget, data); break; default: return; } } else if(event->state & GDK_MOD1_MASK){ switch (event->keyval){ case GDK_KEY_s: callback_update_current(widget, data); break; case GDK_KEY_a: callback_apply_color(widget, (gpointer)color_master); break; case GDK_KEY_c: gtk_button_clicked((GtkButton*)color_master); break; case GDK_KEY_KP_1: callback_mark_column(widget, (gpointer)0); break; case GDK_KEY_KP_2: callback_mark_column(widget, (gpointer)1); break; case GDK_KEY_KP_3: callback_mark_column(widget, (gpointer)2); break; case GDK_KEY_KP_4: callback_mark_column(widget, (gpointer)3); break; case GDK_KEY_KP_5: callback_mark_column(widget, (gpointer)4); break; case GDK_KEY_KP_6: callback_mark_column(widget, (gpointer)5); break; case GDK_KEY_KP_7: callback_mark_column(widget, (gpointer)6); break; case GDK_KEY_KP_8: callback_mark_column(widget, (gpointer)7); break; case GDK_KEY_KP_9: callback_mark_column(widget, (gpointer)8); break; case GDK_KEY_KP_0: callback_mark_column(widget, (gpointer)9); break; case GDK_KEY_1: callback_mark_column(widget, (gpointer)0); break; case GDK_KEY_2: callback_mark_column(widget, (gpointer)1); break; case GDK_KEY_3: callback_mark_column(widget, (gpointer)2); break; case GDK_KEY_4: callback_mark_column(widget, (gpointer)3); break; case GDK_KEY_5: callback_mark_column(widget, (gpointer)4); break; case GDK_KEY_6: callback_mark_column(widget, (gpointer)5); break; case GDK_KEY_7: callback_mark_column(widget, (gpointer)6); break; case GDK_KEY_8: callback_mark_column(widget, (gpointer)7); break; case GDK_KEY_9: callback_mark_column(widget, (gpointer)8); break; case GDK_KEY_0: callback_mark_column(widget, (gpointer)9); break; case GDK_KEY_Up: callback_shift_up(widget, data); break; case GDK_KEY_Down: callback_shift_down(widget, data); break; case GDK_KEY_Left: callback_shift_left(widget, data); break; case GDK_KEY_Right: callback_shift_right(widget, data); break; default: return; } } else{ switch (event->keyval){ case GDK_KEY_Left: callback_show_prev(widget, data); break; case GDK_KEY_Right: callback_show_next(widget, data); break; case GDK_KEY_Page_Down: callback_jump_prev(widget, data); break; case GDK_KEY_Page_Up: callback_jump_next(widget, data); break; case GDK_KEY_Home: callback_jump_start(widget, data); break; case GDK_KEY_End: callback_jump_end(widget, data); break; case GDK_KEY_Delete: callback_delete_current(widget, data); break; case GDK_KEY_Escape: frame_load_colors(color_button); callback_color_changed(widget, data); break; default: return; } } }
bool CSimpleReport::doCutPaste(CPoint pt, int op) { CXTPReportSelectedRows* pRows = GetSelectedRows(); if (pRows == NULL) return false; CXTPReportRow* pRow = pRows->GetAt(0); int nRow = 0; if (pRow) nRow = pRows->GetAt(0)->GetIndex(); int n; CMenu menu; if (!menu.CreatePopupMenu()) return false; if ((op & DO_ADD) != 0) { menu.AppendMenu(MF_STRING, 10, "Add New"); menu.AppendMenu(MF_STRING, 13, "Insert"); } if (CanCopy() && (op & DO_COPY) != 0) menu.AppendMenu(MF_STRING, 11, "Copy"); if (CanCut() && (op & DO_CUT) != 0) menu.AppendMenu(MF_STRING, 12, "Delete"); n = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, pt.x, pt.y, this); menu.DestroyMenu(); switch (n) { case 10: // add case 13: // insert { CXTPReportRecord* pRec = newRec(); if (callback_add) { if (!callback_add(this, pRec)) { delete pRec; return false; } } RowInsert(pRec, (n == 10)); } break; case 11: // copy { pRow = GetFocusedRow(); if (!pRow) return false; CXTPReportRecord* pSource = pRow->GetRecord(); CXTPReportRecord* pTarget = newRec(); if (callback_copy) { if (!callback_copy(this, pSource, pTarget)) { delete pTarget; return false; } } RowInsert(pTarget); } break; case 12: // delete { n = pRows->GetCount(); for (int i = 0; i < n; i++) { if (callback_del) { CXTPReportRecord* pRec = pRows->GetAt(i)->GetRecord(); if (!callback_del(this, pRec)) { return false; } } } for (int i = n - 1; i >= 0; i--) { pRow = pRows->GetAt(i); GetRecords()->RemoveAt(pRow->GetRecord()->GetIndex()); } Populate(); RowSetFocused(nRow); } break; default: return false; } return true; }