123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- class IUP_ALARM
- -- Shows a modal dialog containing a message and up to three buttons.
- --
- -- This function shows a dialog centralized on the screen, with the message and
- -- the buttons. The ‘%N’ character can be added to the message to indicate line
- -- change.
- --
- -- Button 1 is set as the "DEFAULTENTER" and "DEFAULTESC". If Button 2 exists
- -- it is set as the "DEFAULTESC". If Button 3 exists it is set as the
- -- "DEFAULTESC".
- --
- -- The dialog uses a global attribute called "PARENTDIALOG" as the parent
- -- dialog if it is defined. It also uses a global attribute called "ICON" as
- -- the dialog icon if it is defined.
- inherit
- IUP_WIDGET
- create {ANY}
- alarm_one_button,
- alarm_two_buttons,
- alarm_three_buttons
-
- feature {ANY}
-
- alarm_one_button (title: STRING; message: STRING; text_button_1: STRING)
- -- Create an alarm dialog with title, a message and one button.
- do
- t := title
- m := message
- bt1 := text_button_1
- type := 1
- end
- alarm_two_buttons (title, message, text_button_1, text_button_2: STRING)
- -- Create an alarm dialog with title, a message and two buttons.
- do
- t := title
- m := message
- bt1 := text_button_1
- bt2 := text_button_2
- type := 2
- end
- alarm_three_buttons (title, message, text_button_1,
- text_button_2, text_button_3: STRING)
- -- Create an alarm dialog with title, a message and three buttons.
- do
- t := title
- m := message
- bt1 := text_button_1
- bt2 := text_button_2
- bt3 := text_button_3
- type := 3
- end
- launch: INTEGER
- -- Returns the number of the button selected by the user (1, 2 or 3) , or
- -- 0 if failed. It fails only if button 1 is not defined.
- local
- p: POINTER
- do
- if type.is_equal(1) then
- Result := int_alarm (get_pointer(t.to_c), get_pointer(m.to_c),
- get_pointer(bt1.to_c), p, p)
- elseif type.is_equal(2) and
- attached bt2 as button_2 then
- Result := int_alarm (get_pointer(t.to_c), get_pointer(m.to_c),
- get_pointer(bt1.to_c),
- get_pointer(button_2.to_c), p)
- elseif type.is_equal(3) and
- attached bt2 as button_2 and
- attached bt3 as button_3 then
- Result := int_alarm (get_pointer(t.to_c), get_pointer(m.to_c),
- get_pointer(bt1.to_c),
- get_pointer(button_2.to_c),
- get_pointer(button_3.to_c))
- else
- Result := 0
- end
- end
-
- feature {NONE}
- t, m, bt1: STRING
- bt2, bt3: detachable STRING
- type: INTEGER
- -- Internal
-
- int_alarm (title: POINTER; message: POINTER; b1, b2, b3: POINTER): INTEGER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupAlarm ($title, $message, $b1, $b2, $b3);"
- end
-
- end -- class IUP_ALARM
- -- The MIT License (MIT)
- -- Copyright (c) 2016, 2017, 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.
|