Automatic generation produced by ISE Eiffel
note description: "Facilities for pick and drop mechanism.%NDecendents can act both as pick and drop sources and as targets.%NWhen the user picks a pebble from a source and drops on a target,the drop_actions of the target receive the pebble as input.%NThe user interface can be either pick and drop or drag and drop,selected by `set_pick_and_drop' and `set_drag_and_drop'." legal: "See notice at end of class." example: "Create two buttons one with the string %"Hello world!%" as pebbleand the other with agent io.put_string as a drop action.%NPicking the first button and dropping on the second will print:%N%"Hello world!%".%Nb1, b2: BUTTON%Ncreate b1; create b2%Nb1.set_pebble (%"Hello world!%")%Nb2.drop_actions.extend (agent io.put_string)" status: "See notice at end of class." keywords: "pick and drop, drag and drop, source, PND, DND" date: "$Date$" revision: "$Revision$" deferred class interface EV_PICK_AND_DROPABLE feature -- Access accept_cursor: EV_POINTER_STYLE -- `Result' is cursor displayed when the screen pointer is over a -- target that accepts pebble during pick and drop. require -- from EV_ABSTRACT_PICK_AND_DROPABLE True ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE result_not_void: Result /= Void ensure then cursor_valid: (attached implementation.accept_cursor implies Result = implementation.accept_cursor) or else Result = Default_pixmaps.Standard_cursor configurable_target_menu_handler: detachable PROCEDURE [ANY, TUPLE [menu: EV_MENU; target_list: ARRAYED_LIST [EV_PND_TARGET_DATA]; source: EV_PICK_AND_DROPABLE; source_pebble: detachable ANY]] -- Agent used for customizing the Pick and Drop Target Menu of `Current'. data: detachable ANY -- Arbitrary user data may be stored here. -- (from EV_ANY) deny_cursor: EV_POINTER_STYLE -- `Result' is cursor displayed when the screen pointer is over a -- target that does not accept pebble during pick and drop. require -- from EV_ABSTRACT_PICK_AND_DROPABLE True ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE result_not_void: Result /= Void ensure then cursor_valid: (attached implementation.deny_cursor implies Result = implementation.deny_cursor) or else Result = Default_pixmaps.No_cursor generating_type: TYPE [detachable EV_PICK_AND_DROPABLE] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty frozen id_object (an_id: INTEGER_32): detachable IDENTIFIED -- Object associated with `an_id' (void if no such object) -- (from IDENTIFIED) ensure -- from IDENTIFIED consistent: Result = Void or else Result.object_id = an_id frozen object_id: INTEGER_32 -- Unique for current object in any given session -- (from IDENTIFIED) ensure -- from IDENTIFIED valid_id: Result > 0 implies id_object (Result) = Current pebble: detachable ANY -- Data to be transported by pick and drop mechanism. require -- from EV_ABSTRACT_PICK_AND_DROPABLE True ensure then bridge_ok: Result = implementation.pebble pebble_function: detachable FUNCTION [ANY, TUPLE, detachable ANY] -- Returns data to be transported by pick and drop mechanism. require -- from EV_ABSTRACT_PICK_AND_DROPABLE True ensure then bridge_ok: Result = implementation.pebble_function pebble_positioning_enabled: BOOLEAN -- If `True' then pick and drop start coordinates are -- pebble_x_position, pebble_y_position. -- If `False' then pick and drop start coordinates are -- the pointer coordinates. require not_destroyed: not is_destroyed ensure then bridge_ok: Result = implementation.pebble_positioning_enabled pebble_x_position: INTEGER_32 -- Initial x position for pick and drop relative to `Current'. require not_destroyed: not is_destroyed ensure then bridge_ok: Result = implementation.pebble_x_position pebble_y_position: INTEGER_32 -- Initial y position for pick and drop relative to `Current'. require not_destroyed: not is_destroyed ensure then bridge_ok: Result = implementation.pebble_y_position target_data_function: detachable FUNCTION [ANY, TUPLE [like pebble], EV_PND_TARGET_DATA] -- Function for computing target meta data based on source pebble. -- Primarily used for Pick and Drop target menu. -- (from EV_ABSTRACT_PICK_AND_DROPABLE) note option: stable target_name: detachable READABLE_STRING_GENERAL -- Optional textual name describing `Current' pick and drop hole. -- (from EV_ABSTRACT_PICK_AND_DROPABLE) note option: stable feature -- Measurement height: INTEGER_32 -- Vertical size in pixels. -- Same as minimum_height when not displayed. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.height minimum_height: INTEGER_32 -- Lower bound on height in pixels. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.minimum_height positive_or_zero: Result >= 0 minimum_width: INTEGER_32 -- Lower bound on width in pixels. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.minimum_width positive_or_zero: Result >= 0 screen_x: INTEGER_32 -- Horizontal offset relative to screen. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.screen_x screen_y: INTEGER_32 -- Vertical offset relative to screen. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.screen_y width: INTEGER_32 -- Horizontal size in pixels. -- Same as minimum_width when not displayed. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.width x_position: INTEGER_32 -- Horizontal offset relative to parent x_position in pixels. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.x_position y_position: INTEGER_32 -- Vertical offset relative to parent y_position in pixels. -- (from EV_POSITIONED) require -- from EV_POSITIONED not_destroyed: not is_destroyed ensure -- from EV_POSITIONED bridge_ok: Result = implementation.y_position feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are `a' and `b' either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are `a' and `b' either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal (other: attached EV_PICK_AND_DROPABLE): BOOLEAN -- Are `Current' and `other' attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: attached EV_PICK_AND_DROPABLE): BOOLEAN -- Is `other' attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are `a' and `b' either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal (other: attached EV_PICK_AND_DROPABLE): BOOLEAN -- Is `other' attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of `other' (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void mode_is_configurable_target_menu: BOOLEAN -- Is the user interface mode a configurable pop-up menu of targets? require not_destroyed: not is_destroyed ensure then bridge_ok: Result = implementation.mode_is_configurable_target_menu mode_is_drag_and_drop: BOOLEAN -- Is the user interface mode drag and drop? require not_destroyed: not is_destroyed ensure then bridge_ok: Result = implementation.mode_is_drag_and_drop mode_is_pick_and_drop: BOOLEAN -- Is the user interface mode pick and drop? require not_destroyed: not is_destroyed ensure then bridge_ok: Result = implementation.mode_is_pick_and_drop mode_is_target_menu: BOOLEAN -- Is the user interface mode a pop-up menu of targets? require not_destroyed: not is_destroyed ensure then bridge_ok: Result = implementation.mode_is_target_menu same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of `other'? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Status setting disable_pebble_positioning -- Assign `False' to pebble_positioning_enabled. -- The pick and drop will start at the pointer position. require not_destroyed: not is_destroyed ensure pebble_positioning_updated: not pebble_positioning_enabled enable_pebble_positioning -- Assign `True' to pebble_positioning_enabled. -- Use pebble_x_position and pebble_y_position as the initial coordinates -- for the pick and drop in pixels relative to `Current'. require not_destroyed: not is_destroyed ensure pebble_positioning_updated: pebble_positioning_enabled remove_pebble -- Make pebble `Void' and pebble_function `Void, -- Removing transport. ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE pebble_removed: pebble = Void and pebble_function = Void set_accept_cursor (a_cursor: like accept_cursor) -- Set `a_cursor' to be displayed when the screen pointer is over a -- target that accepts pebble during pick and drop. require -- from EV_ABSTRACT_PICK_AND_DROPABLE a_cursor_not_void: a_cursor /= Void ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE accept_cursor_assigned: attached accept_cursor as l_accept_cursor and then l_accept_cursor.is_equal (a_cursor) set_configurable_target_menu_handler (a_handler: detachable PROCEDURE [ANY, TUPLE [menu: EV_MENU; target_list: ARRAYED_LIST [EV_PND_TARGET_DATA]; source: EV_PICK_AND_DROPABLE; source_pebble: detachable ANY]]) -- Set Configurable Target Menu Handler to `a_handler'. ensure configurable_target_menu_hander_assigned: configurable_target_menu_handler = a_handler set_configurable_target_menu_mode -- Set user interface mode to pop-up menu of targets. -- Target menu is configurable as the first option can be used to -- initiate a regular 'pick and drop' of the source pebble. require not_destroyed: not is_destroyed ensure target_menu_mode_set: mode_is_configurable_target_menu set_deny_cursor (a_cursor: like deny_cursor) -- Set `a_cursor' to be displayed when the screen pointer is not -- over a valid target. require -- from EV_ABSTRACT_PICK_AND_DROPABLE a_cursor_not_void: a_cursor /= Void ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE deny_cursor_assigned: attached deny_cursor as l_deny_cursor and then l_deny_cursor.is_equal (a_cursor) set_drag_and_drop_mode -- Set user interface mode to drag and drop. require not_destroyed: not is_destroyed ensure drag_and_drop_set: mode_is_drag_and_drop set_pebble (a_pebble: ANY) -- Assign `a_pebble' to pebble. -- Overrides set_pebble_function. require -- from EV_ABSTRACT_PICK_AND_DROPABLE a_pebble_not_void: a_pebble /= Void ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE pebble_assigned: pebble = a_pebble set_pebble_function (a_function: FUNCTION [ANY, TUPLE, detachable ANY]) -- Set `a_function' to compute pebble. -- It will be called once each time a pick occurs, the result -- will be assigned to pebble for the duration of transport. -- When a pick occurs, the pick position in widget coordinates, -- <<x, y>> in pixels, is passed. -- To handle this data use `a_function' of type -- FUNCTION [ANY, TUPLE [INTEGER, INTEGER], ANY] and return the -- pebble as a function of x and y. -- Overrides set_pebble. require -- from EV_ABSTRACT_PICK_AND_DROPABLE a_function_not_void: a_function /= Void a_function_takes_two_integer_open_operands: a_function.valid_operands ([1, 1]) ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE pebble_function_assigned: pebble_function = a_function set_pebble_position (a_x, a_y: INTEGER_32) -- Set the initial position for pick and drop -- Coordinates are in pixels and are relative to position of `Current'. -- Pebble_positioning_enabled must be `True' for the position to be used, -- use enable_pebble_positioning. require not_destroyed: not is_destroyed ensure pebble_position_assigned: pebble_x_position = a_x and pebble_y_position = a_y set_pick_and_drop_mode -- Set user interface mode to pick and drop. require not_destroyed: not is_destroyed ensure pick_and_drop_set: mode_is_pick_and_drop set_target_data_function (a_function: FUNCTION [ANY, TUPLE [like pebble], EV_PND_TARGET_DATA]) -- Set `a_function' to compute target meta data based on transport source. -- Overrides any target_name set with set_target_name. -- (from EV_ABSTRACT_PICK_AND_DROPABLE) require -- from EV_ABSTRACT_PICK_AND_DROPABLE a_function_not_void: a_function /= Void ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE target_data_function_assigned: target_data_function /= Void and then target_data_function.is_equal (a_function) set_target_menu_mode -- Set user interface mode to pop-up menu of targets. require not_destroyed: not is_destroyed ensure target_menu_mode_set: mode_is_target_menu set_target_name (a_name: READABLE_STRING_GENERAL) -- Assign `a_name' to target_name. -- (from EV_ABSTRACT_PICK_AND_DROPABLE) require -- from EV_ABSTRACT_PICK_AND_DROPABLE a_name_not_void: a_name /= Void ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE target_name_assigned: attached target_name as l_target_name and then a_name /= l_target_name and then a_name.same_string (l_target_name) show_configurable_target_menu (a_x, a_y: INTEGER_32) -- Show the configurable target menu at position `a_x', `a_y' relative to `Current'. require not_destroyed: not is_destroyed mode_is_configurable_target_menu: mode_is_configurable_target_menu configurable_menu_handler_set: configurable_target_menu_handler /= Void feature -- Element change set_data (some_data: like data) -- Assign `some_data' to data. -- (from EV_ANY) require -- from EV_ANY not_destroyed: not is_destroyed ensure -- from EV_ANY data_assigned: data = some_data feature -- Duplication copy (other: attached EV_PICK_AND_DROPABLE) -- Update current object using fields of object attached -- to `other', so as to yield equal objects. -- (from EV_ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: attached EV_PICK_AND_DROPABLE) -- Effect equivalent to that of: -- copy (`other' . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: attached EV_PICK_AND_DROPABLE -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: attached EV_PICK_AND_DROPABLE) -- Copy every field of `other' onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: attached EV_PICK_AND_DROPABLE -- New object field-by-field identical to `other'. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: attached EV_PICK_AND_DROPABLE -- New object equal to `Current' -- twin calls copy; to change copying/twining semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen as_attached: attached EV_PICK_AND_DROPABLE -- Attached version of Current -- (Can be used during transitional period to convert -- non-void-safe classes to void-safe ones.) -- (from ANY) frozen default: detachable EV_PICK_AND_DROPABLE -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type `POINTER' -- (Avoid the need to write `p'.default for -- some `p' of type `POINTER'.) -- (from ANY) default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) feature -- Command destroy -- Destroy underlying native toolkit object. -- Render `Current' unusable. -- (from EV_ANY) ensure -- from EV_ANY is_destroyed: is_destroyed feature -- Event handling conforming_pick_actions: EV_NOTIFY_ACTION_SEQUENCE -- Actions to be performed when a pebble that fits here is picked. -- (from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES) require -- from EV_ABSTRACT_PICK_AND_DROPABLE True ensure -- from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES not_void: Result /= Void drop_actions: EV_PND_ACTION_SEQUENCE -- Actions to be performed when a pebble is dropped here. -- (from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES) require -- from EV_ABSTRACT_PICK_AND_DROPABLE True ensure -- from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES not_void: Result /= Void pick_actions: EV_PND_START_ACTION_SEQUENCE -- Actions to be performed when pebble is picked up. -- (from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES) require -- from EV_ABSTRACT_PICK_AND_DROPABLE True ensure -- from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES not_void: Result /= Void pick_ended_actions: EV_PND_FINISHED_ACTION_SEQUENCE -- Actions to be performed when a transport from `Current' ends. -- If transport completed successfully, then event data -- is target. If cancelled, then event data is Void. -- (from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES) ensure -- from EV_PICK_AND_DROPABLE_ACTION_SEQUENCES not_void: Result /= Void feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of `o' -- on standard output. -- (from ANY) frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY operating_environment_not_void: Result /= Void feature -- Status Report is_destroyed: BOOLEAN -- Is `Current' no longer usable? -- (from EV_ANY) ensure -- from EV_ANY bridge_ok: Result = implementation.is_destroyed feature -- User input events pointer_motion_actions: EV_POINTER_MOTION_ACTION_SEQUENCE -- Actions to be performed when screen pointer moves. -- (from EV_ABSTRACT_PICK_AND_DROPABLE) invariant user_interface_modes_mutually_exclusive: mode_is_pick_and_drop.to_integer + mode_is_drag_and_drop.to_integer + mode_is_target_menu.to_integer = 1 -- from EV_ANY is_initialized: is_initialized default_create_called: default_create_called is_coupled: default_create_called implies implementation.interface = Current -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from EV_POSITIONED width_not_negative: is_usable implies width >= 0 height_not_negative: is_usable implies height >= 0 minimum_width_not_negative: is_usable implies minimum_width >= 0 minimum_height_not_negative: is_usable implies minimum_height >= 0 note copyright: "Copyright (c) 1984-2006, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 356 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class EV_PICK_AND_DROPABLE -- Generated by Eiffel Studio --
For more details: docs.eiffel.com