///////////////////////////////////////////////////////////////////////////////// // // Function: // // Purpose: // // Parameters: // // Return value: // // Author: Komatsu Yuji(Zheng Chuyu) // ///////////////////////////////////////////////////////////////////////////////// void calendar_destroy(calendar_t * obj) { jbxlog_trace("In %s()", __func__); if (obj == NULL) return; calendar_init(obj); jbx_free(obj); obj = NULL; }
///////////////////////////////////////////////////////////////////////////////// // // Function: // // Purpose: // // Parameters: // // Return value: // // Author: Komatsu Yuji(Zheng Chuyu) // ///////////////////////////////////////////////////////////////////////////////// calendar_t *calendar_new(void) { calendar_t *obj; jbxlog_trace("In %s()", __func__); obj = (calendar_t *) malloc(sizeof(calendar_t)); obj->name = NULL; obj->description = NULL; calendar_init(obj); return obj; }
///////////////////////////////////////////////////////////////////////////////// // // Function: // // Purpose: // // Parameters: // // Return value: // // Author: Komatsu Yuji(Zheng Chuyu) // ///////////////////////////////////////////////////////////////////////////////// int calendar_load(calendar_t * obj, dbi_result res) { jbxlog_trace("In %s()", __func__); if (obj == NULL || res == NULL) return -1; calendar_init(obj); obj->id = dbi_result_get_ulonglong(res, "id"); obj->name = jbxdb_get_string(res, "name"); obj->description = jbxdb_get_string(res, "description"); obj->kind = dbi_result_get_int(res, "kind"); obj->created_at = jbxdb_get_datetime(res, "created_at"); obj->updated_at = jbxdb_get_datetime(res, "updated_at"); return 0; }
SWIGEXPORT void JNICALL Java_com_blf_calendar_calendarCoreJNI_calendar_1init(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jfloat jarg3, jfloat jarg4) { SCalendar *arg1 = (SCalendar *) 0 ; CGSize arg2 ; float arg3 ; float arg4 ; CGSize *argp2 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(SCalendar **)&jarg1; argp2 = *(CGSize **)&jarg2; if (!argp2) { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null CGSize"); return ; } arg2 = *argp2; arg3 = (float)jarg3; arg4 = (float)jarg4; calendar_init(arg1,arg2,arg3,arg4); }
void handle_init(AppContextRef ctx) { (void)ctx; window_init(&window, "Modern Watch"); window_stack_push(&window, true /* Animated */); resource_init_current_app(&APP_RESOURCES); bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container); layer_add_child(&window.layer, &background_image_container.layer.layer); heap_bitmap_init(&icon_status_1, RESOURCE_ID_IMAGE_STATUS_1); heap_bitmap_init(&icon_status_2, RESOURCE_ID_IMAGE_STATUS_2); heap_bitmap_init(&icon_status_3, RESOURCE_ID_IMAGE_STATUS_3); text_layer_init(&date_layer, GRect(27, 112, 90, 21)); text_layer_set_text_color(&date_layer, GColorWhite); text_layer_set_text_alignment(&date_layer, GTextAlignmentCenter); text_layer_set_background_color(&date_layer, GColorClear); text_layer_set_font(&date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); layer_add_child(&window.layer, &date_layer.layer); text_layer_init(&date_layer2, GRect(27, 93, 90, 21)); text_layer_set_text_color(&date_layer2, GColorWhite); text_layer_set_text_alignment(&date_layer2, GTextAlignmentCenter); text_layer_set_background_color(&date_layer2, GColorClear); text_layer_set_font(&date_layer2, fonts_get_system_font(FONT_KEY_GOTHIC_18)); layer_add_child(&window.layer, &date_layer2.layer); draw_date(); GRect sframe; sframe.origin.x = 54; sframe.origin.y = 56; sframe.size.w = 38; sframe.size.h = 9; layer_init(&status_layer, sframe); status_layer.update_proc = &status_layer_update_callback; layer_add_child(&window.layer, &status_layer); layer_init(&hour_display_layer, window.layer.frame); hour_display_layer.update_proc = &hour_display_layer_update_callback; layer_add_child(&window.layer, &hour_display_layer); gpath_init(&hour_hand_path, &HOUR_HAND_PATH_POINTS); gpath_move_to(&hour_hand_path, grect_center_point(&hour_display_layer.frame)); layer_init(&minute_display_layer, window.layer.frame); minute_display_layer.update_proc = &minute_display_layer_update_callback; layer_add_child(&window.layer, &minute_display_layer); gpath_init(&minute_hand_path, &MINUTE_HAND_PATH_POINTS); gpath_move_to(&minute_hand_path, grect_center_point(&minute_display_layer.frame)); layer_init(¢er_display_layer, window.layer.frame); center_display_layer.update_proc = ¢er_display_layer_update_callback; layer_add_child(&window.layer, ¢er_display_layer); layer_init(&second_display_layer, window.layer.frame); second_display_layer.update_proc = &second_display_layer_update_callback; layer_add_child(&window.layer, &second_display_layer); // Configurable inverse #ifdef INVERSE inverter_layer_init(&full_inverse_layer, GRect(0, 0, window.layer.bounds.size.w, window.layer.bounds.size.h)); layer_add_child(&window.layer, &full_inverse_layer.layer); #endif calendar_init(ctx); }