iup_message_alarm.e 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. class IUP_MESSAGE_ALARM
  2. -- Shows a modal dialog containing a question message, similar
  3. -- to IUP_ALARM.
  4. create {ANY}
  5. message_alarm_with_parent,
  6. message_alarm
  7. feature {ANY}
  8. message_alarm_with_parent (parent: IUP_DIALOG; title, message, buttons: STRING): INTEGER
  9. -- hows a modal dialog containing a question message, similar to
  10. -- IUP_ALARM.
  11. --
  12. -- parent: parent dialog.
  13. -- title: dialog’s title. It can be a language pre-defined string
  14. -- without the "_@" prefix.
  15. -- message: text message contents. It can be a language pre-defined
  16. -- string without the "_@" prefix.
  17. -- buttons: list of buttons. Can have values: "OK", "OKCANCEL",
  18. -- "RETRYCANCEL", "YESNO", or "YESNOCANCEL".
  19. --
  20. -- Returns: the number of the button selected by the user (1, 2 or 3).
  21. --
  22. -- The dialog is shown centered relative to its parent.
  23. require
  24. is_valid_buttons(buttons)
  25. do
  26. Result := int_message_alarm (parent.widget, title.to_external,
  27. message.to_external, buttons.to_external)
  28. end
  29. message_alarm (title, message, buttons: STRING): INTEGER
  30. -- The title defaults to "Attention!" and tries the global attribute
  31. -- "PARENTDIALOG" as the parent dialog.
  32. require
  33. is_valid_buttons(buttons)
  34. local
  35. p: POINTER
  36. do
  37. Result := int_message_alarm (p, title.to_external,
  38. message.to_external, buttons.to_external)
  39. end
  40. feature {}
  41. -- Internal
  42. int_message_alarm (wgt, t, m, b: POINTER): INTEGER
  43. external "plug_in"
  44. alias "{
  45. location: "${sys}/plugins"
  46. module_name: "iup"
  47. feature_name: "IupMessageAlarm"
  48. }"
  49. end
  50. end -- class IUP_MESSAGE_ALARM
  51. -- The MIT License (MIT)
  52. -- Copyright (c) 2017 by German A. Arias
  53. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  54. -- of this software and associated documentation files (the "Software"), to deal
  55. -- in the Software without restriction, including without limitation the rights
  56. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  57. -- copies of the Software, and to permit persons to whom the Software is
  58. -- furnished to do so, subject to the following conditions:
  59. --
  60. -- The above copyright notice and this permission notice shall be included in
  61. -- all copies or substantial portions of the Software.
  62. --
  63. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  64. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  65. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  66. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  67. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  68. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  69. -- SOFTWARE.