/* 初始化储存矩形数据的队列 */ LCUI_API void RectQueue_Init( LCUI_RectQueue *queue ) { queue->number = 0; Queue_Init( &queue->queue[0], sizeof(LCUI_Rect), NULL ); Queue_Init( &queue->queue[1], sizeof(LCUI_Rect), NULL ); /* 采用链表来记录数据 */ Queue_SetDataMode( &queue->queue[0], QUEUE_DATA_MODE_LINKED_LIST ); Queue_SetDataMode( &queue->queue[1], QUEUE_DATA_MODE_LINKED_LIST ); }
static int TextLayer_Text_Insert_NewRow ( LCUI_TextLayer *layer, int row ) /* 在插入新行至指定位置 */ { Text_RowData data; data.pos = Pos(0,0); data.max_size = Size(0,0); data.last_char = NULL; Queue_Init( &data.string, sizeof(LCUI_CharData), NULL ); Queue_SetDataMode( &data.string, QUEUE_DATA_MODE_LINKED_LIST ); Queue_UsingPointer( &data.string ); return Queue_Insert( &layer->rows_data, row, &data ); }
static int TextLayer_Text_Add_NewRow ( LCUI_TextLayer *layer ) /* 添加新行 */ { Text_RowData data; /* 单整行最大尺寸改变时,需要移动整行,目前还未支持此功能 */ data.pos = Pos(0,0); data.max_size = Size(0,0); data.last_char = NULL; Queue_Init( &data.string, sizeof(LCUI_CharData), NULL ); /* 使用链表模式,方便数据的插入 */ Queue_SetDataMode( &data.string, QUEUE_DATA_MODE_LINKED_LIST ); /* 队列成员使用指针,主要是引用text_source_data里面的数据 */ Queue_UsingPointer( &data.string ); return Queue_Add( &layer->rows_data, &data ); }
TextLayer_Init( LCUI_TextLayer *layer ) /* 初始化文本图层相关数据 */ { layer->read_only = FALSE; layer->using_code_mode = FALSE; layer->using_style_tags = FALSE; layer->enable_word_wrap = FALSE; layer->enable_multiline = FALSE; layer->need_proc_buff = FALSE; layer->need_scroll_layer = FALSE; layer->have_select = FALSE; layer->start = 0; layer->end = 0; layer->offset_pos = Pos(0,0); layer->old_offset_pos = Pos(0,0); Queue_Init( &layer->color_keyword, sizeof(Special_KeyWord), Destroy_Special_KeyWord ); /* 队列中使用链表储存这些数据 */ Queue_Init( &layer->text_source_data, sizeof(LCUI_CharData), Destroy_CharData ); Queue_SetDataMode( &layer->text_source_data, QUEUE_DATA_MODE_LINKED_LIST ); Queue_Init( &layer->rows_data, sizeof(Text_RowData), Destroy_Text_RowData ); StyleTag_Init( &layer->tag_buff ); Queue_Init( &layer->style_data, sizeof(LCUI_TextStyle), NULL ); RectQueue_Init( &layer->clear_area ); /* 初始化屏蔽符的数据 */ layer->password_char.display = TRUE; layer->password_char.need_update = FALSE; layer->password_char.data = NULL; layer->password_char.char_code = 0; layer->password_char.bitmap = NULL; layer->default_data.pixel_size = 12; layer->current_src_pos = 0; layer->current_des_pos = Pos(0,0); layer->max_text_len = 512000; TextStyle_Init ( &layer->default_data ); LCUIWString_Init( &layer->text_buff ); //TextLayer_Text_Add_NewRow ( layer );/* 添加新行 */ }
/** 初始化定时器列表 */ static void TimerList_Init( LCUI_Queue *timer_list ) { Queue_Init( timer_list, sizeof(timer_data), NULL ); /* 使用链表 */ Queue_SetDataMode( timer_list, QUEUE_DATA_MODE_LINKED_LIST ); }