123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533 |
- class IUP_DATE_PICK
- inherit
- IUP_WIDGET
- redefine
- execute_map,
- execute_unmap,
- execute_destroy,
- execute_getfocus,
- execute_killfocus,
- execute_enterwindow,
- execute_leavewindow,
- execute_k_any,
- execute_help,
- execute_valuechanged
- end
- IUP_WIDGET_INTERNALS
- IUP_WIDGET_CHILD
- IUP_WIDGET_NAME
- IUP_WIDGET_CUSTOM_ATTRIBUTES
- create {ANY}
- date_pick
- feature {ANY}
- date_pick
-
- local
- a_date_pick: POINTER
- do
- a_date_pick := int_date_pick
- set_widget(a_date_pick)
- end
-
- set_calendar_week_number (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "CALENDARWEEKNUMBERS",
- boolean_to_yesno(state))
- end
- set_format (value: STRING)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- do
- iup_open.set_attribute(Current, "FORMAT", value)
- end
- set_month_short_names (state: BOOLEAN)
-
-
-
- do
- iup_open.set_attribute(Current, "MONTHSHORTNAMES",
- boolean_to_yesno(state))
- end
- set_order (value: STRING)
-
-
-
-
- require
- is_valid_order(value)
- do
- iup_open.set_attribute(Current, "ORDER", value)
- end
- set_separator (value: STRING)
-
-
- do
- iup_open.set_attribute(Current, "SEPARATOR", value)
- end
- get_today: TUPLE[INTEGER, INTEGER, INTEGER]
-
-
- do
- Result := convert_date_to_tuple(get_string_today)
- end
- get_string_today: STRING
-
-
- do
- Result := iup_open.get_attribute(Current, "TODAY")
- end
- set_value (year, month, day: INTEGER)
-
- require
- year >= 0
- month >= 1
- month <= 12
- day >= 1
- day <= 31
- local
- str: STRING
- do
- str := year.out
- str.append_string("/")
- str.append_string(month.out)
- str.append_string("/")
- str.append_string(day.out)
-
- iup_open.set_attribute(Current, "VALUE", str)
- end
- set_string_value (value: STRING)
-
- require
- valid_date: is_valid_string_date(value)
- do
- iup_open.set_attribute(Current, "VALUE", value)
- end
- open_dropdow
-
- do
- iup_open.set_attribute(Current, "SHOWDROPDOWN", "YES")
- end
- close_dropdow
-
- do
- iup_open.set_attribute(Current, "SHOWDROPDOWN", "NO")
- end
- set_today
-
- do
- iup_open.set_attribute(Current, "VALUE", "TODAY")
- end
- get_value: TUPLE[INTEGER, INTEGER, INTEGER]
-
- do
- Result := convert_date_to_tuple(get_string_value)
- end
- get_string_value: STRING
-
- do
- Result := iup_open.get_attribute(Current, "VALUE")
- end
- set_zero_preced (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "ZEROPRECED",
- boolean_to_yesno(state))
- end
-
-
- set_cb_map (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING])
-
- local
- operation: INTEGER
- do
- cb_map := act
-
- if cb_map /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MAP_CB", "NONEEDED", operation)
- end
- set_cb_unmap (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING])
-
- local
- operation: INTEGER
- do
- cb_unmap := act
- if cb_unmap /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "UNMAP_CB", "NONEEDED", operation)
- end
- set_cb_destroy (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING])
-
- local
- operation: INTEGER
- do
- cb_destroy := act
- if cb_destroy /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "DESTROY_CB", "NONEEDED", operation)
- end
- set_cb_get_focus (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING])
-
-
-
-
- local
- operation: INTEGER
- do
- cb_getfocus := act
- if cb_getfocus /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "GETFOCUS_CB", "NONEEDED", operation)
- end
- set_cb_kill_focus (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING])
-
-
-
- local
- operation: INTEGER
- do
- cb_killfocus := act
- if cb_killfocus /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "KILLFOCUS_CB", "NONEEDED", operation)
- end
- set_cb_enter_window (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING])
-
- local
- operation: INTEGER
- do
- cb_enterwindow := act
- if cb_enterwindow /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "ENTERWINDOW_CB", "NONEEDED", operation)
- end
- set_cb_leave_window (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING])
-
- local
- operation: INTEGER
- do
- cb_leavewindow := act
- if cb_leavewindow /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "LEAVEWINDOW_CB", "NONEEDED", operation)
- end
- set_cb_k_any (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK, INTEGER], STRING])
-
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_k_any := act
- if cb_k_any /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "K_ANY", "NONEEDED", operation)
- end
- set_cb_help (act: detachable PROCEDURE[TUPLE[IUP_DATE_PICK]])
-
-
-
-
- local
- operation: INTEGER
- do
- cb_help := act
- if cb_help /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "HELP_CB", "NONEEDED", operation)
- end
-
- set_cb_value_changed (act: detachable FUNCTION[TUPLE[IUP_DATE_PICK], 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_order (value: STRING): BOOLEAN
- do
- if value.is_equal("DMY") or
- value.is_equal("DYM") or
- value.is_equal("MYD") or
- value.is_equal("MDY") or
- value.is_equal("YMD") or
- value.is_equal("YDM") 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_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_map: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
- cb_unmap: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
- cb_destroy: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
- cb_getfocus: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
- cb_killfocus: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
- cb_enterwindow: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
- cb_leavewindow: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
- cb_k_any: detachable FUNCTION[TUPLE[IUP_DATE_PICK, INTEGER], STRING]
- cb_help: detachable PROCEDURE[TUPLE[IUP_DATE_PICK]]
- cb_valuechanged: detachable FUNCTION[TUPLE[IUP_DATE_PICK], STRING]
-
-
- int_date_pick: POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupDatePick();"
- end
- end
|