/** * @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); }
void _icon_editor_gui_update() { char *tmp; Evas_Object *im_obj; void *im_data = NULL; int im_w = 0, im_h = 0; tmp = icon_editor_exec_get(); ewl_entry_text_set(EWL_ENTRY(editor->exec.entry), tmp); free(tmp); /* FIXME: set the name */ im_obj = EWL_IMAGE(editor->icon_image)->image; icon_editor_image_data_get(&im_data, &im_w, &im_h); if (!im_data) return; evas_object_image_size_set(im_obj, im_w, im_h); evas_object_image_data_copy_set(im_obj, im_data); evas_object_image_alpha_set(im_obj, 1); evas_object_image_data_update_add(im_obj, 0, 0, im_w, im_h); evas_object_image_fill_set(im_obj, 0, 0, im_w, im_h); printf("wxh: %d x %d\n", im_w, im_h); ewl_object_size_request(EWL_OBJECT(editor->icon_image), im_w, im_h); ewl_object_maximum_size_set(EWL_OBJECT(editor->icon_image), im_w, im_h); ewl_object_minimum_size_set(EWL_OBJECT(editor->icon_image), im_w, im_h); }
/** * @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); }
static int create_test(Ewl_Container *box) { Ewl_Widget *statusbar = NULL, *button = NULL, *hbox = NULL; statusbar = ewl_statusbar_new(); ewl_container_child_append(EWL_CONTAINER(box), statusbar); ewl_statusbar_left_hide(EWL_STATUSBAR(statusbar)); ewl_widget_show(statusbar); button_push_cb(NULL, NULL, statusbar); hbox = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(box), hbox); ewl_widget_show(hbox); button = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(button), "push"); ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_push_cb, statusbar); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE); ewl_container_child_append(EWL_CONTAINER(hbox), button); ewl_widget_show(button); button = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(button), "pop"); ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_pop_cb, statusbar); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE); ewl_container_child_append(EWL_CONTAINER(hbox), button); ewl_widget_show(button); return 1; }
/** * @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); }
Ewl_Widget * widget_new( char *name ) { Ewler_Widget *w; if( !name ) return NULL; w = spec_new( name ); if( !w || !w->w ) return NULL; w->selected = false; ewl_callback_append(w->w, EWL_CALLBACK_REALIZE, realize, w); ewl_callback_append(w->w, EWL_CALLBACK_CONFIGURE, configure, w); ewl_widget_show(w->w); w->bg = ewl_vbox_new(); w->bg->data = ecore_hash_new(ecore_str_hash, ecore_str_compare); ewl_widget_appearance_set(w->bg, "select_bg"); ewl_theme_data_str_set(w->bg, "/select_bg/file", EWLER_EET); ewl_theme_data_str_set(w->bg, "/select_bg/group", "select_bg"); ewl_object_fill_policy_set(EWL_OBJECT(w->bg), EWL_FLAG_FILL_NONE); ewl_widget_data_set(w->bg, "EWLER_WIDGET", w); ewl_container_child_append(EWL_CONTAINER(w->bg), w->w); ewl_widget_show(w->bg); w->fg = ewl_vbox_new(); w->fg->data = ecore_hash_new(ecore_str_hash, ecore_str_compare); ewl_widget_appearance_set(w->fg, "select_fg"); ewl_theme_data_str_set(w->fg, "/select_fg/file", EWLER_EET); ewl_theme_data_str_set(w->fg, "/select_fg/group", "select_fg"); ewl_callback_append(w->fg, EWL_CALLBACK_CONFIGURE, fg_configure, w); ewl_callback_append(w->fg, EWL_CALLBACK_REALIZE, fg_realize, w); ewl_callback_append(w->fg, EWL_CALLBACK_FOCUS_IN, fg_mouse_in, w); ewl_callback_append(w->fg, EWL_CALLBACK_FOCUS_OUT, fg_mouse_out, w); ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_DOWN, fg_mouse_down, w); ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_UP, fg_mouse_up, w); ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_MOVE, fg_mouse_move, w); ewl_callback_append(w->fg, EWL_CALLBACK_DESTROY, widget_destroy, w); ewl_object_fill_policy_set(EWL_OBJECT(w->fg), EWL_FLAG_FILL_NONE); ewl_widget_data_set(w->fg, "EWLER_WIDGET", w); ewl_container_child_append(EWL_CONTAINER(w->fg), w->bg); ewl_widget_show(w->fg); w->selectable = true; w->configured = false; return w->fg; }
void resize_and_rescale(double scale) { int docwidth,docheight; double docscale; int sp_inner; double ltrimpct=0.0,rtrimpct=0.0; //ewl_object_maximum_h_set(EWL_OBJECT(pdfwidget),99999); //ewl_object_minimum_h_set(EWL_OBJECT(pdfwidget),0); sp_inner=CURRENT_W(scrollpane)-INSET_HORIZONTAL(scrollpane)-PADDING_HORIZONTAL(scrollpane); //if(EWL_SCROLLPANE(scrollpane)->vflag) // sp_inner-=CURRENT_W(EWL_OBJECT(EWL_SCROLLPANE(scrollpane)->vscrollbar)); //ewl_pdf_size_get(EWL_PDF(pdfwidget),&docwidth,&docheight); epdf_page_size_get (EWL_PDF(pdfwidget)->pdf_page,&docwidth,&docheight); if(fitmode==0) docscale=((double)sp_inner)/((double)docwidth)*scale; else if(fitmode==1) { ltrimpct=((double)get_settings()->ltrimpad)/((double)docwidth); rtrimpct=((double)get_settings()->rtrimpad)/((double)docwidth); docscale=((double)sp_inner)/((1.0-leftmarge+ltrimpct-rightmarge+rtrimpct)*((double)docwidth))*scale; } ewl_pdf_scale_set(EWL_PDF(pdfwidget),docscale,docscale); //ewl_object_custom_w_set(EWL_OBJECT(pdfwidget),floor(((double)sp_inner)*scale)); //ewl_object_custom_w_set(EWL_OBJECT(pdfwidget),floor(((double)sp_inner)*scale)); //ewl_object_custom_h_set(EWL_OBJECT(pdfwidget),floor(((double)docheight)/((double)docwidth)*((double)sp_inner)*scale)); ewl_object_custom_w_set(EWL_OBJECT(pdfwidget),floor(((double)docwidth)*docscale)); ewl_object_custom_h_set(EWL_OBJECT(pdfwidget),floor(((double)docheight)*docscale)); //ewl_object_position_request(EWL_OBJECT(pdfwidget),0,0); ewl_widget_configure(pdfwidget); //ewl_object_custom_w_set(EWL_OBJECT(trimpane),floor(((double)docwidth)*docscale)); //ewl_object_custom_h_set(EWL_OBJECT(trimpane),floor(((double)docheight)*docscale)); ewl_object_custom_w_set(EWL_OBJECT(trimpane),floor(((double)sp_inner)*scale)); ewl_object_custom_h_set(EWL_OBJECT(trimpane),floor(((double)docheight)*docscale)); ewl_object_position_request(EWL_OBJECT(trimpane),0,0); //ewl_object_place(EWL_OBJECT(pdfwidget),0,0,floor(((double)docwidth)*docscale),floor(((double)docheight)*docscale)); ewl_widget_configure(trimpane); ewl_widget_configure(scrollpane); if(fitmode==0) ewl_scrollpane_hscrollbar_value_set(EWL_SCROLLPANE(trimpane),0.0); else if(fitmode==1) ewl_scrollpane_hscrollbar_value_set(EWL_SCROLLPANE(trimpane),(leftmarge-ltrimpct)/(leftmarge-ltrimpct+rightmarge-rtrimpct)); }
/** * @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); }
/** * popup menu for managing files in the project */ static EWL_CALLBACK_DEFN(project_file_menu) { Ewl_Widget *item; Ewl_Event_Mouse_Up *ev = ev_data; if( file_menu ) { ewl_widget_destroy(file_menu); file_menu = NULL; } else if( ev->button == 3 ) { ewl_window_raise(EWL_WINDOW(project_win)); file_menu = ewl_imenu_new(NULL, "File Options"); ewl_object_position_request(EWL_OBJECT(file_menu), ev->x, ev->y); ewl_object_fill_policy_set(EWL_OBJECT(file_menu), EWL_FLAG_FILL_NONE); ewl_container_child_append(EWL_CONTAINER(project_win), file_menu); ewl_callback_append(file_menu, EWL_CALLBACK_CONFIGURE, project_file_menu_configure, NULL); ewl_callback_call(file_menu, EWL_CALLBACK_SELECT); ewl_widget_show(file_menu); item = ewl_menu_item_new(NULL, "Save"); /* HACK FOR NON-STRING DATA HASHES */ item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare); ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_SAVE); ewl_callback_append(item, EWL_CALLBACK_SELECT, project_file_menu_cb, user_data); ewl_container_child_append(EWL_CONTAINER(file_menu), item); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "Settings..."); /* HACK FOR NON-STRING DATA HASHES */ item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare); ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_SETTINGS); ewl_callback_append(item, EWL_CALLBACK_SELECT, project_file_menu_cb, user_data); ewl_container_child_append(EWL_CONTAINER(file_menu), item); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "Delete"); /* HACK FOR NON-STRING DATA HASHES */ item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare); ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_DELETE); ewl_callback_append(item, EWL_CALLBACK_SELECT, project_file_menu_cb, user_data); ewl_container_child_append(EWL_CONTAINER(file_menu), item); ewl_widget_show(item); } }
/** * @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 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); }
int inspector_init( void ) { char *header[] = {"Attribute", "Value"}; if( inspector_win ) return -1; name_spec = spec_elem_get("Ewl_Widget", "name"); inspector_win = ewl_window_new(); ewl_window_title_set(EWL_WINDOW(inspector_win), "Inspector"); ewl_object_size_request(EWL_OBJECT(inspector_win), 200, 320); ewl_callback_append(inspector_win, EWL_CALLBACK_DELETE_WINDOW, inspector_toggle, NULL); tree = ewl_tree_new(2); ewl_tree_headers_set(EWL_TREE(tree), header); ewl_tree_mode_set(EWL_TREE(tree), EWL_TREE_MODE_NONE); ewl_container_child_append(EWL_CONTAINER(inspector_win), tree); ewl_widget_show(tree); ewl_widget_show(inspector_win); return 0; }
static int test_constructor(char *buf, int len) { Ewl_Widget *sp; int ret = 0; sp = ewl_scrollpane_new(); if (!EWL_SCROLLPANE_IS(sp)) LOG_FAILURE(buf, len, "returned widget is not of the type " EWL_SCROLLPANE_TYPE); else if (ewl_scrollport_hscrollbar_flag_get(EWL_SCROLLPORT(sp)) != EWL_SCROLLPORT_FLAG_AUTO_VISIBLE) LOG_FAILURE(buf, len, "horizontal scrollbar doesn't auto hide"); else if (ewl_scrollport_vscrollbar_flag_get(EWL_SCROLLPORT(sp)) != EWL_SCROLLPORT_FLAG_AUTO_VISIBLE) LOG_FAILURE(buf, len, "vertical scrollbar doesn't auto hide"); else if (ewl_object_fill_policy_get(EWL_OBJECT(sp)) != (EWL_FLAG_FILL_FILL | EWL_FLAG_FILL_SHRINK)) LOG_FAILURE(buf, len, "fill policy is not FILL | SHRINK"); else ret = 1; ewl_widget_destroy(sp); return ret; }
static int test_constructor(char *buf, int len) { Ewl_Widget *o; int ret = 0; o = ewl_image_new(); if (!EWL_IMAGE_IS(o)) LOG_FAILURE(buf, len, "widget is not of the type " EWL_IMAGE_TYPE); else if (ewl_object_fill_policy_get(EWL_OBJECT(o)) != EWL_FLAG_FILL_NONE) LOG_FAILURE(buf, len, "Fill policy is not NONE"); else if (ewl_image_file_path_get(EWL_IMAGE(o))) LOG_FAILURE(buf, len, "path is not NULL"); else if (ewl_image_file_key_get(EWL_IMAGE(o))) LOG_FAILURE(buf, len, "key is not NULL"); else if (ewl_image_proportional_get(EWL_IMAGE(o))) LOG_FAILURE(buf, len, "image is proportional"); else if (ewl_image_constrain_get(EWL_IMAGE(o))) LOG_FAILURE(buf, len, "image has constrain"); else ret = 1; ewl_widget_destroy(o); return ret; }
/** * @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); }
EvasEwl::EvasEwl( EvasCanvas &canvas, EwlEmbed* ewlobj, const char* name ) { #warning not sure whether this belongs here #if 0 // [audifahrer] ewl_object_fill_policy_set( EWL_OBJECT(ewlobj->obj() ), EWL_FLAG_FILL_ALL ); o = ewl_embed_evas_set( EWL_EMBED( ewlobj->obj() ), canvas->obj(), EWL_EMBED_EVAS_WINDOW(ecore_evas_software_x11_window_get(canvas->obj()))); #endif }
/** * @internal * @param w: The widget to work with * @ev_data: The Ewl_Event_Mouse_Move data * @param data: The scrollport * @return Returns no value * @brief The mouse move callback for kinetic scrolling */ static void ewl_scrollport_kinetic_cb_mouse_move_normal(Ewl_Widget *w, void *ev, void *data) { Ewl_Scrollport *s; Ewl_Event_Mouse *mm; Ewl_Scrollport_Kinetic_Info_Normal *info; int cx, cy; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(ev); DCHECK_PARAM_PTR(data); s = EWL_SCROLLPORT(data); mm = EWL_EVENT_MOUSE(ev); info = s->kinfo->extra; if (!s->kinfo->clicked) DRETURN(DLEVEL_STABLE); if (!s->kinfo->active) { ecore_timer_add(1.0/s->kinfo->fps, ewl_scrollport_kinetic_cb_scroll_timer_normal, s); s->kinfo->active = !!TRUE; } info->xc = mm->x; info->yc = mm->y; cx = (info->xc - info->x); cy = (info->yc - info->y); /* v = (change in position / (width or height of scroll * * (range of velocities) + min)) */ info->vel_x = ((cx / (double)ewl_object_current_w_get(EWL_OBJECT(w))) * (s->kinfo->vmax - s->kinfo->vmin)) + s->kinfo->vmin; info->vel_y = ((cy / (double)ewl_object_current_h_get(EWL_OBJECT(w))) * (s->kinfo->vmax - s->kinfo->vmin)) + s->kinfo->vmin; DLEAVE_FUNCTION(DLEVEL_STABLE); }
static EWL_CALLBACK_DEFN(entry_focus_out) { if( VISIBLE(EWL_ENTRY(w)->cursor) ) { last_selected = NULL; last_key = NULL; ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAG_STATE_SELECTED); ewl_callback_call(w, EWL_CALLBACK_DESELECT); } }
int tools_init( void ) { Ewl_Widget *vbox, *button, *image; if( tools_win ) return -1; tools_win = ewl_window_new(); ewl_window_title_set(EWL_WINDOW(tools_win), "Tools"); ewl_object_size_request(EWL_OBJECT(tools_win), 200, 320); ewl_callback_append(tools_win, EWL_CALLBACK_DELETE_WINDOW, tools_toggle, NULL); vbox = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(tools_win), vbox); button = ewl_button_new(NULL); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK); ewl_object_insets_set(EWL_OBJECT(button), 0, 0, 0, 0); ewl_callback_append(button, EWL_CALLBACK_CLICKED, tools_click, "Ewl_Text"); ewl_container_child_append(EWL_CONTAINER(vbox), button); image = ewl_image_new(EWLER_IMAGE_DIR"/text-small.png", "text"); ewl_container_child_append(EWL_CONTAINER(button), image); ewl_widget_show(image); ewl_widget_show(button); button = ewl_button_new(NULL); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK); ewl_object_insets_set(EWL_OBJECT(button), 0, 0, 0, 0); ewl_callback_append(button, EWL_CALLBACK_CLICKED, tools_click, "Ewl_Entry"); ewl_container_child_append(EWL_CONTAINER(vbox), button); image = ewl_image_new(EWLER_IMAGE_DIR"/entry-small.png", "entry"); ewl_container_child_append(EWL_CONTAINER(button), image); ewl_widget_show(image); ewl_widget_show(button); button = ewl_button_new(NULL); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK); ewl_object_insets_set(EWL_OBJECT(button), 0, 0, 0, 0); ewl_callback_append(button, EWL_CALLBACK_CLICKED, tools_click, "Ewl_Border"); ewl_container_child_append(EWL_CONTAINER(vbox), button); image = ewl_image_new(EWLER_IMAGE_DIR"/border-small.png", "border"); ewl_container_child_append(EWL_CONTAINER(button), image); ewl_widget_show(image); ewl_widget_show(button); ewl_widget_show(vbox); ewl_widget_show(tools_win); return 0; }
static int create_test(Ewl_Container *box) { Ewl_Widget *hscrollbar, *vscrollbar; hscrollbar = ewl_hscrollbar_new(); ewl_object_padding_type_set(EWL_OBJECT(hscrollbar), EWL_PADDING_LARGE); ewl_object_padding_type_bottom_set(EWL_OBJECT(hscrollbar), EWL_PADDING_DEFAULT); ewl_container_child_append(box, hscrollbar); ewl_widget_show(hscrollbar); vscrollbar = ewl_vscrollbar_new(); ewl_object_padding_type_set(EWL_OBJECT(vscrollbar), EWL_PADDING_LARGE); ewl_container_child_append(box, vscrollbar); ewl_widget_show(vscrollbar); return 1; }
/** * @param n: The Ewl_Notebook to get the alignment from * @return Returns the current alignment values of the widget * @brief Retrieves the alignment of the tabbar in the notebook widget */ unsigned int ewl_notebook_tabbar_alignment_get(Ewl_Notebook *n) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(n, 0); DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, 0); DRETURN_INT(ewl_object_alignment_get(EWL_OBJECT(n->body.tabbar)), DLEVEL_STABLE); }
void eke_gui_ewl_feed_change(Eke *eke, Eke_Feed *feed) { Eke_Gui_Ewl_Feed *disp; Eke_Feed_Item *item; Ewl_Widget *o; disp = ecore_hash_get(eke->feeds, feed); if (!disp->tab) { Ewl_Widget *o; disp->tab = ewl_text_new(feed->title); ewl_widget_show(disp->tab); o = ewl_vbox_new(); ewl_notebook_page_append(EWL_NOTEBOOK(eke->gui.ewl.notebook), disp->tab, o); ewl_widget_show(o); disp->page = ewl_scrollpane_new(); ewl_container_child_append(EWL_CONTAINER(o), disp->page); ewl_object_insets_set(EWL_OBJECT(disp->page), 5, 5, 5, 5); ewl_widget_show(disp->page); } ewl_container_reset(EWL_CONTAINER(disp->page)); ecore_list_first_goto(feed->items); while ((item = ecore_list_next(feed->items)) != NULL) { o = ewl_text_new(NULL); ewl_text_wrap_set(EWL_TEXT(o), 1); ewl_text_style_set(EWL_TEXT(o), "soft_shadow"); ewl_text_text_set(EWL_TEXT(o), item->title); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); if (item->link) { o = ewl_text_new(item->link); ewl_text_wrap_set(EWL_TEXT(o), 1); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); } if (item->desc) { o = ewl_text_new(item->desc); ewl_text_wrap_set(EWL_TEXT(o), 1); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); } o = ewl_text_new(" "); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); } }
/** * @param n: The Ewl_Notebook to set the tabbar alignment of * @param align: The Ewl_Alignment to set the alignment too * @return Returns no value. * @brief Set the alignment of the tabbar in the notebook widget */ void ewl_notebook_tabbar_alignment_set(Ewl_Notebook *n, unsigned int align) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(n); DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE); ewl_object_alignment_set(EWL_OBJECT(n->body.tabbar), align); DLEAVE_FUNCTION(DLEVEL_STABLE); }
/** * @param b: The Ewl_Border to set the alignment on * @param align: The alignment to set on the label * @return Retruns no value * @brief alters the alignment setting of the label on the border */ void ewl_border_label_alignment_set(Ewl_Border *b, unsigned int align) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR(b); DCHECK_TYPE(b, EWL_BORDER_TYPE); ewl_object_alignment_set(EWL_OBJECT(b->label), align); DLEAVE_FUNCTION(DLEVEL_STABLE); }
static int create_test(Ewl_Container *box) { Ewl_Widget *hseeker, *vseeker; hseeker = ewl_hseeker_new(); ewl_object_position_request(EWL_OBJECT(hseeker), 30, 0); ewl_callback_append(hseeker, EWL_CALLBACK_VALUE_CHANGED, cb_print_value, NULL); ewl_container_child_append(box, hseeker); ewl_widget_show(hseeker); vseeker = ewl_vseeker_new(); ewl_object_position_request(EWL_OBJECT(vseeker), 0, 30); ewl_callback_append(vseeker, EWL_CALLBACK_VALUE_CHANGED, cb_print_value, NULL); ewl_container_child_append(box, vseeker); ewl_widget_show(vseeker); return 1; }
static void eke_gui_ewl_manage_feed_cb(Ewl_Widget *w, void *ev, void *data) { Eke *eke; Ewl_Widget *win, *box, *button; eke = data; win = ewl_dialog_new(EWL_POSITION_BOTTOM); ewl_window_title_set(EWL_WINDOW(win), PACKAGE " -- manage feeds"); ewl_window_name_set(EWL_WINDOW(win), PACKAGE); ewl_window_class_set(EWL_WINDOW(win), PACKAGE); ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, eke_gui_ewl_manage_feed_exit_cb, win); ewl_widget_show(win); box = ewl_vbox_new(); ewl_dialog_widget_add(EWL_DIALOG(win), box); ewl_widget_show(box); button = ewl_button_new("add feed"); ewl_widget_data_set(button, "manage_feed_win", win); ewl_container_child_append(EWL_CONTAINER(box), button); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK); ewl_callback_append(button, EWL_CALLBACK_CLICKED, eke_gui_ewl_add_feed_cb, eke); ewl_widget_show(button); button = ewl_button_stock_with_id_new(EWL_STOCK_CANCEL, EWL_RESPONSE_CANCEL); ewl_container_child_append(EWL_CONTAINER(win), button); ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK); ewl_callback_append(button, EWL_CALLBACK_VALUE_CHANGED, eke_gui_ewl_manage_feed_exit_cb, win); ewl_widget_show(button); return; w = NULL; ev = NULL; }
/** * @internal * @param c: The container to work with * @param w: The widget to work with * @return Returns no value * @brief The child show callback */ void ewl_notebook_cb_child_show(Ewl_Container *c, Ewl_Widget *w) { Ewl_Notebook *n; int pw, ph; 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); if (n->cur_page != w) ewl_widget_hide(w); ewl_object_preferred_size_get(EWL_OBJECT(n->cur_page), &pw, &ph); ewl_object_preferred_inner_size_set(EWL_OBJECT(n->body.pages), pw, ph); DLEAVE_FUNCTION(DLEVEL_STABLE); }
/** * @param b: The Ewl_Border to get the alignment from * @return Returns the alignment of the label for the border. * @brief Retruns the alignment setting of the label for this border container */ unsigned int ewl_border_label_alignment_get(Ewl_Border *b) { unsigned int align; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(b, 0); DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, 0); align = ewl_object_alignment_get(EWL_OBJECT(b->label)); DRETURN_INT(align, 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); }
static int create_test(Ewl_Container *box) { Ewl_Widget *overlay; Ewl_Widget *img; Ewl_Widget *hist; overlay = ewl_overlay_new(); ewl_container_child_append(EWL_CONTAINER(box), overlay); ewl_object_fill_policy_set(EWL_OBJECT(overlay), EWL_FLAG_FILL_ALL); ewl_callback_append(EWL_WIDGET(overlay), EWL_CALLBACK_CONFIGURE, ewl_histogram_test_cb_configure, NULL); ewl_widget_show(overlay); img = ewl_image_new(); ewl_image_file_path_set(EWL_IMAGE(img), ewl_test_image_get("entrance.png")); ewl_image_proportional_set(EWL_IMAGE(img), TRUE); ewl_container_child_append(EWL_CONTAINER(overlay), img); ewl_object_fill_policy_set(EWL_OBJECT(img), EWL_FLAG_FILL_ALL); ewl_widget_show(img); hist = ewl_histogram_new(); ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_Y); ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img)); ewl_container_child_append(EWL_CONTAINER(overlay), hist); ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL); ewl_widget_show(hist); hist = ewl_histogram_new(); ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_R); ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img)); ewl_container_child_append(EWL_CONTAINER(overlay), hist); ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL); ewl_widget_show(hist); hist = ewl_histogram_new(); ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_G); ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img)); ewl_container_child_append(EWL_CONTAINER(overlay), hist); ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL); ewl_widget_show(hist); hist = ewl_histogram_new(); ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_B); ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img)); ewl_container_child_append(EWL_CONTAINER(overlay), hist); ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL); ewl_widget_show(hist); return 1; }