/** * @param b: the border container to initialize * @return Returns TRUE on success, FALSE on failure. * @brief Initialize a border container to default values */ int ewl_border_init(Ewl_Border *b) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(b, FALSE); w = EWL_WIDGET(b); if (!ewl_box_init(EWL_BOX(w))) { DRETURN_INT(FALSE, DLEVEL_STABLE); } ewl_box_orientation_set(EWL_BOX(w), EWL_ORIENTATION_VERTICAL); ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL); ewl_widget_appearance_set(EWL_WIDGET(b), EWL_BORDER_TYPE); ewl_widget_inherit(EWL_WIDGET(b), EWL_BORDER_TYPE); b->label = ewl_label_new(); ewl_widget_internal_set(b->label, TRUE); ewl_container_child_append(EWL_CONTAINER(b), b->label); ewl_widget_show(b->label); b->body = ewl_vbox_new(); ewl_widget_internal_set(b->body, TRUE); ewl_container_child_append(EWL_CONTAINER(b), b->body); ewl_widget_show(b->body); b->label_position = EWL_POSITION_TOP; ewl_container_redirect_set(EWL_CONTAINER(b), EWL_CONTAINER(b->body)); DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param e: The entry to clear the selection of * @return Returns TRUE if a selection was cleared, FALSE otherwise. * @brief Clear the current selection in the entry */ unsigned int ewl_entry_selection_clear(Ewl_Entry *e) { Ewl_Text_Trigger *sel; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(e, FALSE); DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, FALSE); sel = EWL_TEXT_TRIGGER(ewl_text_selection_get(EWL_TEXT(e))); if (sel) { unsigned int len, pos; len = ewl_text_trigger_length_get(sel); pos = ewl_text_trigger_start_pos_get(sel); ewl_text_cursor_position_set(EWL_TEXT(e), pos); ewl_text_text_delete(EWL_TEXT(e), len); /* remove the selection */ ewl_text_trigger_length_set(sel, 0); DRETURN_INT(TRUE, DLEVEL_STABLE); } DRETURN_INT(FALSE, DLEVEL_STABLE); }
/** * @param w: the overlay to be initialized to default values and callbacks * @return Returns TRUE or FALSE depending on if initialization succeeds. * @brief initialize a overlay to default values and callbacks * * Sets the values and callbacks of a overlay @a w to their defaults. */ int ewl_overlay_init(Ewl_Overlay *w) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(w, FALSE); /* * Initialize the fields of the inherited container class */ if (!ewl_container_init(EWL_CONTAINER(w))) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_widget_appearance_set(EWL_WIDGET(w), EWL_OVERLAY_TYPE); ewl_widget_inherit(EWL_WIDGET(w), EWL_OVERLAY_TYPE); ewl_container_show_notify_set(EWL_CONTAINER(w), ewl_overlay_cb_child_show); ewl_container_resize_notify_set(EWL_CONTAINER(w), ewl_overlay_cb_child_resize); ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE); /* * Override the default configure callbacks since the overlay * has special needs for placement. */ ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE, ewl_overlay_cb_configure, NULL); DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param s: the separator to initialize * @return Returns TRUE on success, FALSE on failure. * @brief Initialize the separator and inherited fields * * Clears the contents of the separator and stores the * default values. */ int ewl_separator_init(Ewl_Separator *s) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(s, FALSE); w = EWL_WIDGET(s); if (!ewl_widget_init(w)) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_widget_inherit(w, EWL_SEPARATOR_TYPE); ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator"); ewl_object_fill_policy_set(EWL_OBJECT(s), EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_SHRINKABLE); ewl_object_alignment_set(EWL_OBJECT(s), EWL_FLAG_ALIGN_LEFT); s->orientation = EWL_ORIENTATION_HORIZONTAL; ewl_widget_focusable_set(w, FALSE); DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param p: the popup to initialize * @return Returns TRUE on success, FALSE on failure. * @brief Initialize the popup and inherited fields * * Clears the contents of the popup and stores the * default values. */ int ewl_popup_init(Ewl_Popup *p) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(p, FALSE); w = EWL_WIDGET(p); if (!ewl_window_init(EWL_WINDOW(w))) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_widget_inherit(w, EWL_POPUP_TYPE); ewl_widget_appearance_set(w, EWL_POPUP_TYPE); ewl_object_fill_policy_set(EWL_OBJECT(p), EWL_FLAG_FILL_NONE); ewl_window_override_set(EWL_WINDOW(p), TRUE); ewl_container_show_notify_set(EWL_CONTAINER(p), ewl_popup_cb_child_show); ewl_container_resize_notify_set(EWL_CONTAINER(p), ewl_popup_cb_child_resize); /* * add the callbacks */ ewl_callback_append(w, EWL_CALLBACK_SHOW, ewl_popup_cb_show, NULL); ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_popup_cb_show, NULL); ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, ewl_popup_cb_mouse_move, NULL); ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_popup_cb_destroy, NULL); DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param t: the toolbar to initialize * @return Returns TRUE on success, FALSE on failure. * @brief Initialize the toolbar and inherited fields * * Clears the contents of the toolbar and stores the * default values. */ int ewl_toolbar_init(Ewl_Toolbar *t) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(t, FALSE); w = EWL_WIDGET(t); if (!ewl_menubar_init(EWL_MENUBAR(t))) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_widget_inherit(w, EWL_TOOLBAR_TYPE); ewl_widget_appearance_set(w, "htoolbar"); ewl_object_fill_policy_set(EWL_OBJECT(t), EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_SHRINKABLE); ewl_object_alignment_set(EWL_OBJECT(t), EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP); ewl_container_add_notify_set(EWL_CONTAINER(EWL_MENUBAR(t)->inner_box), ewl_toolbar_cb_child_add); t->hidden = EWL_ICON_PART_NONE; DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @brief Cleanup internal data structures used by ewl. * * This should be called to cleanup internal EWL data structures, if using * ecore directly rather than using ewl_main(). */ int ewl_shutdown(void) { Ewl_Shutdown_Hook hook; void (*shutdown)(void); DENTER_FUNCTION(DLEVEL_STABLE); if (--ewl_init_count) DRETURN_INT(ewl_init_count, DLEVEL_STABLE); while ((hook = ecore_list_first_remove(shutdown_hooks))) hook(); IF_FREE_LIST(shutdown_hooks); /* * Destroy all existing widgets. */ if (ewl_embed_list) { Ewl_Widget *emb; while ((emb = ecore_list_first_remove(ewl_embed_list))) ewl_widget_destroy(emb); while (ewl_garbage_collect_idler(NULL) > 0) ; IF_FREE_LIST(ewl_embed_list); } if (idle_enterer) { ecore_idle_enterer_del(idle_enterer); idle_enterer = NULL; } /* * Free internal accounting lists. */ IF_FREE_LIST(ewl_window_list); IF_FREE_LIST(reveal_list); IF_FREE_LIST(obscure_list); IF_FREE_LIST(configure_active); IF_FREE_LIST(configure_available); IF_FREE_LIST(realize_list); IF_FREE_LIST(destroy_list); IF_FREE_LIST(free_evas_list); IF_FREE_LIST(free_evas_object_list); IF_FREE_LIST(child_add_list); /* shutdown all the subsystems */ while ((shutdown = ecore_list_first_remove(shutdown_queue))) shutdown(); IF_FREE_LIST(shutdown_queue); DRETURN_INT(ewl_init_count, DLEVEL_STABLE); }
/** * @param sp: The Ewl_Spectrum to init * @return Returns TRUE on success or FALSE on failure * @brief Initializes an Ewl_Specturm widget to default values */ int ewl_spectrum_init(Ewl_Spectrum *sp) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(sp, FALSE); if (!ewl_container_init(EWL_CONTAINER(sp))) { DRETURN_INT(FALSE, DLEVEL_STABLE); } ewl_widget_appearance_set(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE); ewl_widget_inherit(EWL_WIDGET(sp), EWL_SPECTRUM_TYPE); ewl_object_fill_policy_set(EWL_OBJECT(sp), EWL_FLAG_FILL_FILL); ewl_container_callback_intercept(EWL_CONTAINER(sp), EWL_CALLBACK_MOUSE_MOVE); ewl_container_callback_intercept(EWL_CONTAINER(sp), EWL_CALLBACK_MOUSE_DOWN); ewl_container_callback_intercept(EWL_CONTAINER(sp), EWL_CALLBACK_MOUSE_UP); ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_DOWN, ewl_spectrum_cb_mouse_down, NULL); ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_MOUSE_UP, ewl_spectrum_cb_mouse_up, NULL); sp->type = EWL_SPECTRUM_TYPE_SQUARE; /* create the canvas */ sp->canvas = ewl_image_new(); ewl_container_child_append(EWL_CONTAINER(sp), sp->canvas); ewl_object_fill_policy_set(EWL_OBJECT(sp->canvas), EWL_FLAG_FILL_FILL); ewl_widget_internal_set(sp->canvas, TRUE); ewl_callback_append(EWL_WIDGET(sp->canvas), EWL_CALLBACK_REVEAL, ewl_spectrum_canvas_cb_reveal, sp); ewl_widget_show(sp->canvas); /* create the cross hairs to draw on the spectrum */ sp->cross_hairs.horizontal = ewl_hseparator_new(); ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.horizontal); ewl_widget_internal_set(sp->cross_hairs.horizontal, TRUE); ewl_widget_layer_priority_set(sp->cross_hairs.horizontal, 1); sp->cross_hairs.vertical = ewl_vseparator_new(); ewl_container_child_append(EWL_CONTAINER(sp), sp->cross_hairs.vertical); ewl_widget_internal_set(sp->cross_hairs.vertical, TRUE); ewl_widget_layer_priority_set(sp->cross_hairs.vertical, 1); ewl_callback_append(EWL_WIDGET(sp), EWL_CALLBACK_CONFIGURE, ewl_spectrum_cb_configure, NULL); ewl_spectrum_rgb_set(sp, 255, 255, 255); DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param dvi: the dvi widget to change the displayed dvi * @param filename: the path to the new dvi to be displayed by @a dvi * @return Returns no value. * @brief Change the dvi file displayed by an dvi widget * * Set the dvi displayed by @a dvi to the one found at the path @a filename. If an * edje is used, a minimum size should be specified in the edje or the code. */ int ewl_dvi_file_set(Ewl_Dvi *dvi, const char *filename) { Ewl_Widget *w; Ewl_Embed *emb; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(dvi, FALSE); DCHECK_TYPE(dvi, EWL_DVI_TYPE); w = EWL_WIDGET(dvi); emb = ewl_embed_widget_find(w); if (!filename || (filename[0] == '\0')) DRETURN_INT(FALSE, DLEVEL_STABLE); if (dvi->filename != filename) { IF_FREE(dvi->filename); } if (dvi->dvi_page) { edvi_page_delete(dvi->dvi_page); dvi->dvi_page = NULL; } if (dvi->dvi_document) { edvi_document_delete(dvi->dvi_document); dvi->dvi_document = NULL; } dvi->filename = strdup(filename); /* * Load the new dvi if widget has been realized */ dvi->dvi_document = edvi_document_new(dvi->filename, dvi->dvi_device, dvi->dvi_property); if (!dvi->dvi_document) DRETURN_INT(FALSE, DLEVEL_STABLE); dvi->dvi_page = edvi_page_new(dvi->dvi_document); if (!dvi->dvi_page) { edvi_document_delete(dvi->dvi_document); dvi->dvi_document = NULL; DRETURN_INT(FALSE, DLEVEL_STABLE); } if (REALIZED(w)) { ewl_widget_obscure(w); ewl_widget_reveal(w); } DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param dvi: the dvi widget to get the orientation of * @return Returns the orientation of the document. * @brief get the orientation of the document @p dvi. If @p dvi * is NULL, return EDVI_PAGE_ORIENTATION_PORTRAIT */ Edvi_Page_Orientation ewl_dvi_orientation_get(Ewl_Dvi *dvi) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(dvi, EDVI_PAGE_ORIENTATION_PORTRAIT); DCHECK_TYPE_RET(dvi, EWL_DVI_TYPE, EDVI_PAGE_ORIENTATION_PORTRAIT); if (!dvi->dvi_page) DRETURN_INT(EDVI_PAGE_ORIENTATION_PORTRAIT, DLEVEL_STABLE); DRETURN_INT(edvi_page_orientation_get(dvi->dvi_page), DLEVEL_STABLE); }
/** * @param pdf: the pdf widget to get the orientation of * @return Returns the orientation of the document. * @brief get the orientation of the document @p pdf. If @p pdf * is NULL, return EPDF_PAGE_ORIENTATION_PORTRAIT */ Epdf_Page_Orientation ewl_pdf_orientation_get(Ewl_Pdf *pdf) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(pdf, EPDF_PAGE_ORIENTATION_PORTRAIT); DCHECK_TYPE_RET(pdf, EWL_PDF_TYPE, EPDF_PAGE_ORIENTATION_PORTRAIT); if (!pdf->pdf_page) DRETURN_INT(EPDF_PAGE_ORIENTATION_PORTRAIT, DLEVEL_STABLE); DRETURN_INT(epdf_page_orientation_get(pdf->pdf_page), DLEVEL_STABLE); }
/** * @param pdf the pdf widget to get the page of * @return Returns the currently set page * @brief get the page this pdf uses */ int ewl_pdf_page_get(Ewl_Pdf *pdf) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(pdf, 0); DCHECK_TYPE_RET(pdf, EWL_PDF_TYPE, 0); if (!pdf->pdf_page) DRETURN_INT(0, DLEVEL_STABLE); DRETURN_INT(epdf_page_page_get(pdf->pdf_page), DLEVEL_STABLE); }
/** * @param ps: the ps widget to get the orientation of * @return Returns the orientation of the document. * @brief get the orientation of the document @p ps. If @p ps * is NULL, return EPS_PAGE_ORIENTATION_PORTRAIT */ Eps_Page_Orientation ewl_ps_orientation_get(Ewl_Ps *ps) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(ps, EPS_PAGE_ORIENTATION_PORTRAIT); DCHECK_TYPE_RET(ps, EWL_PS_TYPE, EPS_PAGE_ORIENTATION_PORTRAIT); if (!ps->ps_page) DRETURN_INT(EPS_PAGE_ORIENTATION_PORTRAIT, DLEVEL_STABLE); DRETURN_INT(eps_page_orientation_get(ps->ps_page), DLEVEL_STABLE); }
/** * @param ps: the ps widget to get the page of * @return Returns the currently set page * @brief get the page this ps uses */ int ewl_ps_page_get(Ewl_Ps *ps) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(ps, 0); DCHECK_TYPE_RET(ps, EWL_PS_TYPE, 0); if (!ps->ps_page) DRETURN_INT(0, DLEVEL_STABLE); DRETURN_INT(eps_page_page_get(ps->ps_page), DLEVEL_STABLE); }
/** * @param dvi: the dvi widget to get the page of * @return Returns the currently set page * @brief get the page this dvi uses */ int ewl_dvi_page_get(Ewl_Dvi *dvi) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(dvi, 0); DCHECK_TYPE_RET(dvi, EWL_DVI_TYPE, 0); if (!dvi->dvi_page) DRETURN_INT(0, DLEVEL_STABLE); DRETURN_INT(edvi_page_page_get(dvi->dvi_page), DLEVEL_STABLE); }
/** * @param ps: the ps widget to change the displayed ps * @param filename: the path to the new postscript file to be displayed by @a ps * @return 0 on failure, 1 otherwise. * @brief Change the postscript file displayed by a ps widget * * Set the postscript file displayed by @a ps to the one found at the path * @a filename. */ int ewl_ps_file_set(Ewl_Ps *ps, const char *filename) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(ps, FALSE); DCHECK_TYPE(ps, EWL_PS_TYPE); w = EWL_WIDGET(ps); if (ps->filename != filename) { IF_FREE(ps->filename); } if (!filename || (filename[0] == '\0')) DRETURN_INT(FALSE, DLEVEL_STABLE); if (ps->ps_page) { eps_page_delete(ps->ps_page); ps->ps_page = NULL; } if (ps->ps_document) { eps_document_delete(ps->ps_document); ps->ps_document = NULL; } ps->filename = strdup(filename); /* * Load the new Postscript document */ ps->ps_document = eps_document_new(filename); if (!ps->ps_document) DRETURN_INT(FALSE, DLEVEL_STABLE); ps->ps_page = eps_page_new(ps->ps_document); if (!ps->ps_page) { eps_document_delete(ps->ps_document); ps->ps_document = NULL; DRETURN_INT(FALSE, DLEVEL_STABLE); } if (REALIZED(w)) { ewl_widget_unrealize(w); ewl_widget_reveal(w); } DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param pdf the pdf widget to initialize * @return Returns no value. * @brief Initialize an pdf widget to default values and callbacks * * Sets the fields and callbacks of @a pdf to their default values. */ int ewl_pdf_init(Ewl_Pdf *pdf) { Ewl_Widget *w; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(pdf, FALSE); if (!epdf_init()) DRETURN_INT(FALSE, DLEVEL_STABLE); w = EWL_WIDGET(pdf); if (!ewl_widget_init(w)) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_widget_appearance_set(w, EWL_PDF_TYPE); ewl_widget_inherit(w, EWL_PDF_TYPE); ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE); /* * Append necessary callbacks. */ ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_pdf_configure_cb, NULL); ewl_callback_append(w, EWL_CALLBACK_REVEAL, ewl_pdf_reveal_cb, NULL); ewl_callback_append(w, EWL_CALLBACK_OBSCURE, ewl_pdf_obscure_cb, NULL); ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_pdf_destroy_cb, NULL); pdf->filename = NULL; pdf->pdf_document = NULL; pdf->pdf_page = NULL; pdf->pdf_index = NULL; pdf->dirty = 1; pdf->search.o = NULL; pdf->search.text = NULL; pdf->search.list = NULL; pdf->search.page = -1; pdf->search.is_case_sensitive = FALSE; pdf->search.is_circular = FALSE; DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param dvi: the dvi widget to get the orientation of * @return Returns the magnification. * @brief get the magnification of the document @p dvi. If @p dvi * is NULL, their values are 1.0 */ double ewl_dvi_mag_get(Ewl_Dvi *dvi) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(dvi, 1.0); DCHECK_TYPE_RET(dvi, EWL_DVI_TYPE, 1.0); if (!dvi->dvi_page) { DRETURN_INT(1.0, DLEVEL_STABLE); } DRETURN_INT(edvi_page_mag_get(dvi->dvi_page), DLEVEL_STABLE); }
/** * @param n: The Ewl_Notebook widget to initialize * @return Returns TRUE on success or NULL on failure. * @brief Initialize a notebook to default values and callbacks */ int ewl_notebook_init(Ewl_Notebook *n) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(n, FALSE); if (!ewl_box_init(EWL_BOX(n))) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_box_orientation_set(EWL_BOX(n), EWL_ORIENTATION_VERTICAL); ewl_widget_appearance_set(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE); ewl_widget_inherit(EWL_WIDGET(n), EWL_NOTEBOOK_TYPE); n->tabbar_position = EWL_POSITION_TOP; n->body.tabbar = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(n), n->body.tabbar); ewl_object_fill_policy_set(EWL_OBJECT(n->body.tabbar), EWL_FLAG_FILL_NONE); ewl_object_alignment_set(EWL_OBJECT(n->body.tabbar), EWL_FLAG_ALIGN_CENTER); ewl_widget_internal_set(n->body.tabbar, TRUE); ewl_widget_appearance_set(n->body.tabbar, "top/tabbar"); ewl_widget_show(n->body.tabbar); n->body.pages = ewl_vbox_new(); ewl_object_fill_policy_set(EWL_OBJECT(n->body.pages), EWL_FLAG_FILL_ALL); ewl_container_child_append(EWL_CONTAINER(n), n->body.pages); ewl_widget_internal_set(n->body.pages, TRUE); ewl_widget_layer_priority_set(n->body.pages, -1); ewl_widget_appearance_set(n->body.pages, "pages"); ewl_widget_show(n->body.pages); ewl_container_redirect_set(EWL_CONTAINER(n), EWL_CONTAINER(n->body.pages)); ewl_container_show_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_show); ewl_container_hide_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_hide); ewl_container_add_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_add); ewl_container_remove_notify_set(EWL_CONTAINER(n->body.pages), ewl_notebook_cb_child_remove); DRETURN_INT(TRUE, DLEVEL_STABLE); }
static unsigned int ewl_text_context_hash_key(const void *ctx) { unsigned int key; const Ewl_Text_Context *tx = ctx; DENTER_FUNCTION(DLEVEL_STABLE); key = 0; if (tx->font) key ^= ecore_str_hash(tx->font); if (tx->font_source) key ^= ecore_str_hash(tx->font_source); key ^= (tx->size << 5); key ^= (tx->styles << 7); /* FIXME: we need to add align and wrap, to prevent degenerate * hash values */ #define COLOR_HASH(c) (c.r << 24 | c.g << 16 | c.b << 8 | c.a) key ^= COLOR_HASH(tx->color); key ^= (COLOR_HASH(tx->style_colors.bg) << 1); key ^= (COLOR_HASH(tx->style_colors.glow) >> 1); key ^= (COLOR_HASH(tx->style_colors.outline) << 3); key ^= (COLOR_HASH(tx->style_colors.shadow) >> 3); key ^= (COLOR_HASH(tx->style_colors.strikethrough) << 5); key ^= (COLOR_HASH(tx->style_colors.underline) >> 5); key ^= (COLOR_HASH(tx->style_colors.double_underline) << 7); DRETURN_INT(key, DLEVEL_STABLE); }
int ewl_io_manager_plugin_uri_write(Ewl_Widget *data, const char *uri) { FILE *file; int ret = FALSE; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(data, FALSE); DCHECK_PARAM_PTR_RET(uri, FALSE); DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE); file = fopen(uri, "w"); if (file) { char *txt; txt = ewl_text_text_get(EWL_TEXT(data)); fwrite(txt, sizeof(char), strlen(txt), file); FREE(txt); fclose(file); ret = TRUE; } DRETURN_INT(ret, DLEVEL_STABLE); }
/** * @param menu: the menu to initialize * @return Returns no value. * @brief Initialize an internal menu to starting values */ int ewl_menu_init(Ewl_Menu *menu) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(menu, FALSE); /* * Initialize the defaults of the inherited fields. */ if (!ewl_menu_item_init(EWL_MENU_ITEM(menu))) DRETURN_INT(FALSE, DLEVEL_STABLE); ewl_widget_appearance_set(EWL_WIDGET(menu), "menu_container"); ewl_widget_inherit(EWL_WIDGET(menu), EWL_MENU_TYPE); /* * add the callbacks */ ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_MOUSE_MOVE, ewl_menu_cb_mouse_move, NULL); ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_FOCUS_IN, ewl_menu_cb_expand, NULL); ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CLICKED, ewl_menu_cb_expand, NULL); ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CONFIGURE, ewl_menu_cb_configure, NULL); ewl_callback_prepend(EWL_WIDGET(menu), EWL_CALLBACK_DESTROY, ewl_menu_cb_destroy, NULL); /* * Create the popup menu portion of the widget. */ menu->popup = ewl_context_menu_new(); ewl_popup_follow_set(EWL_POPUP(menu->popup), EWL_WIDGET(menu)); ewl_popup_type_set(EWL_POPUP(menu->popup), EWL_POPUP_TYPE_MENU_VERTICAL); ewl_widget_internal_set(menu->popup, TRUE); ewl_widget_appearance_set(EWL_WIDGET(menu->popup), EWL_MENU_TYPE); /* redirect the menu container to the popup menu */ ewl_container_redirect_set(EWL_CONTAINER(menu), EWL_CONTAINER(menu->popup)); ewl_callback_prepend(menu->popup, EWL_CALLBACK_DESTROY, ewl_menu_cb_popup_destroy, menu); DRETURN_INT(TRUE, DLEVEL_STABLE); }
static int ewl_io_manager_strcasecompare(const void *key1, const void *key2) { DENTER_FUNCTION(DLEVEL_STABLE); if (!key1 || !key2) { DRETURN_INT(ecore_direct_compare(key1, key2), DLEVEL_STABLE); } else if (key1 == key2) { DRETURN_INT(0, DLEVEL_STABLE); } DRETURN_INT(strcasecmp((const char *)key1, (const char *)key2), DLEVEL_STABLE); }
/** * @param view: The Ewl_View to initialize * @return Returns TRUEE on success or FALSE on failure * @brief Initializes an Ewl_View object to default values */ int ewl_view_init(Ewl_View *view) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(view, FALSE); DRETURN_INT(TRUE, DLEVEL_STABLE); }
/** * @param sp: The Ewl_Spectrum to get the mode from * @return Returns the mode of the spectrum * @brief Get the mode of the spectrum */ Ewl_Color_Mode ewl_spectrum_mode_get(Ewl_Spectrum *sp) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(sp, EWL_COLOR_MODE_HSV_HUE); DCHECK_TYPE_RET(sp, EWL_SPECTRUM_TYPE, EWL_COLOR_MODE_HSV_HUE); DRETURN_INT(sp->mode, DLEVEL_STABLE); }
/** * @param sp: The Ewl_Spectrum to get the type from * @return Returns the spectrum type * @brief Get the type of the spectrum */ Ewl_Spectrum_Type ewl_spectrum_type_get(Ewl_Spectrum *sp) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(sp, EWL_SPECTRUM_TYPE_SQUARE); DCHECK_TYPE_RET(sp, EWL_SPECTRUM_TYPE, EWL_SPECTRUM_TYPE_SQUARE); DRETURN_INT(sp->type, DLEVEL_STABLE); }
/** * @param t: The toolbar to get the hidden part * @return Returns the hidden icon part * @brief Retrieve the hidden part */ Ewl_Icon_Part ewl_toolbar_icon_part_hidden_get(Ewl_Toolbar *t) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(t, EWL_ICON_PART_NONE); DCHECK_TYPE_RET(t, EWL_TOOLBAR_TYPE, EWL_ICON_PART_NONE); DRETURN_INT(t->hidden, DLEVEL_STABLE); }
/** * @param t: The toolbar to get the orientation from * @return Returns the orientation currently set on the toolbar * @brief This retrieves the current orientation of the toolbar */ Ewl_Orientation ewl_toolbar_orientation_get(Ewl_Toolbar *t) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(t, EWL_ORIENTATION_HORIZONTAL); DCHECK_TYPE_RET(t, EWL_TOOLBAR_TYPE, EWL_ORIENTATION_HORIZONTAL); DRETURN_INT(ewl_menubar_orientation_get(EWL_MENUBAR(t)), DLEVEL_STABLE); }
/** * @param s: The scrollport to work with * @return Returns the current frames per second * brief Gets the times per second the timer used for scrolling will be called */ int ewl_scrollport_kinetic_fps_get(Ewl_Scrollport *s) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(s, -1); DCHECK_TYPE_RET(s, EWL_SCROLLPORT_TYPE, -1); DRETURN_INT(s->kinfo->fps, DLEVEL_STABLE); }
/** * @param s: The scrollport to work with * @return Returns the minimum velocity * @brief Gets the minimum velocity for kinetic scrolling */ double ewl_scrollport_kinetic_min_velocity_get(Ewl_Scrollport *s) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(s, -1); DCHECK_TYPE_RET(s, EWL_SCROLLPORT_TYPE, -1); DRETURN_INT(s->kinfo->vmin, DLEVEL_STABLE); }