12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- class IUP_DROP
- -- Class used to display a dropdown list or a popup menu at IUP_MATRIX. How
- -- this will be displayed depend on the IUP_MATRIX callback that will be used
- -- to append its items. See IUP_MATRIX documentation.
- inherit
- IUP_WIDGET
- create {IUP}
- drop_widget
- feature {IUP}
- drop_widget (p: POINTER)
- do
- set_widget(p)
- end
- feature {ANY}
- --- Operations
- set_value (id: INTEGER)
- -- Set the list current value, id starts at 1.
- -- The default is always "1".
- require
- id >= 0
- do
- iup_open.set_int(Current, "VALUE", id)
- end
- get_previous_value: STRING
- -- The previously value in the cell where the drop is displayed.
- do
- Result := iup_open.get_attribute(Current, "PREVIOUSVALUE")
- end
- append_items (items: ARRAY[STRING])
- -- Append items at dropdown list or menu in the same order.
- local
- i: INTEGER
- do
- i := 1
-
- across
- items as ic
- loop
- iup_open.set_attribute(Current, i.out, ic.item)
- i := i + 1
- end
- iup_open.set_attribute_null(Current, i.out)
- end
- set_image_at (image_name: STRING; id_item: INTEGER)
- -- Image to be set at the correspondent menu item.
- -- id starts at 1. Only works when the drop is displayed like
- -- a popup menu. Ignored if id is out of bounds.
- require
- valid_id: id_item > 0
- do
- iup_open.set_attribute_id(Current, "IMAGE", id_item, image_name)
- end
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2017, 2019 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.
|