Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src Modified Files: ewl_entry.c ewl_menu.c ewl_misc.c ewl_window.c ewl_window.h Log Message: Removed some API redundancy from the windows, they now follow normal object sizing policy. Started support for scrolling text in entry widgets, not done yet, just committing to sync with from home. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -3 -r1.56 -r1.57 --- ewl_entry.c 3 Jun 2003 04:00:40 -0000 1.56 +++ ewl_entry.c 4 Jun 2003 01:46:44 -0000 1.57 @@ -193,8 +193,9 @@ { Ewl_Entry *e; int xx, yy, ww, hh; - int c_spos, c_epos, l; - int sx = 0, sy = 0, ex = 0, ey = 0, ew = 0, eh = 0; + int c_spos, c_epos, base, l; + int sx = 0, sy = 0, ex = 0, ey = 0; + unsigned int ew = 0; char *str; DENTER_FUNCTION(DLEVEL_STABLE); @@ -211,19 +212,19 @@ hh = CURRENT_H(w); /* - * First position the text. - * FIXME: This needs to be scrollable + * First position the text to a known base position. */ ewl_object_request_geometry(EWL_OBJECT(e->text), xx, yy, ww, hh); str = ewl_text_get_text(EWL_TEXT(e->text)); c_spos = ewl_cursor_get_start_position(EWL_CURSOR(e->cursor)); c_epos = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor)); + base = ewl_cursor_get_base_position(EWL_CURSOR(e->cursor)); l = ewl_text_get_length(EWL_TEXT(e->text)); if (str && l && c_spos > l) { - xx += ewl_object_get_current_w(EWL_OBJECT(e->text)); - ww = 5; + sx = xx + ewl_object_get_current_w(EWL_OBJECT(e->text)); + ew = 5 + sx; } else { /* @@ -234,13 +235,32 @@ &sy, NULL, NULL); ewl_text_get_letter_geometry(EWL_TEXT(e->text), --c_epos, &ex, - &ey, &ew, &eh); + &ey, &ew, NULL); + base--; - xx = sx; - ww = (ex + ew) - sx; + ew = (ex + ew); } - ewl_object_request_geometry(EWL_OBJECT(e->cursor), xx, yy, ww, hh); + /* + * Scroll the text to fit the contents. + */ + if ((c_spos == base) && (ew > (int)(xx + ww))) { + xx -= (ex + ew) - (xx + ww); + + ewl_object_request_geometry(EWL_OBJECT(e->text), xx, + CURRENT_Y(e), CURRENT_W(e), hh); + printf("Scrolling text to (%d, %d) dimensions %d x %d\n", + CURRENT_X(e->text), CURRENT_Y(e->text), + CURRENT_W(e->text), CURRENT_H(e->text)); + } + else if ((c_epos == base) && (sx < xx)) { + xx -= sx; + + ewl_object_request_geometry(EWL_OBJECT(e->text), xx, + CURRENT_Y(e), CURRENT_W(e), hh); + } + + ewl_object_request_geometry(EWL_OBJECT(e->cursor), sx, yy, ew - sx, hh); FREE(str); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ewl_menu.c 14 Apr 2003 17:12:50 -0000 1.6 +++ ewl_menu.c 4 Jun 2003 01:46:44 -0000 1.7 @@ -87,12 +87,11 @@ * called. */ menu->popup = ewl_window_new(); - ewl_window_set_auto_size(EWL_WINDOW(menu->popup), TRUE); ewl_window_set_borderless(EWL_WINDOW(menu->popup)); ewl_object_set_fill_policy(EWL_OBJECT(menu->popup), EWL_FILL_POLICY_NONE); - ewl_window_get_geometry(pwin, &x, &y, NULL, NULL); + ewl_window_get_position(pwin, &x, &y); /* * Position the popup menu relative to the menu. @@ -104,7 +103,7 @@ x += CURRENT_X(w); y += CURRENT_Y(w) + CURRENT_H(w); - ewl_window_set_min_size(EWL_WINDOW(menu->popup), + ewl_object_set_minimum_size(EWL_OBJECT(menu->popup), CURRENT_W(menu), MINIMUM_H(menu->popup)); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_misc.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- ewl_misc.c 22 Apr 2003 20:05:22 -0000 1.29 +++ ewl_misc.c 4 Jun 2003 01:46:44 -0000 1.30 @@ -268,23 +268,29 @@ * it's parent widget. */ if (w->parent) { - int x, y, width, height; + int x, y; + unsigned int width, height; Ewl_Widget *p = w->parent; ewl_object_get_current_geometry(EWL_OBJECT(w), &x, &y, &width, &height); - if ((x + width) < CURRENT_X(p) || - x > CURRENT_X(p) + CURRENT_W(p) || - (y + height) < CURRENT_Y(p) || - y > CURRENT_Y(p) + CURRENT_H(p) || - (x + width) < CURRENT_X(win) || - x > CURRENT_X(win) + CURRENT_W(win) || - (y + height) < CURRENT_Y(win) || - y > CURRENT_Y(win) + CURRENT_H(win)) { + if ((int)(x + width) < CURRENT_X(p) || + x > (int)(CURRENT_X(p) + CURRENT_W(p)) || + (int)(y + height) < CURRENT_Y(p) || + y > (int)(CURRENT_Y(p) + CURRENT_H(p)) || + (int)(x + width) < CURRENT_X(win) || + x > (int)(CURRENT_X(win) + CURRENT_W(win)) || + (int)(y + height) < CURRENT_Y(win) || + y > (int)(CURRENT_Y(win) + CURRENT_H(win))) { w->flags |= EWL_FLAGS_OBSCURED; + if (w->fx_clip_box) + evas_object_hide(w->fx_clip_box); } - else + else { w->flags &= ~EWL_FLAGS_OBSCURED; + if (w->fx_clip_box) + evas_object_show(w->fx_clip_box); + } } /* =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -3 -r1.47 -r1.48 --- ewl_window.c 3 Jun 2003 04:00:51 -0000 1.47 +++ ewl_window.c 4 Jun 2003 01:46:44 -0000 1.48 @@ -130,117 +130,6 @@ } /** - * ewl_window_resize - resize the specified window to the specified size - * @win: the window to resize - * @w: the new width for the window - * @h: the new height for the window - * - * Returns no value. Resize the specified window the the specified size, - * configure is called to have the display updated. - */ -void ewl_window_resize(Ewl_Window * win, int w, int h) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("win", win); - - ewl_object_request_size(EWL_OBJECT(win), w, h); - - if (!win->window) - DRETURN(DLEVEL_STABLE); - - ecore_window_resize(win->window, - ewl_object_get_current_w(EWL_OBJECT(win)), - ewl_object_get_current_h(EWL_OBJECT(win))); - - DLEAVE_FUNCTION(DLEVEL_STABLE); -} - -/** - * ewl_window_set_min_size - set the minimum size a window can attain - * @win: the window to change the minimum size - * @w: the minimum width the window can attain - * @h: the minimum height the window can attain - * - * Returns no value. Sets the minimum size the window can attain. - */ -void ewl_window_set_min_size(Ewl_Window * win, int w, int h) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("win", win); - - ewl_object_set_minimum_size(EWL_OBJECT(win), w, h); - - if (!REALIZED(win)) - DRETURN(DLEVEL_STABLE); - - ecore_window_set_min_size(win->window, w, h); - - DLEAVE_FUNCTION(DLEVEL_STABLE); -} - - -/** - * ewl_window_set_max_size - set the maximum size a window can attain - * @win: the window to change the maximum size - * @w: the maximum width the window can attain - * @h: the maximum height the window can attain - * - * Returns no value. Sets the maximum size the window can attain. - */ -void ewl_window_set_max_size(Ewl_Window * win, int w, int h) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("win", win); - - EWL_OBJECT(win)->maximum.w = w; - EWL_OBJECT(win)->maximum.h = h; - - if (!REALIZED(win)) - return; - - ecore_window_set_max_size(win->window, w, h); - - DLEAVE_FUNCTION(DLEVEL_STABLE); -} - -/** - * ewl_window_get_geometry - retrieve the size and position of a window - * @win: the window to retrieve the size - * @x: the pointer to the integer to store the x position - * @y: the pointer to the integer to store the y position - * @w: the pointer to the integer to store the width - * @h: the pointer to the integer to store the height - * - * Returns no value. Stores the current position and size of the window into - * @x, @y, @w, and @h. - */ -void ewl_window_get_geometry(Ewl_Window * win, int *x, int *y, int *w, int *h) -{ - DCHECK_PARAM_PTR("win", win); - - ecore_window_get_geometry(win->window, x, y, w, h); - ecore_window_get_root_relative_location(win->window, x, y); -} - -/** - * ewl_window_set_geometry - set the current size and position of a window - * @win: the window to change geometry - * @x: the new x position of the window - * @y: the new y position of the window - * @w: the new width of the window - * @h: the new height of the window - * - * Returns no value. Changes the current size and position of the window. - */ -void ewl_window_set_geometry(Ewl_Window * win, int x, int y, int w, int h) -{ - DCHECK_PARAM_PTR("win", win); - - ewl_window_resize(win, w, h); - ewl_window_move(win, x, y); -} - -/** * ewl_window_set_title - set the title of the specified window * @win: the window to change the title * @title: the title to set for the window @@ -303,24 +192,6 @@ } /** - * ewl_window_set_auto_size - set the window to resize to fit contents - * @win: the window to change auto resize flag - * @value: the TRUE or FALSE value for the auto resize flag - * - * Returns no value. - */ -void ewl_window_set_auto_size(Ewl_Window * win, int value) -{ - DCHECK_PARAM_PTR("win", win); - - if (value) - win->flags |= EWL_WINDOW_AUTO_SIZE; - else - win->flags &= (~EWL_WINDOW_AUTO_SIZE); - ewl_widget_configure(EWL_WIDGET(win)); -} - -/** * ewl_window_move - move the specified window to the given position * @win: the window to move * @x: the x coordinate of the new position @@ -334,11 +205,6 @@ DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("win", win); - /* - CURRENT_X(win) = x; - CURRENT_Y(win) = y; - */ - if (REALIZED(win)) ecore_window_move(win->window, x, y); @@ -346,6 +212,24 @@ } /** + * ewl_window_get_position - retrieve the position of the window + * @x: a pointer to the integer that should receive the x coordinate + * @y: a pointer to the integer that should receive the y coordinate + * + * Returns no value. Stores the window position into the parameters @x and @y. + */ +void ewl_window_get_position(Ewl_Window * win, int *x, int *y) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("win", win); + + if (REALIZED(win)) + ecore_window_get_geometry(win->window, x, y, NULL, NULL); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** * ewl_window_get_child_at - find the child at given coordinates * @win: the window to search for a child * @x: the x coordinate to look for an intersecting child @@ -657,6 +541,8 @@ Ewl_Window *win; Ewl_Object *child; + DENTER_FUNCTION(DLEVEL_STABLE); + child = EWL_OBJECT(w); win = EWL_WINDOW(c); @@ -697,4 +583,6 @@ ewl_object_request_size(EWL_OBJECT(c), ewl_object_get_current_w(EWL_OBJECT(c)), ewl_object_get_current_h(EWL_OBJECT(c))); + + DLEAVE_FUNCTION(DLEVEL_STABLE); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- ewl_window.h 14 Jan 2003 21:45:07 -0000 1.17 +++ ewl_window.h 4 Jun 2003 01:46:44 -0000 1.18 @@ -38,18 +38,11 @@ Ewl_Window *ewl_window_find_window(Window window); Ewl_Window *ewl_window_find_window_by_evas_window(Window window); Ewl_Window *ewl_window_find_window_by_widget(Ewl_Widget * w); -void ewl_window_resize(Ewl_Window * win, int w, int h); -void ewl_window_set_min_size(Ewl_Window * win, int w, int h); -void ewl_window_set_max_size(Ewl_Window * win, int w, int h); void ewl_window_set_title(Ewl_Window * win, char *title); char *ewl_window_get_title(Ewl_Window * win); -void ewl_window_get_geometry(Ewl_Window * win, int *x, int *y, - int *w, int *h); -void ewl_window_set_geometry(Ewl_Window * win, int x, int y, - int w, int h); void ewl_window_set_borderless(Ewl_Window * win); -void ewl_window_set_auto_size(Ewl_Window * win, int value); void ewl_window_move(Ewl_Window * win, int x, int y); +void ewl_window_get_position(Ewl_Window * win, int *x, int *y); Ewl_Widget *ewl_window_get_child_at(Ewl_Window * win, int x, int y); #endif /* __EWL_WINDOW_H__ */ ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs