12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796 |
- class IUP_TREE
- -- Creates a tree containing nodes of branches or leaves. Both branches and
- -- leaves can have an associated text and image.
- --
- -- The branches can be expanded or collapsed. When a branch is expanded, its
- -- immediate children are visible, and when it is collapsed they are hidden.
- --
- -- The leaves can generate an "executed" or "renamed" actions, branches can
- -- only generate a "renamed" action.
- --
- -- The focus node is the node with the focus rectangle, marked nodes have their
- -- background inverted.
- inherit
- IUP_WIDGET
- undefine
- execute_dragbegin,
- execute_dragdatasize,
- execute_dragdata,
- execute_dragend,
- execute_dropdata,
- execute_dropmotion
- redefine
- execute_map,
- execute_unmap,
- execute_destroy,
- execute_getfocus,
- execute_killfocus,
- execute_enterwindow,
- execute_leavewindow,
- execute_k_any,
- execute_help,
- execute_button,
- execute_motion,
- execute_dropfiles,
- execute_dragdrop,
- execute_rightclick,
- execute_selection,
- execute_multiselection,
- execute_multiunselection,
- execute_branchopen,
- execute_branchclose,
- execute_executeleaf,
- execute_showrename,
- execute_rename,
- execute_noderemoved,
- execute_togglevalue
- end
- IUP_WIDGET_BGCOLOR
- IUP_WIDGET_EXPAND
- IUP_WIDGET_FGCOLOR
- IUP_WIDGET_ACTIVE
- IUP_WIDGET_FONT
- IUP_WIDGET_SCREENPOSITION
- IUP_WIDGET_POSITION
- IUP_WIDGET_MAXMIN_SIZE
- IUP_WIDGET_TIP
- IUP_WIDGET_SIZE
- IUP_WIDGET_RASTERSIZE
- IUP_WIDGET_USERSIZE
- IUP_WIDGET_VISIBLE
- IUP_WIDGET_ZORDER
- IUP_WIDGET_TITLE
- IUP_WIDGET_SPACING
- redefine
- set_spacing
- end
- IUP_WIDGET_CHILD
- IUP_WIDGET_NAME
- IUP_WIDGET_FOCUS
- IUP_WIDGET_PROPAGATEFOCUS
- IUP_DRAG_AND_DROP
- IUP_WIDGET_CUSTOM_ATTRIBUTES
- create {ANY}
- tree
- feature {ANY}
- tree
- -- A new tree
- local
- a_tree: POINTER
- do
- a_tree := int_tree
- set_widget(a_tree)
- end
- -- General attributes
- set_add_expanded (state: BOOLEAN)
- -- (non inheritable): Defines if branches will be expanded when created.
- -- The branch will be actually expanded when it receives the first child.
- -- Possible values: "True" = The branches will be created expanded;
- -- "False" = The branches will be created collapsed. Default: "True".
- do
- iup_open.set_attribute(Current, "ADDEXPANDED", boolean_to_yesno(state))
- end
- set_add_root (state: BOOLEAN)
- -- (non inheritable): automatically adds an empty branch as the first
- -- node when the tree is mapped. Default: "True".
- do
- iup_open.set_attribute(Current, "ADDROOT", boolean_to_yesno(state))
- end
- set_auto_redraw (state: BOOLEAN)
- -- [Windows] (non inheritable): automatically redraws the tree when
- -- something has change. Set to False to add many items to the tree
- -- without updating the display. Default: "True".
- do
- iup_open.set_attribute(Current, "AUTOREDRAW", boolean_to_yesno(state))
- end
- set_can_focus (state: BOOLEAN)
- -- (creation only) (non inheritable): enables the focus traversal of the
- -- control. In Windows the control will still get the focus when clicked.
- -- Default: True.
- do
- iup_open.set_attribute(Current, "CANFOCUS", boolean_to_yesno(state))
- end
- set_drag_drop_tree (state: BOOLEAN)
- -- (non inheritable): enable or disable the drag and drop of nodes
- -- between trees, in the same IUP application. Drag & Drop attributes
- -- must be set in order to activate the drag & drop support. On the other
- -- hand, it is not necessary to register drag & drop callbacks.
- -- Default: False.
- do
- iup_open.set_attribute(Current, "DRAGDROPTREE", boolean_to_yesno(state))
- end
- set_as_drop_files_target (state: BOOLEAN)
- -- [Windows and GTK Only] (non inheritable): Enable or disable the drop
- -- of files. Default: False, but if DROPFILES_CB is defined when the
- -- element is mapped then it will be automatically enabled. This is NOT
- -- related to the drag&drop of nodes inside the tree.
- do
- iup_open.set_attribute(Current, "DROPFILESTARGET", boolean_to_yesno(state))
- end
- set_drop_equal_drag (state: BOOLEAN)
- -- (non inheritable): if enabled will allow a drop node to be equal to
- -- the drag node. Used only if SHOWDRAGDROP = True. In the case the nodes
- -- are equal the callback return value is ignored and nothing is done
- -- after.
- do
- iup_open.set_attribute(Current, "DROPEQUALDRAG", boolean_to_yesno(state))
- end
- set_empty_as_3state (state: BOOLEAN)
- -- (non inheritable) [Windows Only]: when SHOWTOGGLE=True, the empty
- -- space left in nodes that NODEVISIBLEid=False is filled with the image
- -- of the 3state toggle. Can be True or False. Default: False.
- do
- iup_open.set_attribute(Current, "EMPTYAS3STATE", boolean_to_yesno(state))
- end
- set_hide_buttons (state: BOOLEAN)
- -- (creation only): hide the expand and collapse buttons. In GTK,
- -- branches will be only expanded programmatically. In Motif it did not
- -- work and crash the test.
- do
- iup_open.set_attribute(Current, "HIDEBUTTONS", boolean_to_yesno(state))
- end
- set_hide_lines (state: BOOLEAN)
- -- (creation only): hide the lines that connect the nodes in the
- -- hierarchy.
- do
- iup_open.set_attribute(Current, "HIDELINES", boolean_to_yesno(state))
- end
- set_rgb_highlight_color (red: INTEGER; green: INTEGER; blue: INTEGER)
- -- [Windows and Motif Only] (non inheritable): the background color of
- -- the selected node. Default: TXTHLCOLOR global attribute.
- do
- iup_open.set_attribute(Current, "HLCOLOR", rgb_to_string(red, green, blue))
- end
- set_hexadecimal_highlight_color (color: STRING)
- -- Same as set_rgb_hlcolor but usign an hexadecimal
- -- value (#RRGGBB).
- local
- tup: TUPLE[INTEGER, INTEGER, INTEGER]
- do
- tup := hexadecimal_to_rgb(color)
- set_rgb_highlight_color(tup.integer_32_item(1), tup.integer_32_item(2), tup.integer_32_item(3))
- end
- reset_highlight_color
- -- Reset the background color of the selected node.
- do
- iup_open.reset_attribute(Current, "HLCOLOR")
- end
- set_indentation (value: INTEGER)
- -- Sets the indentation level in pixels. The visual effect of changing
- -- the indentation is highly system dependent. In GTK it acts as an
- -- additional indent value, and the lines do not follow the extra indent.
- -- In Windows is limited to a minimum of 5 pixels.
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "INDENTATION", value.out)
- end
- set_info_tip (state: BOOLEAN)
- -- [Windows Only]: the TIP is shown every time an item is highlighted.
- -- This is the default behavior for TIPs in native tree controls in
- -- Windows, if set to False then it will use the regular TIP behavior.
- -- Default: True.
- do
- iup_open.set_attribute(Current, "INFOTIP", boolean_to_yesno(state))
- end
- set_show_drag_drop (state: BOOLEAN)
- -- (creation only) (non inheritable): Enables the internal drag and drop
- -- of nodes, and enables the DRAGDROP_CB callback. Default: "False".
- -- Works only if MARKMODE=SINGLE.
- do
- iup_open.set_attribute(Current, "SHOWDRAGDROP", boolean_to_yesno(state))
- end
- set_show_toggle (state: STRING)
- -- (creation only) (non inheritable): enables the use of toggles for all
- -- nodes of the tree. Can be "YES", "3STATE" or NO". Default: "NO". In
- -- Motif Versions 2.1.x and 2.2.x, the images are disabled (toggle and
- -- text only are drawn in nodes of the tree).
- do
- iup_open.set_attribute(Current, "SHOWTOGGLE", state)
- end
- set_spacing (value: INTEGER)
- -- vertical internal padding for each node. Notice that the distance
- -- between each node will be actually 2x the spacing.
- do
- Precursor (value)
- end
- set_top_item (value: INTEGER)
- -- (write-only): position the given node identifier at the top of the
- -- tree or near to make it visible. If any parent node is collapsed then
- -- they are automatically expanded.
- do
- iup_open.set_attribute(Current, "TOPITEM", value.out)
- end
- -- Attributes for nodes
- get_count: INTEGER
- -- (read only) (non inheritable): returns the total number of nodes in
- -- the tree.
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "COUNT")
- if str.is_integer then
- Result := str.to_integer
- end
- end
- get_child_count_at (id: INTEGER): INTEGER
- require
- id >= 0
- local
- str: STRING
- do
- str := iup_open.get_attribute_id(Current, "CHILDCOUNT", id)
- if str.is_integer then
- Result := str.to_integer
- end
- end
-
- get_total_child_count_at (id: INTEGER): INTEGER
- -- (read only): returns the total children count of the specified branch.
- -- It counts all grandchildren.
- require
- id >= 0
- local
- str: STRING
- do
- str := iup_open.get_attribute_id(Current, "TOTALCHILDCOUNT", id)
- if str.is_integer then
- Result := str.to_integer
- end
- end
- get_root_count: INTEGER
- -- Returns the number of root nodes.
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "ROOTCOUNT")
- if str.is_integer then
- Result := str.to_integer
- end
- end
- set_rgb_color_at (red, green, blue, id: INTEGER;)
- -- Text foreground color of the specified node. The value should be a
- -- string in the format "R G B"
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "COLOR", id, rgb_to_string(red, green, blue))
- end
- get_depth_at (id: INTEGER): INTEGER
- -- (read only): returns the depth of the specified node. The first node
- -- has depth=0, its immediate children has depth=1, their children has
- -- depth=2 and so on.
- require
- id >= 0
- local
- str: STRING
- do
- str := iup_open.get_attribute_id(Current, "DEPTH", id)
-
- if str.is_integer then
- Result := str.to_integer
- end
- end
- get_kind_at (id: INTEGER): STRING
- -- (read only): returns the kind of the specified node. Possible values:
- --
- -- "LEAF": The node is a leaf
- -- "BRANCH": The node is a branch
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "KIND", id)
- end
- get_parent_at (id: INTEGER): INTEGER
- -- (read only): returns the identifier of the specified node.
- require
- id >= 0
- local
- str: STRING
- do
- str := iup_open.get_attribute_id(Current, "PARENT", id)
-
- if str.is_integer then
- Result := str.to_integer
- end
- end
- get_next_at (id: INTEGER): STRING
- -- Returns the next brother (same depth) of the specified node. Returns
- -- an empty string if at last child node of the parent (at the same
- -- depth).
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "NEXT", id)
- end
- get_previous_at (id: INTEGER): STRING
- -- Returns the previous brother (same depth) of the specified node.
- -- Returns an empty string if at first child node of the parent (at the
- -- same depth).
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "PREVIOUS", id)
- end
- get_last_at (id: INTEGER): STRING
- -- Returns the last brother (same depth) of the specified node.
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "LAST", id)
- end
- get_first_at (id: INTEGER): STRING
- -- Returns the first brother (same depth) of the specified node. This is
- -- the same as getting the first child of the parent of the given node.
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "FIRST", id)
- end
- set_state_at (state: STRING; id: INTEGER)
- require
- is_valid_state(state)
- id >= 0
- do
- iup_open.set_attribute_id(Current, "STATE", id, state)
- end
- get_state_at (id: INTEGER): STRING
- -- The state of the specified branch. Returns Void for a LEAF.
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "STATE", id)
- end
- set_title_at (title: STRING; id: INTEGER)
- -- The text label of the specified node.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "TITLE", id, title)
- end
- get_title_at (id: INTEGER): STRING
- -- The text label of the specified node.
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "TITLE", id)
- end
- set_title_font_at (font: STRING; id: INTEGER)
- -- The text font of the specified node. The format is the same
- -- used at set_font.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "TITLEFONT", id, font)
- end
- set_title_font_style_at (style: STRING; id: INTEGER)
- -- Changes the font style of the specified node.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "TITLEFONTSTYLE", id, style)
- end
- set_title_font_size_at (size, id: INTEGER)
- -- Changes the font size of the specified node.
- require
- size > 0
- id >= 0
- do
- iup_open.set_attribute_id(Current, "TITLEFONTSIZE", id, size.out)
- end
- set_toggle_value_at (value: STRING; id: INTEGER)
- -- (non inheritable): defines the toggle state. Values can be "ON" or
- --"OFF". If SHOW3STATE=True then can also be "NOTDEF". Default: "OFF".
- require
- is_valid_toggle (value)
- id >= 0
- do
- iup_open.set_attribute_id(Current, "VALUE", id, value)
- end
- set_toggle_visible_at (state: BOOLEAN; id: INTEGER)
- -- (non inheritable): defines the toggle visible state.
- -- Default: "True".
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "TOGGLEVISIBLE", id, boolean_to_yesno(state))
- end
- set_user_data_at (data: STRING; id: INTEGER)
- -- The user data associated with the specified node.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "USERDATA", id, data)
- end
- get_user_data_at (id: INTEGER): STRING
- -- The user data associated with the specified node.
- require
- id >= 0
- do
- Result := iup_open.get_attribute_id(Current, "USERDATA", id)
- end
- -- Attributes for images
- set_image_at (image: STRING; id: INTEGER)
- -- (write only): image name to be used in the specified node, where id is
- -- the specified node identifier. Use set_widget_name to associate
- -- an image to a name. See also IUP_IMAGE. In Windows and Motif set the
- -- BGCOLOR attribute before setting the image. If node is a branch it is
- -- used when collapsed.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "IMAGE", id, image)
- end
- set_image_expanded_at (image: STRING; id: INTEGER)
- -- (write only): same as the IMAGE attribute but used for expanded
- -- branches.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "IMAGEEXPANDED", id, image)
- end
- set_image_leaf(image: STRING)
- -- The image name that will be shown for all leaves. Default: "IMGLEAF".
- -- Internal values "IMGBLANK" and "IMGPAPER" are also available. If
- -- BGCOLOR is set the image is automatically updated.
- do
- iup_open.set_attribute(Current, "IMAGELEAF", image)
- end
- set_image_branch_collapsed (image: STRING)
- -- The image name that will be shown for all collapsed branches.
- -- Default: "IMGCOLLAPSED". If BGCOLOR is set the image is automatically
- -- updated.
- do
- iup_open.set_attribute(Current, "IMAGEBRANCHCOLLAPSED", image)
- end
- set_image_branch_expanded (image: STRING)
- -- The image name that will be shown for all expanded branches.
- -- Default: "IMGEXPANDED". If BGCOLOR is set the image is automatically
- -- updated.
- do
- iup_open.set_attribute(Current, "IMAGEBRANCHEXPANDED", image)
- end
- -- Attributes for node
- set_value (id: INTEGER)
- -- (non inheritable): The focus node identifier. When changed and
- -- MARKMODE=SINGLE the node is also selected. The tree is always scrolled
- -- so the node becomes visible. In Motif the tree will also receive the
- -- focus.
- require
- id >= 0
- do
- iup_open.set_attribute(Current, "VALUE", id.out)
- end
- get_value: INTEGER
- -- (non inheritable): The focus node identifier. When retrieved but
- -- there isn't a node with focus it returns 0 if there are any nodes, and
- -- returns -1 if there are no nodes.
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "VALUE")
- if str.is_integer then
- Result := str.to_integer
- end
- end
- -- Special operations for nodes
- select_first
- -- The first node.
- do
- iup_open.set_attribute(Current, "VALUE", "FIRST")
- end
- select_last
- -- The last node.
- do
- iup_open.set_attribute(Current, "VALUE", "LAST")
- end
- select_next
- -- The next node.
- do
- iup_open.set_attribute(Current, "VALUE", "NEXT")
- end
- select_previous
- -- The previous node.
- do
- iup_open.set_attribute(Current, "VALUE", "PREVIOUS")
- end
- select_page_down
- -- The next visible node, ten nodes after the focus node. If at the last
- -- does nothing.
- do
- iup_open.set_attribute(Current, "VALUE", "PGDN")
- end
- select_page_up
- -- The previous visible node, ten nodes before the focus node. If at the
- -- first does nothing.
- do
- iup_open.set_attribute(Current, "VALUE", "PGUP")
- end
- clear
- -- Clears the selection of the focus node.
- do
- iup_open.set_attribute(Current, "VALUE", "CLEAR")
- end
- -- Attributes to marks
- set_mark (first, last: INTEGER)
- -- (write only) (non inheritable): Selects a range of nodes in the
- -- format "first-last". Allowed only when MARKMODE=MULTIPLE.
- require
- first >= 0
- last >= 0
- local
- str: STRING
- do
- str := first.out
- str.append_string("-")
- str.append_string(last.out
- )
- iup_open.set_attribute(Current, "MARK", str)
- end
- invert_mark_at (id: INTEGER)
- -- Inverts the specified node selected state, where id is the specified
- -- node identifier. If id is empty or invalid, then the focus node is
- -- used as reference node.
- require
- id >= 0
- local
- str: STRING
- do
- str := "INVERT"
- str.append_string(id.out)
-
- iup_open.set_attribute(Current, "MARK", str)
- end
- mark_block
- -- Selects all nodes between the focus node and the initial block-marking
- -- node defined by set_mark_start.
- do
- iup_open.set_attribute(Current, "MARK", "BLOCK")
- end
- clear_all
- -- Clear the selection of all nodes.
- do
- iup_open.set_attribute(Current, "MARK", "CLEARALL")
- end
- mark_all
- -- Selects all nodes.
- do
- iup_open.set_attribute(Current, "MARK", "MARKALL")
- end
- invert_all
- -- Inverts the selection of all nodes.
- do
- iup_open.set_attribute(Current, "MARK", "INVERTALL")
- end
- set_marked_at (state: BOOLEAN; id: INTEGER)
- -- (non inheritable): The selection state of the specified node, where id
- -- is the specified node identifier. If id is empty or invalid, then the
- -- focus node is used as reference node. State can be: True or False.
- -- Default: False.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "MARKED", id, boolean_to_yesno(state))
- end
- get_marked_at (id: INTEGER): BOOLEAN
- -- Get the marked state at the specified node.
- local
- str: STRING
- do
- str := iup_open.get_attribute_id(Current, "MARKED", id)
- Result := yesno_to_boolean(str)
- end
- set_marked_nodes (value: STRING)
- -- (non inheritable): The selection state of all nodes when
- -- MARKMODE=MULTIPLE. It accepts a sequence of '+' and '-' symbols
- -- indicating the state of each item ('+'=selected, '-'=unselected. When
- -- setting this value, if the number of specified symbols is smaller than
- -- the total count then the remaining nodes will not be changed.
- do
- iup_open.set_attribute(Current, "MARKEDNODES", value)
- end
- get_marked_nodes: STRING
- -- The selection state of the nodes. It is a sequence of '+' and '-'
- -- symbols indicating the state of each item ('+'=selected,
- -- '-'=unselected.
- do
- Result := iup_open.get_attribute(Current, "MARKEDNODES")
- end
- set_mark_mode (value: STRING)
- -- Defines how the nodes can be selected. Can be: SINGLE or MULTIPLE.
- -- Default: SINGLE.
- require
- is_valid_mode(value)
- do
- iup_open.set_attribute(Current, "MARKMODE", value)
- end
- set_mark_start (id: INTEGER)
- -- (non inheritable): Defines the initial node for the block marking, used
- -- in mark_block. The value must be the node identifier. Default: 0
- -- (first node).
- require
- id >= 0
- do
- iup_open.set_attribute(Current, "MARKSTART", id.out)
- end
- set_mark_when_toggle (state: BOOLEAN)
- -- (non inheritable) [GTK and Windows Only]: selects or clears the
- -- selection of a node when its toggle is changed. Works only if the node
- -- has a toggle. Default: False.
- do
- iup_open.set_attribute(Current, "MARKWHENTOGGLE", boolean_to_yesno(state))
- end
- -- Hierarchy attributes
- add_leaf_at (value: STRING; id: INTEGER)
- -- (write only): Adds a new leaf after the reference node, where id is
- -- the reference node identifier. Use id = -1 to add before the first
- -- node. The value is used as the text label of the new node. The id of
- -- the new node will be the id of the reference node + 1. The attribute
- -- LASTADDNODE is set to the new id. The reference node is marked and all
- -- others unmarked. The reference node position remains the same. If the
- -- reference node does not exist, nothing happens. If the reference node
- -- is a branch then the depth of the new node is one depth increment from
- -- the depth of the reference node, if the reference node is a leaf then
- -- the new node has the same depth. If you need to add a node after a
- -- specified node but at a different depth use insert_leaf_at. Ignored if
- -- set before map.
- require
- id >= -2
- do
- iup_open.set_attribute_id(Current, "ADDLEAF", id, value)
- end
- get_last_added_node: INTEGER
- -- The id of tha last added node.
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "LASTADDNODE")
- if str.is_integer then
- Result := str.to_integer
- end
- end
- add_branch_at (value: STRING; id: INTEGER)
- -- (write only): Same as add_leaf_at for branches. Branches can be
- -- created expanded or collapsed depending on set_add_expanded. Ignored
- -- if set before map.
- require
- id >= -2
- do
- iup_open.set_attribute_id(Current, "ADDBRANCH", id, value)
- end
- copy_node_to (node_id, target_id: INTEGER)
- -- (write only): Copies a node and its children, where node_id is the
- -- specified node identifier. The target_id is the destination node
- -- identifier. If the destination node is a branch and it is expanded,
- -- then the specified node is inserted as the first child of the
- -- destination node. If the branch is not expanded or the destination
- -- node is a leaf, then it is inserted as the next brother of the leaf.
- -- The specified node is not changed. All node attributes are copied,
- -- except user data. Ignored if set before map.
- require
- node_id >= 0
- target_id >= 0
- do
- iup_open.set_attribute_id(Current, "COPYNODE", node_id, target_id.out)
- end
- delete_all_nodes
- -- Deletes all nodes.
- do
- iup_open.set_attribute_id(Current, "DELNODE", 1, "ALL")
- end
- delete_node_at (id: INTEGER)
- -- Deletes the specified node and its children (if any).
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "DELNODE", id, "SELECTED")
- end
- delete_node_children_at (id: INTEGER)
- -- Deletes only the children of the specified node.
- require
- id >= 0
- do
- iup_open.set_attribute_id(Current, "DELNODE", id, "CHILDREN")
- end
- delete_selected_nodes
- -- Deletes all the selected nodes (and all their children),
- do
- iup_open.set_attribute_id(Current, "DELNODE", 1, "MARKED")
- end
- expand_all
- -- (write only): expand all nodes.
- do
- iup_open.set_attribute(Current, "EXPANDALL", "YES")
- end
- contract_all
- -- (write only): contracts all nodes.
- do
- iup_open.set_attribute(Current, "EXPANDALL", "NO")
- end
- insert_leaf_at (value: STRING; id: INTEGER)
- -- (write only): Same as add_leaf but the depth of the new node is always
- -- the same of the reference node. If the reference node is a leaf, then
- -- the id of the new node will be the id of the reference node + 1. If
- -- the reference node is a branch the id of the new node will be the id
- -- of the reference node + 1 + the total number of child nodes of the
- -- reference node.
- require
- id >= -2
- do
- iup_open.set_attribute_id(Current, "INSERTLEAF", id, value)
- end
- insert_branch_at (value: STRING; id: INTEGER)
- -- (write only): Same as insert_leaf_at for branches. Branches can be
- -- created expanded or collapsed depending on set_add_expanded. Ignored
- -- if set before map.
- require
- id >= -2
- do
- iup_open.set_attribute_id(Current, "INSERTBRANCH", id, value)
- end
- move_node_at (node_id, target_id: INTEGER)
- -- (write only): Moves a node and its children, where node_id is the
- -- specified node identifier. The target_id is the destination node
- -- identifier. If the destination node is a branch and it is expanded,
- -- then the specified node is inserted as the first child of the
- -- destination node. If the branch is not expanded or the destination
- -- node is a leaf, then it is inserted as the next brother of the leaf.
- -- The specified node is removed. User data and all node attributes are
- -- preserved. Ignored if set before map.
- require
- node_id >= 0
- target_id >= 0
- do
- iup_open.set_attribute_id(Current, "MOVENODE", node_id, target_id.out)
- end
- -- Editing attributes
- start_rename
- -- (write only): Forces a rename action to take place. Valid only when
- -- set_show_rename = True.
- do
- iup_open.set_attribute(Current, "RENAME", "YES")
- end
- set_rename_position (position: INTEGER)
- -- (write only): the caret’s position of the text box when in-place
- -- renaming. The first position is "1". Used only once after
- -- SHOWRENAME_CB is called and before the text box is shown.
- require
- position >= 1
- do
- iup_open.set_attribute(Current, "RENAMEPOSITION", position.out)
- end
- set_rename_selection (col1, col2: INTEGER)
- -- (write only): the selection interval of the text box when in-place
- -- renaming. Used only once after SHOWRENAME_CB is called and before the
- -- text box is shown.
- --
- -- Selection interval in characters. Where col1 and col2 are integer
- -- numbers corresponding to the selection's interval. col2 correspond to
- -- the character after the last selected character.
- -- In Windows, when changing the selection the caret position is also
- -- changed.
- local
- str: STRING
- do
- create str.make_from_string(col1.out)
- str.append_string(":")
- str.append_string(col2.out)
-
- iup_open.set_attribute(Current, "RENAMESELECTION", str)
- end
- set_show_rename (state: BOOLEAN)
- -- (creation in Windows) (non inheritable): Allows the in place rename of
- -- a node. Default: "False". Since IUP 3.0, F2 and clicking twice only
- -- starts to rename a node if SHOWRENAME=True. In Windows must be set to
- -- True before map, but can be changed later.
- do
- iup_open.set_attribute(Current, "SHOWRENAME", boolean_to_yesno(state))
- end
- -- Coordination to pos
- convert_xy_to_pos (x, y: INTEGER): INTEGER
- -- Converts a (x,y) coordinate in a node position.
- -- Returns: a node identifier starting at 0. If fails returns -1.
- do
- Result := iup_open.iup_convert_xy_to_pos (Current, x, y)
- end
- -- Callbacks
- -- Common
- set_cb_map (act: detachable FUNCTION[TUPLE[IUP_TREE], STRING])
- -- Called right after an element is mapped and its attributes updated.
- local
- operation: INTEGER
- do
- cb_map := act
-
- if cb_map /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MAP_CB", "NONEEDED", operation)
- end
- set_cb_unmap (act: detachable FUNCTION[TUPLE[IUP_TREE], STRING])
- -- Called right before an element is unmapped.
- local
- operation: INTEGER
- do
- cb_unmap := act
- if cb_unmap /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "UNMAP_CB", "NONEEDED", operation)
- end
- set_cb_destroy (act: detachable FUNCTION[TUPLE[IUP_TREE], STRING])
- -- Called right before an element is destroyed.
- local
- operation: INTEGER
- do
- cb_destroy := act
- if cb_destroy /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "DESTROY_CB", "NONEEDED", operation)
- end
- set_cb_get_focus (act: detachable FUNCTION[TUPLE[IUP_TREE], STRING])
- -- Action generated when an element is given keyboard focus.
- -- This callback is called after the KILLFOCUS_CB of the element
- -- that loosed the focus. The {IUP}.get_focus function during the
- -- callback returns the element that loosed the focus.
- local
- operation: INTEGER
- do
- cb_getfocus := act
- if cb_getfocus /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "GETFOCUS_CB", "NONEEDED", operation)
- end
- set_cb_kill_focus (act: detachable FUNCTION[TUPLE[IUP_TREE], STRING])
- -- Action generated when an element loses keyboard focus. This
- -- callback is called before the GETFOCUS_CB of the element that
- -- gets the focus.
- local
- operation: INTEGER
- do
- cb_killfocus := act
- if cb_killfocus /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "KILLFOCUS_CB", "NONEEDED", operation)
- end
- set_cb_enter_window (act: detachable FUNCTION[TUPLE[IUP_TREE], STRING])
- -- Action generated when the mouse enters the native element.
- local
- operation: INTEGER
- do
- cb_enterwindow := act
- if cb_enterwindow /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "ENTERWINDOW_CB", "NONEEDED", operation)
- end
- set_cb_leave_window (act: detachable FUNCTION[TUPLE[IUP_TREE], STRING])
- -- Action generated when the mouse leaves the native element.
- local
- operation: INTEGER
- do
- cb_leavewindow := act
- if cb_leavewindow /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "LEAVEWINDOW_CB", "NONEEDED", operation)
- end
- set_cb_k_any (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING])
- -- Action generated when a keyboard event occurs.
- -- IUP_WIDGET the element that activated the event.
- -- INTEGER identifier of typed key. Please refer to the Keyboard
- -- Codes table for a list of possible values.
- --
- -- Returns: If IUP_IGNORE is returned the key is ignored and not
- -- processed by the control and not propagated. If returns
- -- IUP_CONTINUE, the key will be processed and the event will be
- -- propagated to the parent of the element receiving it, this is
- -- the default behavior. If returns IUP_DEFAULT the key is processed
- -- but it is not propagated. IUP_CLOSE will be processed.
- local
- operation: INTEGER
- do
- cb_k_any := act
- if cb_k_any /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "K_ANY", "NONEEDED", operation)
- end
- set_cb_help (act: detachable PROCEDURE[TUPLE[IUP_TREE]])
- -- Action generated when the user press F1 at a control. In Motif
- -- is also activated by the Help button in some workstations
- -- keyboard.
- -- Returns: IUP_CLOSE will be processed.
- local
- operation: INTEGER
- do
- cb_help := act
- if cb_help /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "HELP_CB", "NONEEDED", operation)
- end
- -- Extra
- set_cb_button (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING])
- -- Action generated when any mouse button is pressed and when it is
- -- released. Both calls occur before the ACTION callback when button 1 is
- -- being used.
- --
- -- IUP_BUTTON: identifies the element that activated the event.
- -- button: identifies the activated mouse button:
- --
- -- 1 - left mouse button (button 1);
- -- 2 - middle mouse button (button 2);
- -- 3 - right mouse button (button 3).
- --
- -- pressed: indicates the state of the button:
- --
- -- 0 - mouse button was released;
- -- 1 - mouse button was pressed.
- --
- -- x, y: position in the canvas where the event has occurred, in pixels.
- --
- -- status: status of the mouse buttons and some keyboard keys at the
- -- moment the event is generated. The following IUP features must be used
- -- for verification:
- --
- -- is_shift(status)
- -- is_control(status)
- -- is_button_1(status)
- -- is_button_2(status)
- -- is_button_3(status)
- -- is_button_4(status)
- -- is_button_5(status)
- -- is_double(status)
- -- is_alt(status)
- -- is_sys(status)
- --
- -- Returns: IUP_CLOSE will be processed. On some controls if IUP_IGNORE
- -- is returned the action is ignored (this is system dependent).
- local
- operation: INTEGER
- do
- cb_button := act
- if cb_button /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "BUTTON_CB", "NONEEDED", operation)
- end
- set_cb_motion (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER, STRING], STRING])
- -- Action generated when the mouse moves.
- -- ih: identifier of the element that activated the event.
- -- x, y: position in the canvas where the event has occurred, in pixels.
- -- status: status of mouse buttons and certain keyboard keys at the
- -- moment the event was generated. The same macros used for BUTTON_CB can
- -- be used for this status.
- local
- operation: INTEGER
- do
- cb_motion := act
- if cb_motion /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MOTION_CB", "NONEEDED", operation)
- end
- set_cb_drop_files (act: detachable FUNCTION[TUPLE[IUP_TREE, STRING, INTEGER, INTEGER, INTEGER], STRING])
- -- [Windows and GTK Only]: Action generated when one or more files are
- -- dropped in the element.
- -- If defined after the element is mapped then the attribute
- -- DROPFILESTARGET must be set to YES. [Windows and GTK Only]
- local
- operation: INTEGER
- do
- cb_dropfiles := act
- if cb_dropfiles /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "DROPFILES_CB", "NONEEDED", operation)
- end
- set_cb_drag_drop (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER, INTEGER, INTEGER], STRING])
- -- Action generated when an internal drag and drop is executed. Only
- -- active if SHOWDRAGDROP=True.
- --
- -- ih: identifier of the element that activated the event.
- -- drag_id: Identifier of the clicked item where the drag start.
- -- drop_id: Identifier of the clicked item where the drop were executed.
- -- -1 indicates a drop in a blank area.
- -- isshift: flag indicating the shift key state.
- -- iscontrol: flag indicating the control key state.
- --
- -- Returns: if returns IUP_CONTINUE, or if the callback is not defined
- -- and SHOWDRAGDROP=True, then the node is moved to the new position. If
- -- Ctrl is pressed then the node is copied instead of moved. If the drop
- -- node is a branch and it is expanded, then the drag node is inserted as
- -- the first child of the node. If the branch is not expanded or the node
- -- is a leaf, then the drag node is inserted as the next brother of the
- -- drop node.
- local
- operation: INTEGER
- do
- cb_dragdrop := act
- if cb_dragdrop /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "DRAGDROP_CB", "NONEEDED", operation)
- end
- set_cb_right_click (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING])
- -- Action generated when the right mouse button is pressed over a node.
- --
- -- ih: identifier of the element that activated the event.
- -- id: node identifier.
- local
- operation: INTEGER
- do
- cb_rightclick := act
- if cb_rightclick /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "RIGHTCLICK_CB", "NONEEDED", operation)
- end
- set_cb_selection (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER], STRING])
- -- Action generated when a node is selected or deselected. This action
- -- occurs when the user clicks with the mouse or uses the keyboard with
- -- the appropriate combination of keys. It may be called more than once
- -- for the same node with the same status.
- --
- -- ih: identifier of the element that activated the event.
- -- id: Node identifier.
- -- status: 1=node selected, 0=node unselected.
- local
- operation: INTEGER
- do
- cb_selection := act
- if cb_selection /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "SELECTION_CB", "NONEEDED", operation)
- end
- set_cb_multi_selection (act: detachable FUNCTION[TUPLE[IUP_TREE, POINTER, INTEGER], STRING])
- -- Action generated after a continuous range of nodes is selected in one
- -- single operation. If not defined the SELECTION_CB with status=1 will
- -- be called for all nodes in the range. The range is always completely
- -- included, independent if some nodes were already marked. That single
- -- operation also guaranties that all other nodes outside the range are
- -- already not selected. Called only if MARKMODE=MULTIPLE.
- --
- -- ih: identifier of the element that activated the event.
- -- ids: Array of node identifiers. This array is kept for backward
- -- compatibility, the range is simply defined by ids[0] to ids[n-1],
- -- where ids[i+1]=ids[i]+1.
- -- n: Number of nodes in the array.
- local
- operation: INTEGER
- do
- cb_multiselection := act
- if cb_multiselection /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MULTISELECTION_CB", "NONEEDED", operation)
- end
- set_cb_multi_unselection (act: detachable FUNCTION[TUPLE[IUP_TREE, POINTER, INTEGER], STRING])
- local
- operation: INTEGER
- do
- cb_multiunselection := act
- if cb_multiunselection /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MULTIUNSELECTION_CB", "NONEEDED", operation)
- end
- set_cb_branch_open (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING])
- -- Action generated when a branch is expanded. This action occurs when
- -- the user clicks the "+" sign on the left of the branch, or when double
- -- clicks the branch, or hits Enter on a collapsed branch.
- --
- -- ih: identifier of the element that activated the event.
- -- id: node identifier.
- --
- -- Returns: IUP_IGNORE for the branch not to be opened, or IUP_DEFAULT
- -- for the branch to be opened.
- local
- operation: INTEGER
- do
- cb_branchopen := act
- if cb_branchopen /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "BRANCHOPEN_CB", "NONEEDED", operation)
- end
- set_cb_branch_close (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING])
- -- Action generated when a branch is collapsed. This action occurs when
- -- the user clicks the "-" sign on the left of the branch, or when double
- -- clicks the branch, or hits Enter on an expanded branch.
- --
- -- ih: identifier of the element that activated the event.
- -- id: node identifier.
- --
- -- Returns: IUP_IGNORE for the branch not to be closed, or IUP_DEFAULT
- -- for the branch to be closed.
- local
- operation: INTEGER
- do
- cb_branchclose := act
- if cb_branchclose /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "BRANCHCLOSE_CB", "NONEEDED", operation)
- end
- set_cb_execute_leaf (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING])
- -- Action generated when a leaf is to be executed. This action occurs
- -- when the user double clicks a leaf, or hits Enter on a leaf.
- --
- -- ih: identifier of the element that activated the event.
- -- id: node identifier.
- local
- operation: INTEGER
- do
- cb_executeleaf := act
- if cb_executeleaf /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "EXECUTELEAF_CB", "NONEEDED", operation)
- end
- set_cb_show_rename (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING])
- -- Action generated when a node is about to be renamed. It occurs when
- -- the user clicks twice the node or press F2. Called only if
- -- SHOWRENAME=True.
- --
- -- ih: identifier of the element that activated the event.
- -- id: node identifier.
- --
- -- Returns: if IUP_IGNORE is returned, the rename is canceled (in GTK the
- -- rename continuous but the edit box is read-only).
- local
- operation: INTEGER
- do
- cb_showrename := act
- if cb_showrename /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "SHOWRENAME_CB", "NONEEDED", operation)
- end
- set_cb_rename (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, STRING], STRING])
- -- Action generated after a node was renamed in place. It occurs when the
- -- user press Enter after editing the name, or when the text box looses
- -- it focus. Called only if SHOWRENAME=True.
- --
- -- ih: identifier of the element that activated the event.
- -- id: node identifier.
- -- title: new node title.
- --
- -- Returns: The new title is accepted only if the callback returns
- -- IUP_DEFAULT. If the callback does not exists the new title is always
- -- accepted. If the user pressed Enter and the callback returns
- -- IUP_IGNORE the editing continues. If the text box looses its focus the
- -- editing stops always.
- local
- operation: INTEGER
- do
- cb_rename := act
- if cb_rename /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "RENAME_CB", "NONEEDED", operation)
- end
- set_cb_node_removed (act: detachable FUNCTION[TUPLE[IUP_TREE, STRING], STRING])
- -- Action generated when a node is going to be removed. It is only a
- -- notification, the action can not be aborted. No node dependent
- -- attribute can be consulted during the callback. Not called when the
- -- tree is unmapped. It is useful to remove memory allocated for the
- -- userdata.
- --
- -- ih: identifier of the element that activated the event.
- -- userdata/userid: USERDATA attribute in C.
- local
- operation: INTEGER
- do
- cb_noderemoved := act
- if cb_noderemoved /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "NODEREMOVED_CB", "NONEEDED", operation)
- end
- set_cb_toggle_value (act: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER], STRING])
- -- Action generated when the toggle's state was changed. The callback
- -- also receives the new toggle's state.
- --
- -- ih: identifier of the element that activated the event.
- -- id: node identifier.
- -- state: 1 if the toggle's state was shifted to ON; 0 if it was shifted
- -- to OFF. If SHOW3STATE=YES, −1 if it was shifted to NOTDEF.
- local
- operation: INTEGER
- do
- cb_togglevalue := act
- if cb_togglevalue /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "TOGGLEVALUE_CB", "Fnii", operation)
- end
- -- Validations
- is_valid_state (value: STRING): BOOLEAN
- do
- if value.is_equal("EXPANDED") or
- value.is_equal("COLLAPSED") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_toggle (value: STRING): BOOLEAN
- do
- if value.is_equal("ON") or
- value.is_equal("OFF") or
- value.is_equal("NOTDEF") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_mode (value: STRING): BOOLEAN
- do
- if value.is_equal("SINGLE") or
- value.is_equal("MULTIPLE") then
- Result := True
- else
- Result := False
- end
- end
- feature {IUP}
- -- Common callbacks
-
- execute_map: STRING
- do
- if attached cb_map as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_unmap: STRING
- do
- if attached cb_unmap as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_destroy: STRING
- do
- if attached cb_destroy as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_getfocus: STRING
- do
- if attached cb_getfocus as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_killfocus: STRING
- do
- if attached cb_killfocus as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_enterwindow: STRING
- do
- if attached cb_enterwindow as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_leavewindow: STRING
- do
- if attached cb_leavewindow as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_k_any (c: INTEGER): STRING
- do
- if attached cb_k_any as int_cb then
- Result := int_cb.item([Current, c])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_help
- do
- if attached cb_help as int_cb then
- int_cb.call([Current])
- end
- end
- -- Extra
-
- execute_button (btn, pressed, x, y: INTEGER; status: STRING): STRING
- do
- if attached cb_button as int_cb then
- Result := int_cb.item([Current, btn, pressed, x, y, status])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_motion (x, y: INTEGER; status: STRING): STRING
- do
- if attached cb_motion as int_cb then
- Result := int_cb.item([Current, x, y, status])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_dropfiles (filename: STRING; num: INTEGER; x: INTEGER; y: INTEGER): STRING
- do
- if attached cb_dropfiles as int_cb then
- Result := int_cb.item([Current, filename, num, x, y])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_dragdrop (drag_id, drop_id, isshift, iscontrol: INTEGER): STRING
- do
- if attached cb_dragdrop as int_cb then
- Result := int_cb.item([Current, drag_id, drop_id, isshift, iscontrol])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_rightclick (id: INTEGER): STRING
- do
- if attached cb_rightclick as int_cb then
- Result := int_cb.item([Current, id])
- else
- Result := "IUP_DEFAULT"
- end
- end
- -- Others
- execute_selection (id, status: INTEGER): STRING
- do
- if attached cb_selection as int_cb then
- Result := int_cb.item([Current, id, status])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_multiselection (ids: POINTER; n: INTEGER): STRING
- do
- if attached cb_multiselection as int_cb then
- Result := int_cb.item([Current, ids, n])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_multiunselection (ids: POINTER; n: INTEGER): STRING
- do
- if attached cb_multiunselection as int_cb then
- Result := int_cb.item([Current, ids, n])
- else
- Result := "IUP_DEFAULT"
- end
- end
- ---------------
- execute_branchopen (id: INTEGER): STRING
- do
- if attached cb_branchopen as int_cb then
- Result := int_cb.item([Current, id])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_branchclose (id: INTEGER): STRING
- do
- if attached cb_branchclose as int_cb then
- Result := int_cb.item([Current, id])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_executeleaf (id: INTEGER): STRING
- do
- if attached cb_executeleaf as int_cb then
- Result := int_cb.item([Current, id])
- else
- Result := "IUP_DEFAULT"
- end
- end
- -------------------
- execute_showrename (id: INTEGER): STRING
- do
- if attached cb_showrename as int_cb then
- Result := int_cb.item([Current, id])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_rename (id: INTEGER; title: STRING): STRING
- do
- if attached cb_rename as int_cb then
- Result := int_cb.item([Current, id, title])
- else
- Result := "IUP_DEFAULT"
- end
- end
- -------------------
- execute_noderemoved (userdata: POINTER): STRING
- local
- str: STRING
- do
- if userdata /= default_pointer then
- create str.make_from_c(userdata)
- else
- str := ""
- end
- if attached cb_noderemoved as int_cb then
- Result := int_cb.item([Current, str])
- else
- Result := "IUP_DEFAULT"
- end
- end
- -------------------
- execute_togglevalue (id, state: INTEGER): STRING
- do
- if attached cb_togglevalue as int_cb then
- Result := int_cb.item([Current, id, state])
- else
- Result := "IUP_DEFAULT"
- end
- end
-
- feature {NONE}
-
- -- For callbacks
- cb_map: detachable FUNCTION[TUPLE[IUP_TREE], STRING]
- cb_unmap: detachable FUNCTION[TUPLE[IUP_TREE], STRING]
- cb_destroy: detachable FUNCTION[TUPLE[IUP_TREE], STRING]
- cb_getfocus: detachable FUNCTION[TUPLE[IUP_TREE], STRING]
- cb_killfocus: detachable FUNCTION[TUPLE[IUP_TREE], STRING]
- cb_enterwindow: detachable FUNCTION[TUPLE[IUP_TREE], STRING]
- cb_leavewindow: detachable FUNCTION[TUPLE[IUP_TREE], STRING]
- cb_k_any: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING]
- cb_help: detachable PROCEDURE[TUPLE[IUP_TREE]]
- cb_button: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING]
- cb_motion: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER, STRING], STRING]
- cb_dropfiles: detachable FUNCTION[TUPLE[IUP_TREE, STRING, INTEGER, INTEGER, INTEGER], STRING]
- cb_dragdrop: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER, INTEGER, INTEGER], STRING]
- cb_rightclick: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING]
- cb_selection: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER], STRING]
- cb_multiselection: detachable FUNCTION[TUPLE[IUP_TREE, POINTER, INTEGER], STRING]
- cb_multiunselection: detachable FUNCTION[TUPLE[IUP_TREE, POINTER, INTEGER], STRING]
- cb_branchopen: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING]
- cb_branchclose: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING]
- cb_executeleaf: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING]
- cb_showrename: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER], STRING]
- cb_rename: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, STRING], STRING]
- cb_noderemoved: detachable FUNCTION[TUPLE[IUP_TREE, STRING], STRING]
- cb_togglevalue: detachable FUNCTION[TUPLE[IUP_TREE, INTEGER, INTEGER], STRING]
-
- -- Internal
- int_tree: POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupTree();"
- end
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2016, 2017, 2018, 2019, 2020 by German A. Arias
- -- Permission is hereby granted, free of charge, to any person obtaining a copy
- -- of this software and associated documentation files (the "Software"), to deal
- -- in the Software without restriction, including without limitation the rights
- -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- -- copies of the Software, and to permit persons to whom the Software is
- -- furnished to do so, subject to the following conditions:
- --
- -- The above copyright notice and this permission notice shall be included in
- -- all copies or substantial portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- -- SOFTWARE.
|