123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- class IUP_DIAL
-
- inherit
- IUP_CANVAS
- redefine
- set_expand,
- set_size,
- execute_button_press,
- execute_button_release,
- execute_mousemove_fnd,
- execute_valuechanged
- end
- IUP_WIDGET_FGCOLOR
- redefine
- set_rgb_foreground_color
- end
- IUP_WIDGET_FLAT
- create {ANY}
- dial_horizontal,
- dial_vertical,
- dial_circular
- feature {ANY}
- dial_horizontal
- local
- type: STRING
- a_dial: POINTER
- do
- type := "HORIZONTAL"
- a_dial := int_dial(get_pointer(type.to_c))
-
- set_widget(a_dial)
- end
- dial_vertical
- local
- type: STRING
- a_dial: POINTER
- do
- type := "VERTICAL"
- a_dial := int_dial(get_pointer(type.to_c))
-
- set_widget(a_dial)
- end
- dial_circular
- local
- type: STRING
- a_dial: POINTER
- do
- type := "CIRCULAR"
- a_dial := int_dial(get_pointer(type.to_c))
-
- set_widget(a_dial)
- end
-
- set_density (value: REAL)
-
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "DENSITY", value.out)
- end
- set_expand (type: STRING)
-
- do
- Precursor (type)
- end
- set_rgb_foreground_color (red: INTEGER; green: INTEGER; blue: INTEGER)
-
- do
- Precursor (red, green, blue)
- end
- set_size (width: INTEGER; height: INTEGER)
-
-
- do
- Precursor (width, height)
- end
- set_automatic_layout
-
- do
- iup_open.set_attribute_null(Current, "SIZE")
- end
- set_unit_degrees
- do
- iup_open.set_attribute(Current, "UNIT", "DEGREES")
- end
- set_unit_radians
-
- do
- iup_open.set_attribute(Current, "UNIT", "RADIANS")
- end
- set_value (value: REAL)
-
-
-
-
-
- do
- iup_open.set_attribute(Current, "VALUE", value.out)
- end
- get_value: REAL
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "VALUE")
- if str.is_real then
- Result := str.to_real
- end
- end
-
- set_cb_button_press (act: detachable FUNCTION[TUPLE[IUP_DIAL, REAL_64], STRING])
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_button_press := act
- if cb_button_press /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "BUTTON_PRESS_CB", "NONEEDED", operation)
- end
- set_cb_button_release (act: detachable FUNCTION[TUPLE[IUP_DIAL, REAL_64], STRING])
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_button_release := act
- if cb_button_release /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "BUTTON_RELEASE_CB", "NONEEDED", operation)
- end
- set_cb_mouse_move (act: detachable FUNCTION[TUPLE[IUP_DIAL, REAL_64], STRING])
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_mousemove := act
- if cb_mousemove /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MOUSEMOVE_CB", "Fnd", operation)
- end
- set_cb_value_changed (act: detachable FUNCTION[TUPLE[IUP_DIAL], STRING])
-
-
-
-
- local
- operation: INTEGER
- do
- cb_valuechanged := act
- if cb_valuechanged /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "VALUECHANGED_CB", "NONEEDED", operation)
- end
- feature {IUP}
- execute_button_press (angle: REAL_64): STRING
- do
- if attached cb_button_press as int_cb then
- Result := int_cb.item([Current, angle])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_button_release (angle: REAL_64): STRING
- do
- if attached cb_button_release as int_cb then
- Result := int_cb.item([Current, angle])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_mousemove_fnd (angle: REAL_64): STRING
- do
- if attached cb_mousemove as int_cb then
- Result := int_cb.item([Current, angle])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_valuechanged: STRING
- do
- if attached cb_valuechanged as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- feature {NONE}
-
- cb_button_press: detachable FUNCTION[TUPLE[IUP_DIAL, REAL_64], STRING]
- cb_button_release: detachable FUNCTION[TUPLE[IUP_DIAL, REAL_64], STRING]
- cb_mousemove: detachable FUNCTION[TUPLE[IUP_DIAL, REAL_64], STRING]
- cb_valuechanged: detachable FUNCTION[TUPLE[IUP_DIAL], STRING]
-
-
- int_dial (type: POINTER): POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupDial ($type);"
- end
- end
|