123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- class IUP_SBOX
- -- Creates a void container that allows its child to be resized. Allows
- -- expanding and contracting the child size in one direction.
- --
- -- It does not have a native representation but it contains also a IupCanvas to
- -- implement the bar handler.
- inherit
- IUP_CONTAINER
- IUP_WIDGET_EXPAND
- IUP_WIDGET_WID
- IUP_WIDGET_FONT
- IUP_WIDGET_SIZE
- IUP_WIDGET_RASTERSIZE
- IUP_WIDGET_USERSIZE
- IUP_WIDGET_CLIENTSIZE
- IUP_WIDGET_CLIENTOFFSET
- IUP_WIDGET_POSITION
- IUP_WIDGET_MAXMIN_SIZE
- IUP_WIDGET_CHILD
- IUP_WIDGET_NAME
- IUP_WIDGET_CUSTOM_ATTRIBUTES
- create {ANY}
- sbox_empty,
- sbox
- feature {ANY}
- sbox_empty
- -- Create an empty sbox.
- local
- p, a_sbox: POINTER
- do
- a_sbox := int_sbox (p)
- set_widget(a_sbox)
- end
-
- sbox (child: IUP_WIDGET)
- -- Create a new sbox containing the widget.
- local
- a_sbox: POINTER
- do
- a_sbox := int_sbox (child.widget)
- set_widget(a_sbox)
- end
- -- Attributes
- set_bar_size (value: INTEGER)
- -- (non inheritable): controls the size of the bar handler. Default: 5.
- require
- value > 0
- do
- iup_open.set_attribute(Current, "BARSIZE", value.out)
- end
- set_rgb_color (red, green, blue: INTEGER)
- -- Changes the color of the bar handler. The value should be given in "R G
- -- B" color style. Default: "192 192 192".
- do
- iup_open.set_attribute(Current, "COLOR", rgb_to_string(red, green, blue))
- end
- get_rgb_color: TUPLE[INTEGER, INTEGER, INTEGER]
- -- Return the RGB values of the bar color.
- do
- Result := iup_open.get_rgb(Current, "COLOR")
- end
- set_direction (value: STRING)
- -- (creation only): Indicates the direction of the resize and the position
- -- of the bar handler. Possible values are "NORTH", "SOUTH" (vertical
- -- direction), "EAST" or "WEST" (horizontal direction). Default: "EAST".
- require
- is_valid_direction(value)
- do
- iup_open.set_attribute(Current, "DIRECTION", value)
- end
- get_direction: STRING
- -- Return the value of direction.
- do
- Result := iup_open.get_attribute(Current, "DIRECTION")
- end
- set_layout_drag (state: BOOLEAN)
- -- (non inheritable): When the bar 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_show_grip (value: STRING)
- -- (non inheritable): Shows the bar grip affordance, possible
- -- values: YES, NO, LINES. Default: NO. When set to NO, COLOR is used to
- -- fill the grip area. If set to "LINES" then instead of the traditional
- -- grip appearance, it will be two parallel lines.
- require
- is_valid_showgrip(value)
- do
- iup_open.set_attribute(Current, "SHOWGRIP", value)
- end
- -- Validations
- is_valid_direction (value: STRING): BOOLEAN
- do
- if value.is_equal("NORTH") or
- value.is_equal("SOUTH") or
- value.is_equal("EAST") or
- value.is_equal("WEST") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_showgrip (value: STRING): BOOLEAN
- do
- if is_yes_no(value) or
- value.is_equal("LINES") then
- Result := True
- else
- Result := False
- end
- end
- feature {NONE}
- -- Internal
-
- int_sbox (child: POINTER): POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupSbox ($child);"
- end
-
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2016, 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.
|