123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- class IUP_TOGGLE
- inherit
- IUP_BUTTON
- redefine
- execute_map,
- execute_unmap,
- execute_destroy,
- execute_getfocus,
- execute_killfocus,
- execute_enterwindow,
- execute_leavewindow,
- execute_k_any,
- execute_help,
- execute_action_fni,
- execute_valuechanged
- end
- IUP_WIDGET_IGNORERADIO
- IUP_WIDGET_IMPRESS_BORDER
- export
- {NONE} all
- end
- IUP_WIDGET_IMAGE_POSITION
- export
- {NONE} all
- end
- IUP_WIDGET_SPACING
- export
- {NONE} all
- end
- IUP_WIDGET_CB_ACTION
- export
- {NONE} all
- end
- IUP_WIDGET_CB_BUTTON
- export
- {NONE} all
- end
- IUP_WIDGET_TOGGLE
- create {ANY}
- toggle
- feature {ANY}
- toggle (title: STRING)
-
-
- local
- a_toggle, p: POINTER
- do
- if title /= Void then
- a_toggle := int_toggle(get_pointer(title.to_c), p)
- else
- a_toggle := int_toggle(p, p)
- end
-
- set_widget(a_toggle)
- end
-
- is_radio: BOOLEAN
-
-
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "RADIO")
- Result := yesno_to_boolean(str)
- end
- set_right_button (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "RIGHTBUTTON", boolean_to_yesno(state))
- end
- set_value (value: STRING)
-
-
-
-
-
-
- require
- is_valid_state (value)
- do
- iup_open.set_attribute(Current, "VALUE", value)
- end
- get_value: STRING
- do
- Result := iup_open.get_attribute(Current, "VALUE")
- end
- set_3state (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "3STATE", boolean_to_yesno(state))
- end
-
- invert
-
- do
- iup_open.set_attribute(Current, "VALUE", "TOGGLE")
- end
-
- set_cb_toggle (act: detachable FUNCTION[TUPLE[IUP_TOGGLE, INTEGER], STRING])
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_action_fni := act
- if cb_action_fni /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "ACTION", "Fn", operation)
- end
- set_cb_value_changed (act: detachable FUNCTION[TUPLE[IUP_TOGGLE], 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
-
- is_valid_state (value: STRING): BOOLEAN
- do
- if value.is_equal("ON") or
- value.is_equal("OFF") or
- value.is_equal("NOTDEF") then
- Result := True
- else
- Result := False
- end
- end
- feature {IUP}
-
-
- execute_map: STRING
- do
- if attached cb_map as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_unmap: STRING
- do
- if attached cb_unmap as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_destroy: STRING
- do
- if attached cb_destroy as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_getfocus: STRING
- do
- if attached cb_getfocus as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_killfocus: STRING
- do
- if attached cb_killfocus as int_Cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_enterwindow: STRING
- do
- if attached cb_enterwindow as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_leavewindow: STRING
- do
- if attached cb_leavewindow as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_k_any (c: INTEGER): STRING
- do
- if attached cb_k_any as int_cb then
- Result := int_cb.item([Current, c])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_help
- do
- if attached cb_help as int_cb then
- int_cb.call([Current])
- end
- end
-
- execute_action_fni (state: INTEGER): STRING
- do
- if attached cb_action_fni as int_cb then
- Result := int_cb.item([Current, state])
- 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_action_fni: detachable FUNCTION[TUPLE[IUP_TOGGLE, INTEGER], STRING]
- cb_valuechanged: detachable FUNCTION[TUPLE[IUP_TOGGLE], STRING]
-
-
- int_toggle (title: POINTER; action: POINTER): POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupToggle ($title, $action);"
- end
- end
|