Enlightenment CVS committal Author : ningerso Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_attach.c ewl_attach.h ewl_colorpicker.c ewl_dnd.c ewl_dnd.h ewl_embed.c ewl_embed.h ewl_entry.c ewl_enums.h ewl_events.h Log Message: Renamed the DND drop data event. Updated tests and widgets to renamed data event. Additional event logging in the DND snoop test. Created new attach type for providing DND data. Minor whitespace changes. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_attach.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- ewl_attach.c 4 Nov 2006 16:58:05 -0000 1.35 +++ ewl_attach.c 5 Dec 2006 06:26:33 -0000 1.36 @@ -147,6 +147,41 @@ } /** + * @param w: The widget to attach the dnd data too + * @param c: The cursor to display during drag. + * @param data: The data to transfer on drop. + * @return Returns no value + * @brief Attaches the DND data @p data to the widget @p w with the displayed + * cursor @p c. + */ +void +ewl_attach_dnd_drag_set(Ewl_Widget *w, Ewl_Widget *c, void *data, int size) +{ + Ewl_Attach_Dnd *dnd_data; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); + DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); + + dnd_data = ewl_attach_get(w, EWL_ATTACH_TYPE_DND_DATA); + if (!c && !data) { + if (dnd_data) + FREE(dnd_data); + } + else { + if (!dnd_data) + dnd_data = NEW(Ewl_Attach_Dnd, 1); + dnd_data->cursor = c; + dnd_data->data = data; + dnd_data->size = size; + } + + ewl_attach_other_set(w, EWL_ATTACH_TYPE_DND_DATA, dnd_data); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** * @param w: The widget to get the attachment from * @param t: The type of attachment to get * @return Returns the data for the given attachment type =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_attach.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- ewl_attach.h 8 Nov 2006 06:38:55 -0000 1.16 +++ ewl_attach.h 5 Dec 2006 06:26:33 -0000 1.17 @@ -38,6 +38,21 @@ }; /** + * Ewl_Attach_Dnd provides a way to attach DND data to widgets + */ +typedef struct Ewl_Attach_Dnd Ewl_Attach_Dnd; + +/** + * DND data associated with the widget. + */ +struct Ewl_Attach_Dnd +{ + Ewl_Widget *cursor; /**< Cursor displayed for DND */ + void *data; /**< The attachment data */ + int size; /**< Any private data in the attachment */ +}; + +/** * @def ewl_attach_tooltip_text_set(w, data) * Convenience method to set a tooltip text attachment */ =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_colorpicker.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- ewl_colorpicker.c 30 Sep 2006 22:00:48 -0000 1.32 +++ ewl_colorpicker.c 5 Dec 2006 06:26:33 -0000 1.33 @@ -108,7 +108,7 @@ ewl_widget_inherit(EWL_WIDGET(cp), EWL_COLORPICKER_TYPE); ewl_dnd_accepted_types_set(EWL_WIDGET(cp), types); - ewl_callback_append(EWL_WIDGET(cp), EWL_CALLBACK_DND_DATA, + ewl_callback_append(EWL_WIDGET(cp), EWL_CALLBACK_DND_DATA_RECEIVED, ewl_colorpicker_cb_dnd_data, NULL); r = g = b = 0; @@ -746,7 +746,7 @@ unsigned int i; unsigned int curcolors[4]; Ewl_Colorpicker *cp = EWL_COLORPICKER(w); - Ewl_Event_Dnd_Data *event = ev; + Ewl_Event_Dnd_Data_Received *event = ev; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("w", w); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_dnd.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- ewl_dnd.c 1 Dec 2006 07:16:49 -0000 1.35 +++ ewl_dnd.c 5 Dec 2006 06:26:34 -0000 1.36 @@ -9,7 +9,8 @@ int EWL_CALLBACK_DND_ENTER; /**< On enter of a widget **/ int EWL_CALLBACK_DND_LEAVE; /**< On exit of a widget **/ int EWL_CALLBACK_DND_DROP; /**< Drop event **/ -int EWL_CALLBACK_DND_DATA; /**< Data event **/ +int EWL_CALLBACK_DND_DATA_RECEIVED; /**< Data received event **/ +int EWL_CALLBACK_DND_DATA_REQUEST; /**< Data request event **/ static int ewl_dragging_current; static int ewl_dnd_move_count; @@ -50,7 +51,7 @@ EWL_CALLBACK_DND_ENTER = ewl_callback_type_add(); EWL_CALLBACK_DND_LEAVE = ewl_callback_type_add(); EWL_CALLBACK_DND_DROP = ewl_callback_type_add(); - EWL_CALLBACK_DND_DATA = ewl_callback_type_add(); + EWL_CALLBACK_DND_DATA_RECEIVED = ewl_callback_type_add(); ewl_dnd_widget = NULL; ewl_dnd_status = 0; =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_dnd.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- ewl_dnd.h 29 Nov 2006 15:52:19 -0000 1.18 +++ ewl_dnd.h 5 Dec 2006 06:26:34 -0000 1.19 @@ -11,7 +11,9 @@ extern int EWL_CALLBACK_DND_ENTER; extern int EWL_CALLBACK_DND_LEAVE; extern int EWL_CALLBACK_DND_DROP; -extern int EWL_CALLBACK_DND_DATA; +extern int EWL_CALLBACK_DND_DATA_RECEIVED; + +extern int EWL_CALLBACK_DND_DATA_REQUEST; int ewl_dnd_init(void); void ewl_dnd_shutdown(void); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v retrieving revision 1.96 retrieving revision 1.97 diff -u -3 -r1.96 -r1.97 --- ewl_embed.c 15 Nov 2006 16:26:08 -0000 1.96 +++ ewl_embed.c 5 Dec 2006 06:26:34 -0000 1.97 @@ -1011,9 +1011,9 @@ * @brief Sends the event for selection data received into an embed. */ void -ewl_embed_dnd_data_feed(Ewl_Embed *embed, char *type, void *data, unsigned int len, unsigned int format) +ewl_embed_dnd_data_received_feed(Ewl_Embed *embed, char *type, void *data, unsigned int len, unsigned int format) { - Ewl_Event_Dnd_Data ev; + Ewl_Event_Dnd_Data_Received ev; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("embed", embed); @@ -1033,7 +1033,40 @@ ev.len = len; ev.format= format; ewl_callback_call_with_event_data(embed->last.drop_widget, - EWL_CALLBACK_DND_DATA, + EWL_CALLBACK_DND_DATA_RECEIVED, + &ev); + } + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param embed: the embed where the selection data request event is to occur + * @param type: The type to feed + * @return Returns no value. + * @brief Sends the request event for selection data received into an embed. + */ +void +ewl_embed_dnd_data_request_feed(Ewl_Embed *embed, char *type) +{ + Ewl_Event_Dnd_Data_Requested ev; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("embed", embed); + DCHECK_TYPE("embed", embed, EWL_EMBED_TYPE); + + /* + * If a widget is expecting DND data, send the data to the widget + */ + if (embed->last.drag_widget) { + if (ewl_dnd_provided_types_contains(embed->last.drag_widget, type)) { + /* + * setup the event struct + */ + ev.type = type; + ewl_callback_call_with_event_data(embed->last.drag_widget, + EWL_CALLBACK_DND_DATA_REQUEST, &ev); } } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- ewl_embed.h 4 Dec 2006 07:16:39 -0000 1.34 +++ ewl_embed.h 5 Dec 2006 06:26:34 -0000 1.35 @@ -113,7 +113,8 @@ const char *ewl_embed_dnd_position_feed(Ewl_Embed *embed, int x, int y,int*,int*,int*,int*); const char *ewl_embed_dnd_drop_feed(Ewl_Embed* embed, int x, int y, int internal); -void ewl_embed_dnd_data_feed(Ewl_Embed* embed, char *type, void *data, unsigned int len, unsigned int format); +void ewl_embed_dnd_data_received_feed(Ewl_Embed* embed, char *type, void *data, unsigned int len, unsigned int format); +void ewl_embed_dnd_data_request_feed(Ewl_Embed* embed, char *type); void ewl_embed_mouse_out_feed(Ewl_Embed *embed, int x, int y, unsigned int modifiers); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_entry.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -3 -r1.68 -r1.69 --- ewl_entry.c 28 Sep 2006 22:09:31 -0000 1.68 +++ ewl_entry.c 5 Dec 2006 06:26:34 -0000 1.69 @@ -58,7 +58,7 @@ 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); + ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_DATA_RECEIVED); /* setup the cursor */ e->cursor = ewl_entry_cursor_new(e); @@ -92,7 +92,7 @@ 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, + ewl_callback_append(w, EWL_CALLBACK_DND_DATA_RECEIVED, ewl_entry_cb_dnd_data, NULL); DRETURN_INT(TRUE, DLEVEL_STABLE); @@ -565,7 +565,7 @@ void ewl_entry_cb_dnd_data(Ewl_Widget *w, void *ev, void *data __UNUSED__) { - Ewl_Event_Dnd_Data *event; + Ewl_Event_Dnd_Data_Received *event; Ewl_Text *txt; DENTER_FUNCTION(DLEVEL_STABLE); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_enums.h,v retrieving revision 1.66 retrieving revision 1.67 diff -u -3 -r1.66 -r1.67 --- ewl_enums.h 29 Nov 2006 15:51:53 -0000 1.66 +++ ewl_enums.h 5 Dec 2006 06:26:34 -0000 1.67 @@ -470,7 +470,8 @@ EWL_ATTACH_TYPE_NAME, EWL_ATTACH_TYPE_MOUSE_CURSOR, EWL_ATTACH_TYPE_MOUSE_ARGB_CURSOR, - EWL_ATTACH_TYPE_WIDGET_ASSOCIATION + EWL_ATTACH_TYPE_WIDGET_ASSOCIATION, + EWL_ATTACH_TYPE_DND_DATA }; /** =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_events.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- ewl_events.h 26 Oct 2006 15:07:04 -0000 1.19 +++ ewl_events.h 5 Dec 2006 06:26:34 -0000 1.20 @@ -196,8 +196,8 @@ */ struct Ewl_Event_Dnd_Position { - int x; /**< X coordinate the mouse moved to */ - int y; /**< Y coordinate the mouse moved to */ + int x; /**< X coordinate the mouse moved to */ + int y; /**< Y coordinate the mouse moved to */ }; /** @@ -210,8 +210,8 @@ */ struct Ewl_Event_Dnd_Drop { - int x; /**< X coordinate the mouse moved to */ - int y; /**< Y coordinate the mouse moved to */ + int x; /**< X coordinate the mouse moved to */ + int y; /**< Y coordinate the mouse moved to */ void* data; /**< Data from drop source */ }; @@ -223,18 +223,31 @@ /** * Provides information about dnd drop data */ -struct Ewl_Event_Dnd_Data +struct Ewl_Event_Dnd_Data_Received { char *type; /**< Type of data from drop source */ void *data; /**< Data from drop source */ - unsigned int len; /**< Length of received data */ - unsigned int format; /**< Bit format of received data */ + unsigned int len; /**< Length of received data */ + unsigned int format; /**< Bit format of received data */ }; /** - * The Ewl_Event_Dnd_Data type + * The Ewl_Event_Dnd_Data_Received type */ -typedef struct Ewl_Event_Dnd_Data Ewl_Event_Dnd_Data; +typedef struct Ewl_Event_Dnd_Data_Received Ewl_Event_Dnd_Data_Received; + +/** + * Provides information about dnd data requests + */ +struct Ewl_Event_Dnd_Data_Requested +{ + char *type; /**< Type of data requested */ +}; + +/** + * The Ewl_Event_Dnd_Data_Requested type + */ +typedef struct Ewl_Event_Dnd_Data_Requested Ewl_Event_Dnd_Data_Requested; /** * The Ewl_Dialog_Evenet type ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs