indexing description: "Eiffel Vision tree node. Carbon implementation." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class EV_TREE_NODE_IMP inherit EV_TREE_NODE_I redefine interface end EV_ITEM_LIST_IMP [EV_TREE_NODE] export {EV_TREE_IMP} child_array redefine interface end EV_ITEM_ACTION_SEQUENCES_IMP EV_PICK_AND_DROPABLE_ACTION_SEQUENCES_IMP EV_TREE_NODE_ACTION_SEQUENCES_IMP EV_PND_DEFERRED_ITEM redefine interface end EV_CARBON_DATABROWSER_ITEM undefine child_array redefine interface, text end CONTROLDEFINITIONS_FUNCTIONS_EXTERNAL export {NONE} all end create make feature {NONE} -- Initialization destroy is -- Clean up `Current' do set_is_destroyed (True) end make (an_interface: like interface) is -- Create the tree item. do base_make (an_interface) internal_text := "" end feature -- Status report is_selected: BOOLEAN is -- Is the item selected? do end is_expanded: BOOLEAN is -- is the item expanded? do Result := internal_is_expanded end feature -- Status setting enable_select is -- Select `Current' in its parent. do end disable_select is -- Disable selection of `Current' in its parent. do end set_expand (a_flag: BOOLEAN) is -- Expand the item if `flag', collapse it otherwise. local ret: INTEGER i: INTEGER do internal_is_expanded := a_flag if a_flag = true then ret := open_data_browser_container_external (parent_tree_imp.c_object, item_id) -- Make sure all children are expanded if needed from i := 1 until i >= count loop if i_th (i).is_expanded then i_th (i).implementation.set_expand (true) end i := i + 1 end else ret := close_data_browser_container_external (parent_tree_imp.c_object, item_id) end end set_text (a_text: STRING_GENERAL) is -- Set 'text' to 'a_text' local ret: INTEGER do internal_text := a_text -- .twin?? if parent_tree_imp /= Void then ret := update_data_browser_items_external (parent_tree_imp.c_object, 0, 1, $item_id, 1, 1) end end feature -- PND enable_transport is -- Enable PND transport do end disable_transport is -- Disable PND transport do end draw_rubber_band is do end erase_rubber_band is do end enable_capture is do end disable_capture is do check do_not_call: False end end start_transport ( a_x, a_y, a_button: INTEGER; a_x_tilt, a_y_tilt, a_pressure: DOUBLE; a_screen_x, a_screen_y: INTEGER) is -- Start PND transport (not needed) do check do_not_call: False end end end_transport (a_x, a_y, a_button: INTEGER; a_x_tilt, a_y_tilt, a_pressure: DOUBLE; a_screen_x, a_screen_y: INTEGER) is -- End PND transport (not needed) do check do_not_call: False end end set_pointer_style, internal_set_pointer_style (curs: EV_CURSOR) is -- Set 'pointer_style' to 'curs' (not needed) do check do_not_call: False end end is_transport_enabled_iterator: BOOLEAN is -- Has 'Current' or a child of 'Current' pnd transport enabled? do end feature {EV_TREE_IMP} -- Implementation set_pebble_void is -- Resets pebble from Tree_Imp. do pebble := Void end able_to_transport (a_button: INTEGER): BOOLEAN is -- Is the row able to transport data with `a_button' click. do end feature {EV_ANY_I} -- Implementation set_parent_imp (par_imp: like parent_imp) is do parent_imp := par_imp end parent_imp: EV_ITEM_LIST_IMP [EV_TREE_NODE] parent_tree_imp: EV_TREE_IMP is do if parent_tree /= Void then Result ?= parent_tree.implementation end end feature {EV_TREE_IMP, EV_TREE_NODE_IMP} -- Implementation internal_is_expanded: BOOLEAN -- add_item_and_children_to_parent_tree (a_parent_tree: EV_TREE_IMP; a_parent_node: EV_TREE_NODE_IMP; a_index: INTEGER) is -- -- Used for setting items within parent tree -- local -- item_imp: EV_TREE_NODE_IMP -- i: INTEGER -- do -- item_id := a_parent_tree.get_id (current) -- from -- i := 1 -- until -- i > child_array.count -- loop -- item_imp ?= (child_array @ i).implementation -- item_imp.add_item_and_children_to_parent_tree (a_parent_tree, Current, i) -- i := i + 1 -- end -- end feature {EV_TREE_IMP, EV_TREE_NODE_IMP} -- Implementation ensure_expandable is -- Ensure `Current' is displayed as expandable. do end remove_expandable is -- Ensure `Current' is no longer displayed as expandable. do end text: STRING_32 is -- Text displayed. do if internal_text = Void then create Result. make_empty else Result := internal_text.twin end ensure then text_not_void: Result /= Void end tooltip: STRING_32 is -- Tooltip if any. do if internal_tooltip = Void then Result := "" else Result := internal_tooltip.twin end ensure then tooltip_not_void: Result /= Void end remove_internal_text is -- Make `internal_text' Void do internal_text := Void end set_internal_text (a_text: STRING_GENERAL) is -- Set `internal_text' to `a_text' do internal_text := a_text end internal_text: STRING_32 -- Internal representation of `text'. internal_tooltip: STRING_32 -- Internal representation of `tooltip'. set_tooltip (a_text: STRING_GENERAL) is -- Set `a_text' to `tooltip'. do internal_tooltip := a_text end remove_tooltip is -- Remove text of `tooltip'. do internal_tooltip := "" end set_pixmap (a_pixmap: EV_PIXMAP) is -- Set the pixmap for 'Current'. local ret: INTEGER pixmap_imp: EV_PIXMAP_IMP do -- First load the pixmap into the button pixmap_imp ?= a_pixmap.implementation icon_ref := pixmap_imp.drawable end pix_width, pix_height: INTEGER -- Height and width of pixmap in Tree. remove_pixmap is -- Remove the pixmap for `Current' local par_tree: EV_TREE_IMP do par_tree := parent_tree_imp if par_tree /= Void then par_tree.update_row_pixmap (Current) end end pixmap: EV_PIXMAP is -- Pixmap displayed in 'Current' if any. do end insert_i_th (v: like item; i: INTEGER) is -- Insert `v' at position `i'. local item_imp: EV_TREE_NODE_IMP par_t_imp: EV_TREE_IMP id: INTEGER do item_imp ?= v.implementation item_imp.set_parent_imp (Current) child_array.go_i_th (i) child_array.put_left (v) par_t_imp := parent_tree_imp if par_t_imp /= Void then item_imp.add_item_and_children_to_parent_tree (par_t_imp, Current, i) end --id := parent_tree_imp.get_id (item_imp) -- Currently buggy: we may not have a tree from which we can get an ID yet. --item_imp.set_item_id (id) end remove_i_th (a_position: INTEGER) is -- Remove item at `a_position' do end expanded_on_last_item_removal: BOOLEAN -- Was `Current' expanded upon removal of last item feature {NONE} -- Redundant implementation real_pointed_target: EV_PICK_AND_DROPABLE is do check do_not_call: False end end feature {NONE} -- Implementation dispose is -- Clean up do end feature {EV_ANY_I} -- Implementation interface: EV_TREE_NODE; indexing copyright: "Copyright (c) 2006-2007, The Eiffel.Mac Team" end -- class EV_TREE_NODE_IMP