PageRenderTime 51ms CodeModel.GetById 41ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/im/default/ftk_handwrite_engine_dummy.c

http://ftk.googlecode.com/
C | 122 lines | 69 code | 24 blank | 29 comment | 15 complexity | 04fe34f08fbedd52883c6252e3a905c5 MD5 | raw file
  1/*
  2 * File: ftk_handwrite_engine_dummy.h    
  3 * Author:  Li XianJing <xianjimli@hotmail.com>
  4 * Brief:   dummy handwrite engine
  5 *
  6 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
  7 *
  8 * Licensed under the Academic Free License version 2.1
  9 *
 10 * This program is free software; you can redistribute it and/or modify
 11 * it under the terms of the GNU General Public License as published by
 12 * the Free Software Foundation; either version 2 of the License, or
 13 * (at your option) any later version.
 14 *
 15 * This program is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18 * GNU General Public License for more details.
 19 *
 20 * You should have received a copy of the GNU General Public License
 21 * along with this program; if not, write to the Free Software
 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 23 */
 24
 25/*
 26 * History:
 27 * ================================================================
 28 * 2010-02-10 Li XianJing <xianjimli@hotmail.com> created
 29 *
 30 */
 31
 32#include "ftk_log.h"
 33#include "ftk_event.h"
 34#include "ftk_allocator.h"
 35#include "ftk_handwrite_engine.h"
 36
 37struct _FtkHandWriteEngine
 38{
 39	void* on_result_ctx;
 40	FtkCommitInfo commit_info;
 41	FtkHandWriteResult on_result;
 42};
 43
 44FtkHandWriteEngine* ftk_hand_write_engine_create(FtkHandWriteResult on_result, void* ctx)
 45{
 46	FtkHandWriteEngine* thiz = NULL;
 47	return_val_if_fail(on_result != NULL, NULL);
 48
 49	thiz = FTK_ZALLOC(sizeof(FtkHandWriteEngine));
 50
 51	if(thiz != NULL)
 52	{
 53		thiz->on_result = on_result;
 54		thiz->on_result_ctx = ctx;
 55	}
 56
 57	return thiz;
 58}
 59
 60Ret  ftk_hand_write_engine_activate(FtkHandWriteEngine* thiz)
 61{
 62	return_val_if_fail(thiz != NULL, RET_FAIL);
 63	ftk_logd("%s\n", __func__);
 64
 65	return RET_OK;
 66}
 67
 68Ret  ftk_hand_write_engine_deactivate(FtkHandWriteEngine* thiz)
 69{
 70	return_val_if_fail(thiz != NULL, RET_FAIL);
 71	ftk_logd("%s\n", __func__);
 72
 73	return RET_OK;
 74}
 75
 76Ret  ftk_hand_write_engine_reset(FtkHandWriteEngine* thiz)
 77{
 78	return_val_if_fail(thiz != NULL, RET_FAIL);
 79	ftk_logd("%s\n", __func__);
 80
 81	return RET_OK;
 82}
 83
 84Ret  ftk_hand_write_engine_set_rect(FtkHandWriteEngine* thiz, FtkRect* rect)
 85{
 86	return_val_if_fail(thiz != NULL && rect != NULL, RET_FAIL);
 87
 88	return RET_FAIL;
 89}
 90
 91Ret ftk_hand_write_engine_add_stroke(FtkHandWriteEngine* thiz, FtkPoint* points, size_t points_nr)
 92{
 93	return_val_if_fail(thiz != NULL && points != NULL, RET_FAIL);
 94
 95	ftk_logd("%s\n", __func__);
 96
 97	return RET_OK;
 98}
 99
100Ret ftk_hand_write_engine_flush(FtkHandWriteEngine* thiz)
101{
102	return_val_if_fail(thiz != NULL, RET_FAIL);
103	
104	thiz->commit_info.candidate_nr = 1;
105	strcpy(thiz->commit_info.candidates, "??");
106
107	ftk_logd("%s\n", __func__);
108	thiz->on_result(thiz->on_result_ctx, &(thiz->commit_info)); 
109
110	return RET_OK;
111}
112
113void ftk_hand_write_engine_destroy(FtkHandWriteEngine* thiz)
114{
115	if(thiz != NULL)
116	{
117		ftk_logd("%s\n", __func__);
118		FTK_ZFREE(thiz, sizeof(FtkHandWriteEngine));
119	}
120
121	return;
122}