FtkWidget* ftk_check_button_create_ex(FtkWidget* parent, int x, int y, int width, int height, int radio) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz->priv_subclass[0] != NULL) { DECL_PRIV0(thiz, priv); priv->is_radio = radio; thiz->on_event = ftk_check_button_on_event; thiz->on_paint = ftk_check_button_on_paint; thiz->destroy = ftk_check_button_destroy; ftk_widget_init(thiz, radio ? FTK_RADIO_BUTTON : FTK_CHECK_BUTTON, 0, x, y, width, height, FTK_ATTR_TRANSPARENT); ftk_widget_append_child(parent, thiz); } else { FTK_FREE(thiz); } return thiz; }
FtkWidget* ftk_wait_box_create(FtkWidget* parent, int x, int y, int w, int h) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz->priv_subclass[0] != NULL) { int w = 0; DECL_PRIV0(thiz, priv); thiz->on_event = ftk_wait_box_on_event; thiz->on_paint = ftk_wait_box_on_paint; thiz->destroy = ftk_wait_box_destroy; priv->bitmap = ftk_theme_load_image(ftk_default_theme(), "wait_box"FTK_STOCK_IMG_SUFFIX); assert(priv->bitmap != NULL); w = ftk_bitmap_width(priv->bitmap); ftk_widget_init(thiz, FTK_WAIT_BOX, 0, x, y, w, w, FTK_ATTR_TRANSPARENT|FTK_ATTR_INSENSITIVE); ftk_widget_set_attr(thiz, FTK_ATTR_TRANSPARENT|FTK_ATTR_INSENSITIVE); priv->timer = ftk_source_timer_create(500, (FtkTimer)ftk_widget_invalidate, thiz); ftk_widget_append_child(parent, thiz); } else { FTK_FREE(thiz); } return thiz; }
FtkWidget* ftk_scroll_bar_create(FtkWidget* parent, int x, int y, int width, int height) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz != NULL) { DECL_PRIV0(thiz, priv); thiz->on_event = ftk_scroll_bar_on_event; thiz->on_paint = ftk_scroll_bar_on_paint; thiz->destroy = ftk_scroll_bar_destroy; if(width < height) { /*vertical*/ priv->vertical = 1; priv->bitmap = ftk_theme_load_image(ftk_default_theme(), "scrollbar_handle_vertical"FTK_STOCK_IMG_SUFFIX); } else { priv->vertical = 0; priv->bitmap = ftk_theme_load_image(ftk_default_theme(), "scrollbar_handle_horizontal"FTK_STOCK_IMG_SUFFIX); } ftk_widget_init(thiz, width < height ? FTK_SCROLL_VBAR : FTK_SCROLL_HBAR, 0, x, y, width, height, FTK_ATTR_TRANSPARENT); ftk_widget_append_child(parent, thiz); } return thiz; }
static Ret ftk_input_pattern_append(FtkInputPattern* thiz, InputPattern* p) { InputPattern* iter = NULL; InputPattern* pattern = NULL; return_val_if_fail(p->is_valid_char != NULL, RET_FAIL); if(p->max_size == 0) { p->max_size = p->min_size; } pattern = (InputPattern*)FTK_ZALLOC(sizeof(InputPattern)); memcpy(pattern, p, sizeof(InputPattern)); if(thiz->pattern == NULL) { thiz->pattern = pattern; } else { for(iter = thiz->pattern; iter->next != NULL; iter = iter->next); iter->next = pattern; } thiz->max_length += p->max_size + 1; return RET_OK; }
FontData* font_data_load_file(const char* file_name) { FontData* thiz = NULL; return_val_if_fail(file_name != NULL, NULL); if((thiz = font_data_create(0, 0)) != NULL) { FtkFsHandle fp = ftk_file_open(file_name, "rb"); if(fp != NULL) { int ret = 0; unsigned glyphs_size = 0; ret = ftk_file_read(fp, &thiz->header, sizeof(thiz->header)); assert(ret == sizeof(thiz->header)); glyphs_size = thiz->header.char_nr * sizeof(FGlyph); thiz->glyphs = (FGlyph*)FTK_ZALLOC(glyphs_size); assert(thiz->glyphs != NULL); ftk_file_read(fp, thiz->glyphs, glyphs_size); thiz->data = NULL; thiz->data_size = 0; thiz->new_created = 0; thiz->org_data = NULL; ftk_file_close(fp); ftk_strncpy(thiz->file_name, file_name, sizeof(thiz->file_name)-1); } else { FTK_FREE(thiz); } } return thiz; }
FtkSource* ftk_source_ps2mouse_create(const char* filename, FtkOnEvent on_event, void* user_data, int max_x, int max_y) { FtkSource* thiz = (FtkSource*)FTK_ZALLOC(sizeof(FtkSource) + sizeof(PrivInfo)); if(thiz != NULL) { DECL_PRIV(thiz, priv); thiz->get_fd = ftk_source_ps2mouse_get_fd; thiz->check = ftk_source_ps2mouse_check; thiz->dispatch = ftk_source_ps2mouse_dispatch; thiz->destroy = ftk_source_ps2mouse_destroy; thiz->ref = 1; priv->fd = open(filename, O_RDONLY); ftk_strncpy(priv->filename, filename, sizeof(priv->filename)); open_device(priv, max_x, max_y); if(priv->fd < 0) { FTK_ZFREE(thiz, sizeof(thiz) + sizeof(PrivInfo)); return NULL; } priv->on_event = on_event; priv->user_data = user_data; priv->is_first_move = true; ftk_logd("%s: %d=%s priv->user_data=%p\n", __func__, priv->fd, filename, priv->user_data); } return thiz; }
FtkInputMethod* ftk_input_method_hw_create(void) { FtkInputMethod* thiz = FTK_ZALLOC(sizeof(FtkInputMethod) + sizeof(PrivInfo)); if(thiz != NULL) { FtkColor c = {0}; DECL_PRIV(thiz, priv); thiz->ref = 1; thiz->name = _("Hand Write"); thiz->set_type = ftk_input_method_hw_set_type; thiz->focus_in = ftk_input_method_hw_focus_in; thiz->focus_out = ftk_input_method_hw_focus_out; thiz->handle_event = ftk_input_method_hw_handle_event; thiz->destroy = ftk_input_method_hw_destroy; c.r = 0xff; c.b = 0xff; priv->painter = ftk_stroke_painter_create(); priv->engine = ftk_hand_write_engine_create(on_handwrite_result, thiz); ftk_input_method_hw_set_rect(thiz, NULL); ftk_input_method_hw_set_pen_width(thiz, 3); ftk_input_method_hw_set_pen_color(thiz, c); ftk_input_method_hw_set_click_timeout(thiz, 300); ftk_input_method_hw_set_commit_timeout(thiz, 1500); } return thiz; }
FtkWndManager* ftk_wnd_manager_default_create(FtkMainLoop* main_loop) { FtkWndManager* thiz = NULL; return_val_if_fail(main_loop != NULL, NULL); if((thiz = (FtkWndManager*)FTK_ZALLOC(sizeof(FtkWndManager) + sizeof(PrivInfo))) != NULL) { DECL_PRIV(thiz, priv); priv->main_loop = main_loop; priv->long_press_timer = ftk_source_timer_create(1500, (FtkTimer)ftk_wnd_manager_default_long_press, thiz); ftk_set_primary_source(ftk_source_primary_create((FtkOnEvent)ftk_wnd_manager_default_dispatch_event, thiz)); ftk_sources_manager_add(ftk_default_sources_manager(), ftk_primary_source()); thiz->grab = ftk_wnd_manager_default_grab; thiz->ungrab = ftk_wnd_manager_default_ungrab; thiz->add = ftk_wnd_manager_default_add; thiz->remove = ftk_wnd_manager_default_remove; thiz->restack= ftk_wnd_manager_default_restack; thiz->update = ftk_wnd_manager_default_update; thiz->get_work_area = ftk_wnd_manager_default_get_work_area; thiz->queue_event = ftk_wnd_manager_default_queue_event; thiz->dispatch_event = ftk_wnd_manager_default_dispatch_event; thiz->add_global_listener = ftk_wnd_manager_default_add_global_listener; thiz->remove_global_listener = ftk_wnd_manager_default_remove_global_listener; thiz->destroy = ftk_wnd_manager_default_destroy; #ifndef FTK_SUPPORT_C99 key_tanslate_table_init(); #endif } return thiz; }
FtkSource* ftk_source_psp_create(FtkDisplay* display, FtkOnEvent on_event, void* ctx) { FtkSource* thiz = NULL; return_val_if_fail(display != NULL && on_event != NULL, NULL); thiz = (FtkSource*)FTK_ZALLOC(sizeof(FtkSource) + sizeof(PrivInfo)); if(thiz != NULL) { DECL_PRIV(thiz, priv); thiz->get_fd = ftk_source_psp_get_fd; thiz->check = ftk_source_psp_check; thiz->dispatch = ftk_source_psp_dispatch; thiz->destroy = ftk_source_psp_destroy; thiz->ref = 1; priv->ctx = ctx; priv->on_event = on_event; priv->display = display; priv->psp_keypress = 0; } return thiz; }
FtkWidget* ftk_status_panel_create(int size) { FtkWidget* thiz = ftk_window_create(FTK_STATUS_PANEL, 0, 0, 0, size, size); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[1] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz->priv_subclass[1] != NULL) { DECL_PRIV1(thiz, priv); priv->parent_on_event = thiz->on_event; priv->parent_on_paint = thiz->on_paint; priv->parent_destroy = thiz->destroy; thiz->on_event = ftk_status_panel_on_event; thiz->on_paint = ftk_status_panel_on_paint; thiz->destroy = ftk_status_panel_destroy; ftk_widget_set_attr(thiz, FTK_ATTR_BG_TILE | FTK_ATTR_NO_FOCUS); } else { ftk_widget_destroy(thiz); thiz = NULL; } return thiz; }
FtkDisplay* ftk_display_android_create(void) { FtkDisplay* thiz = NULL; thiz = (FtkDisplay*)FTK_ZALLOC(sizeof(FtkDisplay) + sizeof(PrivInfo)); if(thiz != NULL) { FtkColor bg; DECL_PRIV(thiz, priv); thiz->update = ftk_display_android_update; thiz->width = ftk_display_android_width; thiz->height = ftk_display_android_height; thiz->snap = ftk_display_android_snap; thiz->destroy = ftk_display_android_destroy; bg.a = 0xff; bg.r = 0xff; bg.g = 0xff; bg.b = 0xff; priv->bitmap = ftk_bitmap_create(screen_width, screen_height, bg); ftk_wnd_manager_add_global_listener(ftk_default_wnd_manager(), (FtkListener)ftk_display_android_handle_event, thiz); Android_InitEGL(); } return thiz; }
FtkSource* ftk_source_x11_create(FtkDisplay* display, FtkOnEvent on_event, void* ctx) { FtkSource* thiz = NULL; return_val_if_fail(display != NULL && on_event != NULL, NULL); thiz = (FtkSource*)FTK_ZALLOC(sizeof(FtkSource) + sizeof(PrivInfo)); if(thiz != NULL) { DECL_PRIV(thiz, priv); thiz->get_fd = ftk_source_x11_get_fd; thiz->check = ftk_source_x11_check; thiz->dispatch = ftk_source_x11_dispatch; thiz->destroy = ftk_source_x11_destroy; thiz->ref = 1; priv->ctx = ctx; priv->on_event = on_event; priv->display = display; priv->fd = ConnectionNumber(ftk_display_x11_get_xdisplay(display)); priv->win = (Window)ftk_display_x11_get_xwindow(display); XSetErrorHandler(on_x11_error); } return thiz; }
FtkSource* ftk_source_dfb_create(IDirectFB* dfb) { FtkSource* thiz = FTK_ZALLOC(sizeof(FtkSource)+sizeof(PrivInfo)); if(thiz != NULL) { int fd = 0; DECL_PRIV(thiz, priv); IDirectFBEventBuffer* event_buffer = NULL; thiz->get_fd = ftk_source_dfb_get_fd; thiz->check = ftk_source_dfb_check; thiz->dispatch = ftk_source_dfb_dispatch; thiz->destroy = ftk_source_dfb_destroy; dfb->CreateInputEventBuffer( dfb, DICAPS_ALL, DFB_FALSE, &event_buffer ); if(event_buffer != NULL) { event_buffer->CreateFileDescriptor(event_buffer, &fd); } thiz->ref = 1; priv->fd = fd; priv->event_buffer = event_buffer; } return thiz; }
FtkMmap* ftk_mmap_create(const char* filename, size_t offset, size_t size) { size_t n; wchar_t buf[MAX_PATH]; FtkMmap* thiz = NULL; LARGE_INTEGER li; WIN32_FILE_ATTRIBUTE_DATA attr; return_val_if_fail(filename != NULL, NULL); if (MultiByteToWideChar(CP_ACP, 0, filename, -1, buf, MAX_PATH) == 0) { return NULL; } if (!GetFileAttributesExW(buf, GetFileExInfoStandard, &attr)) { return NULL; } li.LowPart = attr.nFileSizeLow; li.HighPart = attr.nFileSizeHigh; n = (size_t) li.QuadPart; /*ftk_logd("%s: %d\n", filename, n);*/ return_val_if_fail(offset < n, NULL); size = (offset + size) <= n ? size : n - offset; thiz = FTK_ZALLOC(sizeof(FtkMmap)); return_val_if_fail(thiz != NULL, NULL); thiz->fp = fopen(filename, "rb"); if(thiz->fp != NULL) { thiz->length = size; thiz->data = FTK_ZALLOC(size+1); fseek(thiz->fp, offset, SEEK_SET); fread(thiz->data, thiz->length, 1, thiz->fp); fclose(thiz->fp); } if(thiz->data == NULL || thiz->data == NULL) { FTK_ZFREE(thiz, sizeof(*thiz)); ftk_logd("%s mmap %s failed.\n", __func__, filename); } return thiz; }
FBusProxy* fbus_proxy_create(const char* service) { Ret ret = RET_FAIL; FBusProxy* thiz = NULL; FBusStream* stream = NULL; FBusServiceInfo info = {0}; return_val_if_fail(service != NULL, NULL); if(strcmp(service, FBUS_SERVICE_MANAGER_NAME) != 0) { FBusServiceManager* service_manager = fbus_proxy_create(FBUS_SERVICE_MANAGER_NAME); if(service_manager != NULL) { ret = fbus_service_manager_start(service_manager, service); if(ret == RET_OK) { int i = 0; for(i = 0; i < 5; i++) { ret = fbus_service_manager_query(service_manager, service, &info); if(ret == RET_OK && info.status == FBUS_SERVICE_STARTED) { break; } if(ret != RET_OK) { usleep(200000); } } } fbus_proxy_destroy(service_manager); } } else { strcpy(info.host, FBUS_LOCALHOST); info.port = FBUS_SERVICE_MANAGER_PORT; } return_val_if_fail(info.port > 0, NULL); stream = fbus_stream_socket_connect(info.host, info.port); return_val_if_fail(stream != NULL, NULL); thiz = FTK_ZALLOC(sizeof(FBusProxy)); if(thiz != NULL) { thiz->stream = stream; } else { fbus_stream_destroy(stream); } return thiz; }
FontData* font_data_create(int char_nr, Encoding encoding) { FontData* thiz = (FontData*)FTK_ZALLOC(sizeof(FontData)); if(thiz != NULL) { thiz->header.version = FONT_VERSION; thiz->header.char_nr = char_nr; thiz->header.encoding = encoding; if(char_nr > 0) { thiz->new_created = 1; thiz->glyphs = (FGlyph*)FTK_ZALLOC(char_nr * sizeof(FGlyph)); } } return thiz; }
FtkImageDecoder* ftk_image_qt_decoder_create(void) { FtkImageDecoder* thiz = (FtkImageDecoder*)FTK_ZALLOC(sizeof(FtkImageDecoder)); if(thiz != NULL) { thiz->match = ftk_image_qt_decoder_match; thiz->decode = ftk_image_qt_decoder_decode; thiz->destroy = ftk_image_qt_decoder_destroy; } return thiz; }
FBusServiceInfos* fbus_service_infos_create(int capacity) { FBusServiceInfos* thiz = FTK_ZALLOC(sizeof(FBusServiceInfos)); if(thiz != NULL) { capacity = capacity < 5 ? 5 : capacity; thiz->service_infos = FTK_ZALLOC(sizeof(FBusServiceInfo) * capacity); if(thiz->service_infos != NULL) { thiz->port = FBUS_SERVICE_PORT_START; thiz->capacity = capacity; } else { FTK_FREE(thiz); } } return thiz; }
Ret ftk_input_pattern_set_text(FtkInputPattern* thiz, const char* text) { return_val_if_fail(thiz != NULL && text != NULL, RET_FAIL); if(thiz->text == NULL) { thiz->text = (char*)FTK_ZALLOC(thiz->max_length + 1); } strncpy(thiz->text, text, thiz->max_length); return RET_OK; }
FtkWidget* ftk_key_board_create(FtkWidget* parent, int x, int y, int width, int height) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz->priv_subclass[0] != NULL) { thiz->on_event = ftk_key_board_on_event; thiz->on_paint = ftk_key_board_on_paint; thiz->destroy = ftk_key_board_destroy; ftk_widget_init(thiz, FTK_KEY_BOARD, 0, x, y, width, height, FTK_ATTR_BG_FOUR_CORNER|FTK_ATTR_NO_FOCUS); ftk_widget_append_child(parent, thiz); } else { FTK_FREE(thiz); } return thiz; }
FtkWidget* ftk_painter_create(FtkWidget* parent, int x, int y, int width, int height) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz->priv_subclass[0] != NULL) { thiz->on_event = ftk_painter_on_event; thiz->on_paint = ftk_painter_on_paint; thiz->destroy = ftk_painter_destroy; ftk_widget_init(thiz, FTK_PAINTER, 0, x, y, width, height, 0); ftk_widget_append_child(parent, thiz); } else { FTK_FREE(thiz); } return thiz; }
static FtkXmlBuilder* ftk_key_board_desc_builder_create(void) { FtkXmlBuilder* thiz = (FtkXmlBuilder*)FTK_ZALLOC(sizeof(FtkXmlBuilder) + sizeof(BuilderInfo)); if(thiz != NULL) { thiz->on_start_element = ftk_key_board_desc_builder_on_start; thiz->on_end_element = ftk_key_board_desc_builder_on_end; thiz->destroy = ftk_key_board_desc_builder_destroy; } return thiz; }
FtkApp* ftk_app_music_create(void) { FtkApp* thiz = FTK_ZALLOC(sizeof(FtkApp) + sizeof(PrivInfo)); if(thiz != NULL) { thiz->run = ftk_app_music_run; thiz->get_icon = ftk_app_music_get_icon; thiz->get_name = ftk_app_music_get_name; thiz->destroy = ftk_app_music_destroy; } return thiz; }
static FtkXmlBuilder* ftk_animation_builder_create(FtkAnimationTrigger* trigger) { FtkXmlBuilder* thiz = (FtkXmlBuilder*)FTK_ZALLOC(sizeof(FtkXmlBuilder) + sizeof(BuilderInfo)); if(thiz != NULL) { BuilderInfo* info = (BuilderInfo*)thiz->priv; info->trigger = trigger; thiz->on_start_element = ftk_animation_builder_on_start; thiz->destroy = ftk_animation_builder_destroy; } return thiz; }
FtkWidget* ftk_image_create(FtkWidget* parent, int x, int y, int width, int height) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->on_event = ftk_image_on_event; thiz->on_paint = ftk_image_on_paint; thiz->destroy = ftk_image_destroy; ftk_widget_init(thiz, FTK_IMAGE, 0, x, y, width, height, FTK_ATTR_INSENSITIVE|FTK_ATTR_TRANSPARENT); ftk_widget_append_child(parent, thiz); return thiz; }
FtkSource* ftk_source_gtk_create(void) { FtkSource* thiz = (FtkSource*)FTK_ZALLOC(sizeof(FtkSource)); if(thiz != NULL) { thiz->get_fd = ftk_source_gtk_get_fd; thiz->check = ftk_source_gtk_check; thiz->dispatch = ftk_source_gtk_dispatch; thiz->destroy = ftk_source_gtk_destroy; thiz->ref = 1; } return thiz; }
FtkWidget* ftk_progress_bar_create(FtkWidget* parent, int x, int y, int width, int height) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz->priv_subclass[0] != NULL) { thiz->on_event = ftk_progress_bar_on_event; thiz->on_paint = ftk_progress_bar_on_paint; thiz->destroy = ftk_progress_bar_destroy; ftk_widget_init(thiz, FTK_PROGRESS_BAR, 0, x, y, width, height, FTK_ATTR_TRANSPARENT|FTK_ATTR_INSENSITIVE); ftk_widget_append_child(parent, thiz); } else { FTK_FREE(thiz); } return thiz; }
FtkSourcesManager* ftk_sources_manager_create(int max_source_nr) { FtkSourcesManager* thiz = NULL; max_source_nr = max_source_nr < FTK_DEFAULT_SOURCE_NR ? FTK_DEFAULT_SOURCE_NR : max_source_nr; thiz = (FtkSourcesManager*)FTK_ZALLOC(sizeof(FtkSourcesManager) + sizeof(FtkSource*)*(max_source_nr + 1)); if(thiz != NULL) { thiz->max_source_nr = max_source_nr; } return thiz; }
FtkWidget* ftk_menu_item_create(FtkWidget* parent) { FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget)); return_val_if_fail(thiz != NULL, NULL); thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo)); if(thiz != NULL) { thiz->on_event = ftk_menu_item_on_event; thiz->on_paint = ftk_menu_item_on_paint; thiz->destroy = ftk_menu_item_destroy; ftk_widget_init(thiz, FTK_MENU_ITEM, 0, 0, 0, 0, 0, FTK_ATTR_TRANSPARENT|FTK_ATTR_BG_FOUR_CORNER); ftk_menu_panel_add(parent, thiz); } else { FTK_FREE(thiz); } return thiz; }
void ftk_widget_init(FtkWidget* thiz, int type, int id) { return_if_fail(thiz != NULL); thiz->ref = 1; thiz->priv = (FtkWidgetInfo*)FTK_ZALLOC(sizeof(FtkWidgetInfo)); if(thiz->priv != NULL) { FtkWidgetInfo* priv = thiz->priv; priv->id = id; priv->type = type; priv->gc[FTK_WIDGET_NORMAL].mask = FTK_GC_BG | FTK_GC_FG | FTK_GC_FONT; priv->gc[FTK_WIDGET_NORMAL].fg.a = 0xff; priv->gc[FTK_WIDGET_NORMAL].fg.r = 0x00; priv->gc[FTK_WIDGET_NORMAL].fg.g = 0x00; priv->gc[FTK_WIDGET_NORMAL].fg.b = 0x00; priv->gc[FTK_WIDGET_NORMAL].font = ftk_default_font(); priv->gc[FTK_WIDGET_NORMAL].bg.a = 0xff; priv->gc[FTK_WIDGET_NORMAL].bg.r = 0xe0; priv->gc[FTK_WIDGET_NORMAL].bg.g = 0xd0; priv->gc[FTK_WIDGET_NORMAL].bg.b = 0xe0; priv->gc[FTK_WIDGET_FOCUSED].mask = FTK_GC_BG | FTK_GC_FG | FTK_GC_FONT; priv->gc[FTK_WIDGET_FOCUSED].fg.a = 0xff; priv->gc[FTK_WIDGET_FOCUSED].fg.r = 0x00; priv->gc[FTK_WIDGET_FOCUSED].fg.g = 0x00; priv->gc[FTK_WIDGET_FOCUSED].fg.b = 0x00; priv->gc[FTK_WIDGET_FOCUSED].font = ftk_default_font(); priv->gc[FTK_WIDGET_FOCUSED].bg.a = 0xff; priv->gc[FTK_WIDGET_FOCUSED].bg.r = 0xe0; priv->gc[FTK_WIDGET_FOCUSED].bg.g = 0xd0; priv->gc[FTK_WIDGET_FOCUSED].bg.b = 0xe0; priv->gc[FTK_WIDGET_INSENSITIVE].mask = FTK_GC_BG | FTK_GC_FG | FTK_GC_FONT; priv->gc[FTK_WIDGET_INSENSITIVE].fg.a = 0xff; priv->gc[FTK_WIDGET_INSENSITIVE].fg.r = 0x00; priv->gc[FTK_WIDGET_INSENSITIVE].fg.g = 0x00; priv->gc[FTK_WIDGET_INSENSITIVE].fg.b = 0x00; priv->gc[FTK_WIDGET_INSENSITIVE].font = ftk_default_font(); priv->gc[FTK_WIDGET_INSENSITIVE].bg.a = 0xff; priv->gc[FTK_WIDGET_INSENSITIVE].bg.r = 0xe0; priv->gc[FTK_WIDGET_INSENSITIVE].bg.g = 0xd0; priv->gc[FTK_WIDGET_INSENSITIVE].bg.b = 0xe0; } return; }