123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- class IUP_GAUGE
- -- Creates a Gauge control. Shows a percent value that can be updated to
- -- simulate a progression. It inherits from IUP_CANVAS.
- --
- -- Callbacks:
- --
- -- MAP_CB, UNMAP_CB, DESTROY_CB: common callbacks are supported.
- --
- -- Notes:
- --
- -- To replace a IUP_PROGRESS_BAR by a IUP_GAUGE you should set
- -- set_raster_size=200x30 and set_show_text=False.
-
- inherit
- IUP_CANVAS
- redefine
- set_size
- end
- IUP_WIDGET_FGCOLOR
- redefine
- set_rgb_foreground_color
- end
- IUP_WIDGET_FLAT
- IUP_WIDGET_PADDING
- create {ANY}
- gauge
- feature {ANY}
- gauge
- local
- a_gauge: POINTER
- do
- a_gauge := int_gauge
- set_widget(a_gauge)
- end
- -- Attributes
- set_rgb_back_color (red: INTEGER; green: INTEGER; blue: INTEGER)
- -- (non inheritable): color of the background inside the
- -- borders. Predefined to "220 220 220.
- do
- iup_open.set_attribute(Current, "BACKCOLOR", rgb_to_string(red, green, blue))
- end
- reset_back_color
- -- Use the parent's background color.
- do
- iup_open.reset_attribute(Current, "BACKCOLOR")
- end
- set_dashed (state: BOOLEAN)
- -- Changes the style of the gauge for a dashed pattern. Default=False.
- do
- iup_open.set_attribute(Current, "DASHED", boolean_to_yesno(state))
- end
- set_rgb_foreground_color (red: INTEGER; green: INTEGER; blue: INTEGER)
- -- Controls the gauge and text color. The default is "64 96 192".
- do
- Precursor (red, green, blue)
- end
- set_max (value: REAL)
- -- (non inheritable): Contains the maximum value. Default is "1".
- do
- iup_open.set_attribute(Current, "MAX", value.out)
- end
- set_min (value: REAL)
- -- (non inheritable): Contains the minimum value. Default is "0".
- do
- iup_open.set_attribute(Current, "MIN", value.out)
- end
- set_horizontal_orientation
- -- (creation only): Horizontal goes from left to right. Width and height
- -- are swapped when orientation is set. This is the default value.
- do
- iup_open.set_attribute(Current, "ORIENTATION", "HORIZONTAL")
- end
- set_vertical_orientation
- -- (creation only): Vertical from bottom to top. Width and height are
- -- swapped when orientation is set.
- do
- iup_open.set_attribute(Current, "ORIENTATION", "VERTICAL")
- end
- set_show_text (state: BOOLEAN)
- -- Indicates if the text inside the Gauge is to be shown or not. If the
- -- gauge is dashed the text is never shown. Default: "True".
- do
- iup_open.set_attribute(Current, "SHOWTEXT", boolean_to_yesno(state))
- end
- set_size (width: INTEGER; height: INTEGER)
- -- (non inheritable): The initial size is "120x14".
- do
- Precursor (width, height)
- end
- set_automatic_layout
- -- Set to allow the automatic layout use smaller values.
- do
- iup_open.set_attribute_null(Current, "SIZE")
- end
- set_text (value: STRING)
- -- (non inheritable): Contains a text to be shown inside the Gauge when
- -- set_show_text=True.
- do
- iup_open.set_attribute(Current, "TEXT", value)
- end
- set_use_percent
- -- The percentage calculated from VALUE will be used. If the gauge is
- -- dashed the text is never shown.
- do
- iup_open.set_attribute_null(Current, "TEXT")
- end
- set_value (value: REAL)
- -- (non inheritable): Contains a number between "MIN" and "MAX",
- -- controlling the current position.
- do
- iup_open.set_attribute(Current, "VALUE", value.out)
- end
-
- feature {NONE}
- -- Internals
-
- int_gauge: POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupGauge ();"
- end
- end -- class IUP_GAUGE
- -- The MIT License (MIT)
- -- Copyright (c) 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.
|