Ewl_Widget *
ewl_io_manager_plugin_uri_read(const char *uri)
{
        Ewl_Widget *ret = NULL;
        FILE *file;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(uri, NULL);

        if (!key1)
                setup_hash();


        file = fopen(uri, "r");
        if (file)
        {
                struct stat buf;
                char *str;

                ret = ewl_text_new();
                ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");

                stat(uri, &buf);
                str = malloc(sizeof(char) * (buf.st_size + 1));
                fread(str, buf.st_size, 1, file);
                str[buf.st_size] = '\0';
                fclose(file);

                text_set(EWL_TEXT(ret), str);
                FREE(str);
        }

        DRETURN_PTR(ret, 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);
}
示例#3
0
/**
 * @param win: window to set transient
 * @param forwin: the window to be transient for
 * @return Returns no value.
 * @brief Sets a window to be transient for another window.
 */
void
ewl_window_transient_for(Ewl_Window *win, Ewl_Window *forwin)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(win);
        DCHECK_TYPE(win, EWL_WINDOW_TYPE);
        DCHECK_TYPE(forwin, EWL_WINDOW_TYPE);

        win->transient.ewl = forwin;
        win->flags &= ~EWL_WINDOW_TRANSIENT_FOREIGN;

        /* if there is no forwin remove the transient for state
         * and update the window, if it already exists */
        if (!forwin) {
                win->flags &= ~EWL_WINDOW_TRANSIENT;
                if (win->window)
                        ewl_engine_window_transient_for(win);

                DRETURN(DLEVEL_STABLE);
        }

        win->flags |= EWL_WINDOW_TRANSIENT;

        if (win->window) {
                if (forwin->window)
                        ewl_engine_window_transient_for(win);
                else
                        ewl_callback_append(EWL_WIDGET(forwin),
                                            EWL_CALLBACK_REALIZE,
                                            ewl_window_cb_realize_parent,
                                            win);
        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#4
0
/**
 * @param uri: The URI to read
 * @return Returns a widget displaying the URI contents or NULL on error
 * @brief Creates a widget to display the URI contents. Returns NULL on error
 */
Ewl_Widget *
ewl_io_manager_uri_read(const char *uri)
{
        Ewl_Widget *ret = NULL;
        Ewl_IO_Manager_Plugin *plugin = NULL;
        const char *mime;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(uri, NULL);

        mime = ewl_io_manager_uri_mime_type_get(uri);
        if (!mime)
        {
                DWARNING("Unable to determine mime type for %s.", uri);
                DRETURN_PTR(NULL, DLEVEL_STABLE);
        }

        plugin = ewl_io_manager_plugin_get(mime);
        if (!plugin)
        {
                DWARNING("No plugin available to read mime type: %s.", mime);
                DRETURN_PTR(NULL, DLEVEL_STABLE);
        }

        ret = plugin->uri_read(uri);

        DRETURN_PTR(ret, DLEVEL_STABLE);
}
示例#5
0
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);
}
示例#6
0
/**
 * @param sp: The Ewl_Spectrum to set the hsv value into
 * @param h: The hue to set
 * @param s: The saturation to set
 * @param v: The value to set
 * @return Returns no value
 * @brief Set the HSV values for the spectrum
 */
void
ewl_spectrum_hsv_set(Ewl_Spectrum *sp, double h, double s, double v)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(sp);
        DCHECK_TYPE(sp, EWL_SPECTRUM_TYPE);

        sp->hsv.h = h;
        sp->hsv.s = s;
        sp->hsv.v = v;

        if (sp->hsv.h > 360) sp->hsv.h = 360.0;
        if (sp->hsv.h <= 0) sp->hsv.h = 360.0;

        if (sp->hsv.s > 1.0) sp->hsv.s = 1.0;
        if (sp->hsv.s < 0.0) sp->hsv.s = 0.0;

        if (sp->hsv.v > 1.0) sp->hsv.v = 1.0;
        if (sp->hsv.v < 0.0) sp->hsv.v = 0.0;

        ewl_spectrum_rgb_from_hsv(sp);
        sp->dirty = TRUE;
        ewl_widget_configure(EWL_WIDGET(sp));

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#7
0
/**
 * @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);
}
示例#8
0
/**
 * @internal
 * @param tx: The context to print
 * @param indent: The indent level to use
 * @return Returns no value
 * @brief Prints out the context information
 **/
