123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- class IUP_MESSAGE_ALARM
- -- Shows a modal dialog containing a question message, similar
- -- to IUP_ALARM.
- inherit
- IUP_GET_POINTER
- create {ANY}
- message_alarm_with_parent,
- message_alarm
-
- feature {ANY}
- message_alarm_with_parent (parent: IUP_DIALOG; title, message, buttons: STRING)
- -- hows a modal dialog containing a question message, similar to
- -- IUP_ALARM.
- --
- -- parent: parent dialog.
- -- title: dialog’s title. It can be a language pre-defined string
- -- without the "_@" prefix.
- -- message: text message contents. It can be a language pre-defined
- -- string without the "_@" prefix.
- -- buttons: list of buttons. Can have values: "OK", "OKCANCEL",
- -- "RETRYCANCEL", "YESNO", or "YESNOCANCEL".
- --
- -- The dialog is shown centered relative to its parent.
- require
- is_valid_buttons(buttons)
- do
- int_parent := parent.widget
- int_tittle := title
- int_message := message
- int_buttons := buttons
- end
- message_alarm (title, message, buttons: STRING)
- -- The title defaults to "Attention!" and tries the global attribute
- -- "PARENTDIALOG" as the parent dialog.
- require
- is_valid_buttons(buttons)
- do
- int_tittle := title
- int_message := message
- int_buttons := buttons
- end
- launch: INTEGER
- -- Launch the message alarm.
- --
- -- Returns: the number of the button selected by the user (1, 2 or 3).
- do
- Result := int_message_alarm (int_parent, get_pointer(int_tittle.to_c),
- get_pointer(int_message.to_c), get_pointer(int_buttons.to_c))
- end
- -- Validations
- is_valid_buttons (value: STRING): BOOLEAN
- do
- if value.is_equal ("OK") or
- value.is_equal ("OKCANCEL") or
- value.is_equal ("RETRYCANCEL") or
- value.is_equal ("YESNO") or
- value.is_equal ("YESNOCANCEL") then
- Result := True
- else
- Result := False
- end
- end
-
- feature {NONE}
- -- Internal
- int_parent: POINTER
- int_tittle, int_message, int_buttons: STRING
-
- int_message_alarm (wgt, t, m, b: POINTER): INTEGER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupMessageAlarm ($wgt, $t, $m, $b);"
- end
-
- end -- class IUP_MESSAGE_ALARM
- -- The MIT License (MIT)
- -- Copyright (c) 2017, 2019 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.
|