Example #1
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);
}
Example #2
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);
}
Example #3
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);
}
Example #4
0
/**
 * @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);
}
Example #5
0
/**
 * @param w: the window to be initialized to default values and callbacks
 * @return Returns TRUE or FALSE depending on if initialization succeeds.
 * @brief Initialize a window to default values and callbacks
 *
 * Sets the values and callbacks of a window @a w to their defaults.
 */
int
ewl_window_init(Ewl_Window *w)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(w, FALSE);

        /*
         * Initialize the fields of the inherited container class
         */
        if (!ewl_embed_init(EWL_EMBED(w)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_appearance_set(EWL_WIDGET(w), EWL_WINDOW_TYPE);
        ewl_widget_inherit(EWL_WIDGET(w), EWL_WINDOW_TYPE);
        ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
        ewl_embed_render_set(EWL_EMBED(w), TRUE);

        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
                             ewl_window_cb_realize, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
                             ewl_window_cb_postrealize, NULL);
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_UNREALIZE,
                             ewl_window_cb_unrealize, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_SHOW,
                            ewl_window_cb_show, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_EXPOSE,
                            ewl_window_cb_expose, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_HIDE,
                            ewl_window_cb_hide, NULL);
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_DESTROY,
                             ewl_window_cb_destroy, NULL);
        /*
         * Override the default configure callbacks since the window
         * has special needs for placement.
         */
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
                             ewl_window_cb_configure, NULL);

        ecore_list_append(ewl_window_list, w);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #6
0
/**
 * @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);
}
Example #7
0
File: ewl_dvi.c Project: Limsik/e17
/**
 * @param dvi: the dvi widget to initialize
 * @return Returns no value.
 * @brief Initialize an dvi widget to default values and callbacks
 *
 * Sets the fields and callbacks of @a dvi to their default
 * values. The property EDVI_PROPERTY_DELAYED_FONT_OPEN is set by
 * default.
 */
int
ewl_dvi_init(Ewl_Dvi *dvi)
{
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(dvi, FALSE);

        w = EWL_WIDGET(dvi);

        if (!ewl_widget_init(w))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_appearance_set(w, EWL_DVI_TYPE);
        ewl_widget_inherit(w, EWL_DVI_TYPE);

        /*
         * Append necessary callbacks.
         */
        ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_dvi_configure_cb,
                            NULL);
        ewl_callback_append(w, EWL_CALLBACK_REVEAL, ewl_dvi_reveal_cb,
                            NULL);
        ewl_callback_append(w, EWL_CALLBACK_OBSCURE, ewl_dvi_obscure_cb,
                            NULL);
        ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_dvi_destroy_cb,
                            NULL);

        dvi->filename = NULL;

        dvi->dvi_device = edvi_device_new (edvi_dpi_get(), edvi_dpi_get());
        dvi->dvi_property = edvi_property_new();
        edvi_property_property_set (dvi->dvi_property, EDVI_PROPERTY_DELAYED_FONT_OPEN);
        dvi->dvi_document = NULL;
        dvi->dvi_page = NULL;

        dvi->dirty = 1;

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #8
0
File: ewl_ps.c Project: Limsik/e17
/**
 * @param ps: the ps widget to initialize
 * @return Returns no value.
 * @brief Initialize an ps widget to default values and callbacks
 *
 * Sets the fields and callbacks of @a ps to their default
 * values.
 */
int
ewl_ps_init(Ewl_Ps *ps)
{
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(ps, FALSE);

        w = EWL_WIDGET(ps);

        if (!ewl_widget_init(w))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_appearance_set(w, EWL_PS_TYPE);
        ewl_widget_inherit(w, EWL_PS_TYPE);

        /*
         * Append necessary callbacks.
         */
        ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_ps_configure_cb,
                            NULL);
        ewl_callback_append(w, EWL_CALLBACK_REVEAL, ewl_ps_reveal_cb,
                            NULL);
        ewl_callback_append(w, EWL_CALLBACK_OBSCURE, ewl_ps_obscure_cb,
                            NULL);
        ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_ps_destroy_cb,
                            NULL);

        ps->filename = NULL;

        ps->ps_document = NULL;
        ps->ps_page = NULL;

        ps->dirty = 1;

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Example #9
0
/**
 * @param e: The Ewl_Entry to initialize
 * @return Returns TRUE on success or FALSE on failure
 * @brief Initializes an Ewl_Entry widget to default values
 */
int
ewl_entry_init(Ewl_Entry *e)
{
        const char *text_types[] = { "UTF8_STRING", "text/plain", NULL };
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(e, FALSE);

        w = EWL_WIDGET(e);

        if (!ewl_text_init(EWL_TEXT(e)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_inherit(w, EWL_ENTRY_TYPE);
        ewl_widget_appearance_set(w, EWL_ENTRY_TYPE);
        ewl_widget_focusable_set(EWL_WIDGET(e), TRUE);

        ewl_object_fill_policy_set(EWL_OBJECT(e), EWL_FLAG_FILL_HSHRINK |
                                                  EWL_FLAG_FILL_HFILL);

        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_IN);
        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_OUT);
        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_POSITION);
        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_DATA_RECEIVED);

        /* setup the cursor */
        e->cursor = ewl_entry_cursor_new(e);
        ewl_container_child_append(EWL_CONTAINER(e), e->cursor);
        ewl_widget_internal_set(e->cursor, TRUE);
        ewl_object_fill_policy_set(EWL_OBJECT(e->cursor), EWL_FLAG_FILL_VFILL);

        /* Set the pointer */
        ewl_attach_mouse_cursor_set(EWL_WIDGET(e), EWL_MOUSE_CURSOR_XTERM);

        /* this has to be called after the cursor is created as it will try
         * to show the cursor */
        ewl_entry_multiline_set(e, FALSE);
        ewl_entry_editable_set(e, TRUE);
        ewl_text_selectable_set(EWL_TEXT(e), TRUE);
        ewl_dnd_accepted_types_set(EWL_WIDGET(e), text_types);

        /* setup callbacks */
        ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
                                ewl_entry_cb_focus_in, NULL);
        ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
                                ewl_entry_cb_focus_out, NULL);
        ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE,
                                ewl_entry_cb_configure, NULL);
        ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
                                ewl_entry_cb_mouse_down, NULL);
        ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
                                ewl_entry_cb_mouse_up, NULL);
        ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
                                ewl_entry_cb_disable, NULL);
        ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE,
                                ewl_entry_cb_enable, NULL);
        ewl_callback_append(w, EWL_CALLBACK_DND_POSITION,
                                ewl_entry_cb_dnd_position, NULL);
        ewl_callback_append(w, EWL_CALLBACK_DND_DATA_RECEIVED,
                                ewl_entry_cb_dnd_data, NULL);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}