void
ewl_text_context_print(Ewl_Text_Context *tx, const char *indent)
{
        const char *t, *s;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(tx);

        if (!tx->font) t = "";
        else t = tx->font;

        if (!tx->font_source) s = "";
        else s = tx->font_source;

        printf("%sfont: %s (source: %s)\n"
                "%ssize %d\n"
                "%sstyle %d\n"
                "%salign %d\n"
                "%swrap %d\n"
                "%sred %d\n"
                "%sgreen %d\n"
                "%sblue %d\n"
                "%salpha %d",
                        indent, t, s, indent, tx->size, indent,
                        tx->styles, indent, tx->align,
                        indent, tx->wrap, indent, tx->color.r,
                        indent, tx->color.g, indent, tx->color.b,
                        indent, tx->color.a);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#9
0
/**
 * @internal
 * @param c: The container to work with
 * @param w: The widget to work with
 * @return Returns no value
 * @brief The child add callback
 */
void
ewl_notebook_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
{
        Ewl_Notebook *n;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(c);
        DCHECK_PARAM_PTR(w);
        DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
        DCHECK_TYPE(w, EWL_WIDGET_TYPE);

        n = EWL_NOTEBOOK(EWL_WIDGET(c)->parent);

        /* stick a null tab in there so that it at least shows up */
        ewl_notebook_page_tab_widget_set(n, w, NULL);

        /* we have no current page, make it this one */
        if (!n->cur_page)
        {
                ewl_notebook_visible_page_set(n, w);
                ewl_widget_show(w);
        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
 * @internal
 * @param w: The widget to work with
 * @ev_data: The Ewl_Event_Mouse_Down data
 * @param data: The scrollport
 * @return Returns no value
 * @brief The mouse down function for kinetic scrolling
 */
static void
ewl_scrollport_kinetic_cb_mouse_down_embedded(Ewl_Widget *w, void *ev,
                void *data)
{
        Ewl_Scrollport *s;
        Ewl_Event_Mouse *md;
        Ewl_Scrollport_Kinetic_Info_Embedded *info;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(ev);
        DCHECK_PARAM_PTR(data);
        DCHECK_TYPE(w, EWL_WIDGET_TYPE);

        s = EWL_SCROLLPORT(data);
        md = EWL_EVENT_MOUSE(ev);
        info = s->kinfo->extra;
        s->kinfo->clicked = !!TRUE;
        s->kinfo->active = !!FALSE;

        memset(&(info->back[0]), 0, sizeof(info->back[0]) * HIST_NUM);
        info->back[0].x = md->x;
        info->back[0].y = md->y;
        info->back[0].time = ecore_time_get();
        info->xs = md->x;
        info->ys = md->y;

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#11
0
/**
 * @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);
}
示例#12
0
/**
 * @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);
}
示例#13
0
/**
 * @param menu: the menu to work with
 * @return Returns no value
 * @brief Expand the popup portion of the menu
 */
void
ewl_menu_expand(Ewl_Menu *menu)
{
        Ewl_Menu_Item *item;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(menu);
        DCHECK_TYPE(menu, EWL_MENU_TYPE);

        item = EWL_MENU_ITEM(menu);

        /* nothing to do if the popup is already visible */
        if (VISIBLE(menu->popup))
                DRETURN(DLEVEL_STABLE);

        ewl_widget_show(menu->popup);
        ewl_window_raise(EWL_WINDOW(menu->popup));

        if (item->inmenu) {
                Ewl_Context_Menu *cm;

                cm = EWL_CONTEXT_MENU(item->inmenu);
                cm->open_menu = EWL_WIDGET(menu);
        }
        else
                ewl_widget_focus_send(menu->popup);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#14
0
/**
 * @param p: The popup to set the follow widget
 * @param w: The widget to follow
 * @return Returns no value
 * @brief Set the follow widget of the popup
 */
void
ewl_popup_follow_set(Ewl_Popup *p, Ewl_Widget *w)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(p);
        DCHECK_TYPE(p, EWL_POPUP_TYPE);

        if (p->follow == w)
                DRETURN(DLEVEL_STABLE);

        if (p->follow) {
                ewl_callback_del_with_data(p->follow, EWL_CALLBACK_DESTROY,
                                                ewl_popup_cb_follow_destroy, p);
                ewl_callback_del_with_data(p->follow, EWL_CALLBACK_CONFIGURE,
                                                ewl_popup_cb_follow_configure,
                                                p);
        }

        if (w) {
                ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
                                        ewl_popup_cb_follow_destroy, p);
                ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
                                        ewl_popup_cb_follow_configure, p);
        }

        p->follow = w;

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#15
0
static const char *
ewl_icon_theme_icon_path_get_helper(const char *icon, unsigned int size,
                                        const char *theme, const char *key,
                                        Ecore_Hash *cache)
{
        char *ret;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(icon, EWL_THEME_KEY_NOMATCH);

#if BUILD_EFREET_SUPPORT
        ret = ecore_hash_get(cache, key);
        if (!ret)
        {
                /* XXX: How to store NOMATCH in the cache? The cache is strings which must be free'd */
                ret = efreet_icon_path_find(theme, icon, size);
                if (!ret) ret = EWL_THEME_KEY_NOMATCH;
                else ecore_hash_set(cache, strdup(key), (void *)ret);
        }
#else
        ret = EWL_THEME_KEY_NOMATCH;
#endif

        DRETURN_PTR(ret, DLEVEL_STABLE);
}
示例#16
0
/**
 * @return Returns no value
 * @brief Called when the icon theme is changed so we can clean up any
 * caching we have in place
 */
void
ewl_icon_theme_theme_change(void)
{
        const char *icon_theme;

        DENTER_FUNCTION(DLEVEL_STABLE);

        icon_theme = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_ICON_THEME);

        /* check if this is an edje theme */
        if (icon_theme && (!strncasecmp(icon_theme + (strlen(icon_theme) - 4),
                                              ".edj", 4)))
                ewl_icon_theme_is_edje = 1;
        else
                ewl_icon_theme_is_edje = 0;

        /* destroy the cache and re-create it */
        IF_FREE_HASH(ewl_icon_theme_cache);

        ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
        ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
        ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#17
0
/**
 * @param e: The Ewl_Entry to set the editable status of
 * @param editable: The value to set for the editable flag
 * @return Returns no value
 * @brief Set if the entry is editable or not
 */
void
ewl_entry_editable_set(Ewl_Entry *e, unsigned int editable)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(e);
        DCHECK_TYPE(e, EWL_ENTRY_TYPE);

        if (e->editable == !!editable)
                DRETURN(DLEVEL_STABLE);

        e->editable = !!editable;

        if (e->editable)
        {
                ewl_callback_append(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
                                                ewl_entry_cb_key_down, NULL);

                if (ewl_widget_state_has(EWL_WIDGET(e), EWL_STATE_FOCUSED))
                        ewl_widget_show(e->cursor);

                ewl_widget_state_add(EWL_WIDGET(e), EWL_STATE_ON);
        }
        else
        {
                ewl_callback_del(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
                                                ewl_entry_cb_key_down);

                if (ewl_widget_state_has(EWL_WIDGET(e), EWL_STATE_FOCUSED))
                        ewl_widget_hide(e->cursor);

                ewl_widget_state_remove(EWL_WIDGET(e), EWL_STATE_ON);
        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#18
0
/**
 * @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);
}
示例#19
0
/**
 * @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);
}
示例#20
0
/**
 * @param s: The separator to set the orientation on
 * @param o: The orientation to set on the separator
 * @return Returns no value
 * @brief Set the orientation of the separator
 */
void
ewl_separator_orientation_set(Ewl_Separator *s, Ewl_Orientation o)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(s);
        DCHECK_TYPE(s, EWL_SEPARATOR_TYPE);

        if (s->orientation == o)
                DRETURN(DLEVEL_STABLE);

        s->orientation = o;

        if (o == EWL_ORIENTATION_HORIZONTAL) {
                ewl_widget_appearance_set(EWL_WIDGET(s), "hseparator");
                ewl_object_fill_policy_set(EWL_OBJECT(s),
                                           EWL_FLAG_FILL_HFILL |
                                           EWL_FLAG_FILL_HSHRINKABLE);
        }
        else {
                ewl_widget_appearance_set(EWL_WIDGET(s), "vseparator");
                ewl_object_fill_policy_set(EWL_OBJECT(s),
                                           EWL_FLAG_FILL_VFILL |
                                           EWL_FLAG_FILL_VSHRINKABLE);
        }

        ewl_widget_configure(EWL_WIDGET(s));

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#21
0
/**
 * @param menu: The menu to setup
 * @param info: The info to set into the menu
 * @return Returns no value
 * @brief Initializes @a menu with @a info
 */
void
ewl_menu_from_info(Ewl_Menu *menu, Ewl_Menu_Info *info)
{
        int i;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(menu);
        DCHECK_PARAM_PTR(info);
        DCHECK_TYPE(menu, EWL_MENU_TYPE);

        for (i = 0; info[i].name != NULL; i++)
        {
                Ewl_Widget *item;

                item = ewl_menu_item_new();
                ewl_button_label_set(EWL_BUTTON(item), info[i].name);
                ewl_button_image_set(EWL_BUTTON(item), info[i].img, NULL);
                ewl_container_child_append(EWL_CONTAINER(menu), item);

                if (info[i].cb)
                        ewl_callback_append(item, EWL_CALLBACK_CLICKED,
                                                        info[i].cb, NULL);
                ewl_widget_show(item);
        }

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
示例#22
0
/**
 * @return Returns pointer to new toolbar widget on success, NULL on failure.
 * @brief Allocate a new toolbar widget with horizontal orientation
 */
Ewl_Widget *
ewl_htoolbar_new(void)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        DRETURN_PTR(ewl_toolbar_new(), DLEVEL_STABLE);
}
示例#23
0
/**
 * @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);
}
示例#24
0
/**
 * @param v: The Ewl_View to get the Ewl_View_Expansion_View_Fetch function from
 * @return Returns the Ewl_View_Expansion_View_Fetch callback set on the view,
 * or NULL on failure.
 * @brief Gets the expansion view fetch callback from the view
 */
Ewl_View_Expansion_View_Fetch
ewl_view_expansion_view_fetch_get(const Ewl_View *v)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(v, NULL);

        DRETURN_PTR(v->expansion, DLEVEL_STABLE);
}
示例#25
0
/**
 * @param v: The Ewl_View to get the assign callback from
 * @return Returns the Ewl_View_Widget_Assign set into the view or NULL if
 * none set.
 * @brief Get the assign callback set on this view
 */
Ewl_View_Widget_Assign
ewl_view_widget_Assign_get(const Ewl_View *v)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(v, NULL);

        DRETURN_PTR(v->assign, DLEVEL_STABLE);
}
示例#26
0
/**
 * @param v: The Ewl_View to get the Ewl_View_Header_Fetch function from
 * @return Returns the Ewl_View_Header_Fetch callback set on the view, or
 * NULL on failure.
 * @brief Gets the header fetch callback from the view
 */
Ewl_View_Header_Fetch
ewl_view_header_fetch_get(const Ewl_View *v)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(v, NULL);

        DRETURN_PTR(v->header_fetch, DLEVEL_STABLE);
}
示例#27
0
/**
 * @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);
}
示例#28
0
文件: ewl_dvi.c 项目: Limsik/e17
/**
 * @param dvi: the dvi widget to get the current page of
 * @return Returns the current page of the dvi (NULL on failure)
 * @brief get the current page of the dvi
 */
const Edvi_Page *ewl_dvi_dvi_page_get (Ewl_Dvi *dvi)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(dvi, NULL);
        DCHECK_TYPE_RET(dvi, EWL_DVI_TYPE, NULL);

        DRETURN_PTR(dvi->dvi_page, DLEVEL_STABLE);
}
示例#29
0
/**
 * @param v: The Ewl_View to get the constructor from
 * @return Returns the Ewl_View_Constructor set into the view or NULL if
 * none set.
 * @brief Get the constructor set on this view
 */
Ewl_View_Widget_Constructor
ewl_view_widget_constructor_get(const Ewl_View *v)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(v, NULL);

        DRETURN_PTR(v->constructor, DLEVEL_STABLE);
}
示例#30
0
/**
 * @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);
}