123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- class IUP_SCROLL_BOX
- -- Creates a native container that allows its child to be scrolled.
- --
- -- The box allows the application to create a virtual space for the dialog that
- -- is actually larger than the visible area. The current size of the box
- -- defines the visible area. The natural size of the child (and its children)
- -- defines the virtual space size. So the IupScrollBox does not depend on its
- -- child size or expansion, and its natural size is always 0x0.
- --
- -- The user can move the box contents by dragging the background. Also the
- -- mouse wheel scrolls the contents vertically.
- --
- -- The box can be created with no elements and be dynamic filled using
- -- append or insert.
- inherit
- IUP_CANVAS
- redefine
- set_wheel_drop_focus
- end
- IUP_WIDGET_CLIENTSIZE
- IUP_WIDGET_CLIENTOFFSET
- create {ANY}
- scroll_box
- feature {ANY}
- scroll_box(child: IUP_WIDGET)
- -- A new scroll box. child is an interface element which will receive the
- -- box. It can be Void.
- local
- a_scroll_box: POINTER
- do
- a_scroll_box := int_scroll_box(child.widget)
- set_widget(a_scroll_box)
- end
- -- Attributes
- set_canvas_box (state: BOOLEAN)
- -- (non inheritable): enable the behavior of a canvas box instead of a
- -- regular container. Default: "False".
- do
- iup_open.set_attribute(Current, "CANVASBOX", boolean_to_yesno(state))
- end
- set_childoffset (horizontal, vertical: INTEGER)
- require
- horizontal >= 0
- vertical >= 0
- local
- offset: STRING
- do
- offset := horizontal.out
- offset.append_string("x")
- offset.append_string(vertical.out)
- iup_open.set_attribute(Current, "CHILDOFFSET", offset)
- end
- get_childoffset: TUPLE[INTEGER, INTEGER]
- -- Return the offset of the child.
- local
- offset: STRING
- do
- offset := iup_open.get_attribute(Current, "CHILDOFFSET")
- Result := components_of_size(offset)
- end
- set_layout_drag (state: BOOLEAN)
- -- (non inheritable) [Windows Only]: When the scrollbar is moved
- -- automatically update the children layout. Default: "True". If set to
- -- "False" then the layout will be updated only when the mouse drag
- -- is released.
- do
- iup_open.set_attribute(Current, "LAYOUTDRAG", boolean_to_yesno(state))
- end
- set_wheel_drop_focus (state: BOOLEAN)
- -- If set to True when the wheel is used the focus control close any dropdown
- -- opened. The default is True.
- do
- Precursor (state)
- end
- -- Moves
-
- scroll_to_top
- do
- iup_open.set_attribute(Current, "SCROLLTO", "TOP")
- end
- scroll_to_bottom
- do
- iup_open.set_attribute(Current, "SCROLLTO", "BOTTOM")
- end
- scroll_to (x, y: INTEGER)
- -- Position the scroll at the given x,y coordinates relative to the box
- -- top-left corner.
- local
- position: STRING
- do
- position := x.out
- position.append_string(",")
- position.append_string(y.out)
- iup_open.set_attribute(Current, "SCROLLTO", position)
- end
- scroll_to_child (child_name: STRING)
- -- (write-only): position the scroll at the top-left corner of the given
- -- child located by its name. Use set_widget_name to associate a
- -- name. The child must be contained in the Scrollbox hierarchy.
- do
- iup_open.set_attribute(Current, "SCROLLTOCHILD", child_name)
- end
- scroll_to_child_widget (child_widget: IUP_WIDGET)
- -- (write-only): same as scroll_to_child but directly using the child
- -- widget.
- do
- iup_open.set_attribute_widget(Current, "SCROLLTOCHILD_HANDLE", child_widget)
- end
- feature {NONE}
- -- Internal
-
- int_scroll_box (wgt: POINTER): POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupScrollBox ($wgt);"
- end
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2016, 2017, 2019, 2021 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.
|