Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_attach.c ewl_popup.c ewl_popup.h Log Message: make the popup offset configurable =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_attach.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -3 -r1.40 -r1.41 --- ewl_attach.c 6 Feb 2007 13:42:16 -0000 1.40 +++ ewl_attach.c 13 Feb 2007 05:26:21 -0000 1.41 @@ -682,6 +682,7 @@ if (!(ewl_attach_tooltip->win)) { + int oh, ov; ewl_attach_tooltip->win = ewl_popup_new(); ewl_popup_type_set(EWL_POPUP(ewl_attach_tooltip->win), @@ -694,6 +695,13 @@ ewl_attach_cb_tooltip_win_destroy, NULL); + ov = ewl_theme_data_int_get(EWL_WIDGET(w), + "/tooltip/voffset"); + oh = ewl_theme_data_int_get(EWL_WIDGET(w), + "/tooltip/hoffset"); + + ewl_popup_offset_set(EWL_POPUP(ewl_attach_tooltip->win), + oh, ov); ewl_widget_appearance_set(ewl_attach_tooltip->win, EWL_ATTACH_TOOLTIP_TYPE); ewl_widget_inherit(ewl_attach_tooltip->win, =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_popup.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- ewl_popup.c 6 Feb 2007 13:42:17 -0000 1.7 +++ ewl_popup.c 13 Feb 2007 05:26:21 -0000 1.8 @@ -192,8 +192,28 @@ DCHECK_PARAM_PTR("p", p); DCHECK_TYPE("p", p, EWL_POPUP_TYPE); - p->x = x; - p->y = y; + p->mouse.x = x; + p->mouse.y = y; + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param p: The popup to set the offset for + * @param x: the x offset + * @param y: the y offset + * @return Returns no value + * @brief This is to set the offset to where the popup will be placed + */ +void +ewl_popup_offset_set(Ewl_Popup *p, int x, int y) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("p", p); + DCHECK_TYPE("p", p, EWL_POPUP_TYPE); + + p->offset.x = x; + p->offset.y = y; DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -365,26 +385,18 @@ ewl_embed_window_position_get(emb, &win_x, &win_y); if (p->type == EWL_POPUP_TYPE_MOUSE) { - int offset_h, offset_v; - - x = win_x + p->x; - y = win_y + p->y; - - offset_v = ewl_theme_data_int_get(EWL_WIDGET(p), - "/popup/voffset"); - offset_h = ewl_theme_data_int_get(EWL_WIDGET(p), - "/popup/hoffset"); - + x = win_x + p->mouse.x; + y = win_y + p->mouse.y; - if (x + offset_h + CURRENT_W(p) > desk_w) - x -= offset_h + CURRENT_W(p); + if (x + p->offset.x + CURRENT_W(p) > desk_w) + x -= p->offset.x + CURRENT_W(p); else - x += offset_h; + x += p->offset.x; - if (y + offset_v + CURRENT_H(p) > desk_h) - y -= offset_v + CURRENT_H(p); + if (y + p->offset.y + CURRENT_H(p) > desk_h) + y -= p->offset.y + CURRENT_H(p); else - y += offset_v; + y += p->offset.y; } else if (p->type == EWL_POPUP_TYPE_MENU_VERTICAL) { =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_popup.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- ewl_popup.h 4 Jan 2007 05:09:47 -0000 1.7 +++ ewl_popup.h 13 Feb 2007 05:26:21 -0000 1.8 @@ -39,8 +39,10 @@ Ewl_Popup_Type type; /**< The Popup type */ Ewl_Widget *follow; /**< The object to follow */ - int x; /**< The x position */ - int y; /**< The y position */ + struct { + int x; /**< The x position */ + int y; /**< The y position */ + } mouse, offset; int fit_to_follow; /**< if the popup fits the size to its follow*/ }; @@ -53,6 +55,7 @@ int ewl_popup_fit_to_follow_get(Ewl_Popup *p); void ewl_popup_mouse_position_set(Ewl_Popup *p, int x, int y); +void ewl_popup_offset_set(Ewl_Popup *p, int x, int y); /* * Internal, override at your own risk ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs