123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421 |
- deferred class IUP_WIDGET_FLAT_SCROLL_BOX
- -- Complementary attributes when a flat scrollbar is used (a drawn scrollbar).
- --
- -- Used in IUP_FLAT_SCROLL_BOX, and in IUP_MATRIX when FLATSCROLLBAR is defined.
- inherit
- IUP_WIDGET_INTERNALS
-
- feature {ANY}
- set_flat_scroll_bar (style: STRING)
- require
- is_valid_style(style)
- do
- iup_open.set_attribute(Current, "FLATSCROLLBAR", style)
- end
- -- Attributes
- set_rgb_back_color (red: INTEGER; green: INTEGER; blue: INTEGER)
- -- (non inheritable): color used as background for the scrollbar. By
- -- default it will inherit from BGCOLOR.
- do
- iup_open.set_attribute(Current, "SB_BACKCOLOR", rgb_to_string(red, green, blue))
- end
- get_rgb_back_color: TUPLE[INTEGER, INTEGER, INTEGER]
- do
- Result := iup_open.get_rgb(Current, "SB_BACKCOLOR")
- end
- reset_back_color
- -- Reset the back color to the default value.
- do
- iup_open.reset_attribute(Current, "SB_BACKCOLOR")
- end
- set_rgb_fore_color (red: INTEGER; green: INTEGER; blue: INTEGER)
- -- (non inheritable): handler and arrow color. Default: "220 220 220".
- -- Used instead of FGCOLOR to avoid inheritance problems.
- do
- iup_open.set_attribute(Current, "SB_FORECOLOR", rgb_to_string(red, green, blue))
- end
- get_rgb_fore_color: TUPLE[INTEGER, INTEGER, INTEGER]
- do
- Result := iup_open.get_rgb(Current, "SB_FORECOLOR")
- end
- reset_fore_color
- -- Reset the fore color to the default value.
- do
- iup_open.reset_attribute(Current, "SB_FORECOLOR")
- end
- set_rgb_high_color (red: INTEGER; green: INTEGER; blue: INTEGER)
- -- (non inheritable): handler and arrow color when highlight.
- -- Default: "132 132 132".
- do
- iup_open.set_attribute(Current, "SB_HIGHCOLOR", rgb_to_string(red, green, blue))
- end
- get_rgb_high_color: TUPLE[INTEGER, INTEGER, INTEGER]
- do
- Result := iup_open.get_rgb(Current, "SB_HIGHCOLOR")
- end
- reset_high_color
- -- Reset the high color to the default value.
- do
- iup_open.reset_attribute(Current, "SB_HIGHCOLOR")
- end
- set_rgb_press_color (red: INTEGER; green: INTEGER; blue: INTEGER)
- -- (non inheritable): handler and arrow color when pressed.
- -- Default: "96 96 96".
- do
- iup_open.set_attribute(Current, "SB_PRESSCOLOR", rgb_to_string(red, green, blue))
- end
- get_rgb_press_color: TUPLE[INTEGER, INTEGER, INTEGER]
- do
- Result := iup_open.get_rgb(Current, "SB_PRESSCOLOR")
- end
- reset_press_color
- -- Reset the press color to the default value.
- do
- iup_open.reset_attribute(Current, "SB_PRESSCOLOR")
- end
- set_scroll_bar_size (size: INTEGER)
- -- (non inheritable): The width of the vertical scrollbar or the height
- -- of the horizontal scrollbar. Default: 15.
- do
- iup_open.set_attribute(Current, "SCROLLBARSIZE", size.out)
- end
- get_scroll_bar_size: INTEGER
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "SCROLLBARSIZE")
- Result := str.to_integer
- end
- set_show_arrows (state: BOOLEAN)
- -- (non inheritable): Allow to show or hide the arrows. Default: "True".
- do
- iup_open.set_attribute(Current, "SHOWARROWS", boolean_to_yesno(state))
- end
- get_show_arrows: BOOLEAN
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "SHOWARROWS")
- Result := yesno_to_boolean(str)
- end
- set_show_floating (state: BOOLEAN)
- -- (non inheritable): the scrollbar is shown only when used, over the
- -- space it occupied. Move the mouse over the scrollbar area to show the
- -- scrollbars. They are automatically hidden after not being used by the
- -- time defined in FLOATINGDELAY. Default: "False".
- do
- iup_open.set_attribute(Current, "SHOWFLOATING", boolean_to_yesno(state))
- end
- get_show_floating: BOOLEAN
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "SHOWFLOATING")
- Result := yesno_to_boolean(str)
- end
- set_show_transparent (state: BOOLEAN)
- -- (non inheritable): This makes the flat scrollbar semi transparent and
- -- only interactive trough its handler. It implies in
- -- set_show_arrows=False and set_show_floating=True.
- do
- iup_open.set_attribute(Current, "SHOWTRANSPARENT", boolean_to_yesno(state))
- end
- set_floating_delay (delay: INTEGER)
- -- (non inheritable): time to hide the scrollbar when SHOWFLOATING=Yes in
- -- milliseconds. Default: 2000.
- do
- iup_open.set_attribute(Current, "FLOATINGDELAY", delay.out)
- end
- get_floating_delay: INTEGER
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "FLOATINGDELAY")
- Result := str.to_integer
- end
- set_arrow_images (state: BOOLEAN)
- -- (non inheritable): replace the drawn arrows by the following images.
- -- Default: "False".
- do
- iup_open.set_attribute(Current, "ARROWIMAGES", boolean_to_yesno(state))
- end
- get_arrow_images: BOOLEAN
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "ARROWIMAGES")
- Result := yesno_to_boolean(str)
- end
- set_image_left (name: STRING)
- -- Arrow image name (the attribute is relative to where the arrow is
- -- pointing). Use set_widget_name to associate an image to a name.
- -- See also IUP_IMAGE. IMPORTANT = all images must be square with side
- -- equals to SCROLLBARSIZE.
- do
- iup_open.set_attribute(Current, "SB_IMAGELEFT", name)
- end
- get_image_left: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGELEFT")
- end
- set_image_right (name: STRING)
- -- Arrow image name (the attribute is relative to where the arrow is
- -- pointing). Use set_widget_name to associate an image to a name.
- -- See also IUP_IMAGE. IMPORTANT = all images must be square with side
- -- equals to SCROLLBARSIZE.
- do
- iup_open.set_attribute(Current, "SB_IMAGERIGHT", name)
- end
- get_image_right: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGERIGHT")
- end
- set_image_top (name: STRING)
- -- Arrow image name (the attribute is relative to where the arrow is
- -- pointing). Use set_widget_name to associate an image to a name.
- -- See also IUP_IMAGE. IMPORTANT = all images must be square with side
- -- equals to SCROLLBARSIZE.
- do
- iup_open.set_attribute(Current, "SB_IMAGETOP", name)
- end
- get_image_top: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGETOP")
- end
- set_image_bottom (name: STRING)
- -- Arrow image name (the attribute is relative to where the arrow is
- -- pointing). Use set_widget_name to associate an image to a name.
- -- See also IUP_IMAGE. IMPORTANT = all images must be square with side
- -- equals to SCROLLBARSIZE.
- do
- iup_open.set_attribute(Current, "SB_IMAGEBOTTOM", name)
- end
- get_image_bottom: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGEBOTTOM")
- end
- set_image_left_highlight (name: STRING)
- -- (non inheritable): Arrow image name of the element in highlight state.
- -- If it is not defined then the IMAGELEFT is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGELEFTHIGHLIGHT", name)
- end
- get_image_left_highlight: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGELEFTHIGHLIGHT")
- end
- set_image_right_highlight (name: STRING)
- -- (non inheritable): Arrow image name of the element in highlight state.
- -- If it is not defined then the IMAGERIGHT is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGERIGHTHIGHLIGHT", name)
- end
- get_image_right_highlight: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGERIGHTHIGHLIGHT")
- end
- set_image_top_highlight (name: STRING)
- -- (non inheritable): Arrow image name of the element in highlight state.
- -- If it is not defined then the IMAGETOP is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGETOPHIGHLIGHT", name)
- end
- get_image_top_highlight: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGETOPHIGHLIGHT")
- end
- set_image_bottom_highlight (name: STRING)
- -- (non inheritable): Arrow image name of the element in highlight state.
- -- If it is not defined then the IMAGEBOTTOM is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGEBOTTOMHIGHLIGHT", name)
- end
- get_image_bottom_highlight: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGEBOTTOMHIGHLIGHT")
- end
- set_image_left_inactive (name: STRING)
- -- (non inheritable): Arrow image name of the element when inactive. If
- -- it is not defined then the IMAGELEFT is used and its colors will be
- -- replaced by a modified version creating the disabled effect.
- do
- iup_open.set_attribute(Current, "SB_IMAGELEFTINACTIVE", name)
- end
- get_image_left_inactive: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGELEFTINACTIVE")
- end
- set_image_right_inactive (name: STRING)
- -- (non inheritable): Arrow image name of the element when inactive. If
- -- it is not defined then the IMAGERIGHT is used and its colors will be
- -- replaced by a modified version creating the disabled effect.
- do
- iup_open.set_attribute(Current, "SB_IMAGERIGHTINACTIVE", name)
- end
- get_image_right_inactive: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGERIGHTINACTIVE")
- end
- set_image_top_inactive (name: STRING)
- -- (non inheritable): Arrow image name of the element when inactive. If
- -- it is not defined then the IMAGETOP is used and its colors will be
- -- replaced by a modified version creating the disabled effect.
- do
- iup_open.set_attribute(Current, "SB_IMAGETOPINACTIVE", name)
- end
- get_image_top_inactive: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGETOPINACTIVE")
- end
-
- set_image_bottom_inactive (name: STRING)
- -- (non inheritable): Arrow image name of the element when inactive. If
- -- it is not defined then the IMAGEBOTTOM is used and its colors will be
- -- replaced by a modified version creating the disabled effect.
- do
- iup_open.set_attribute(Current, "SB_IMAGEBOTTOMINACTIVE", name)
- end
- get_image_bottom_inactive: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGEBOTTOMINACTIVE")
- end
- set_image_left_press (name: STRING)
- -- (non inheritable): Arrow image name of the element in pressed state.
- -- If it is not defined then the IMAGELEFT is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGELEFTPRESS", name)
- end
- get_image_left_press: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGELEFTPRESS")
- end
- set_image_right_press (name: STRING)
- -- (non inheritable): Arrow image name of the element in pressed state.
- -- If it is not defined then the IMAGERIGHT is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGERIGHTPRESS", name)
- end
- get_image_right_press: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGERIGHTPRESS")
- end
- set_image_top_press (name: STRING)
- -- (non inheritable): Arrow image name of the element in pressed state.
- -- If it is not defined then the IMAGETOP is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGETOPPRESS", name)
- end
- get_image_top_press: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGETOPPRESS")
- end
-
- set_image_bottom_press (name: STRING)
- -- (non inheritable): Arrow image name of the element in pressed state.
- -- If it is not defined then the IMAGEBOTTOM is used.
- do
- iup_open.set_attribute(Current, "SB_IMAGEBOTTOMPRESS", name)
- end
- get_image_bottom_press: STRING
- do
- Result := iup_open.get_attribute(Current, "SB_IMAGEBOTTOMPRESS")
- end
- -- Validations
- is_valid_style (value: STRING): BOOLEAN
- do
- if value.is_equal("YES") or
- value.is_equal("VERTICAL") or
- value.is_equal("HORIZONTAL") then
- Result := True
- else
- Result := False
- end
- 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.
|