iup_widget_cb_button.e 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. deferred class IUP_WIDGET_CB_BUTTON
  2. -- Command to handle the callback button.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. feature {ANY}
  6. set_cb_button (act: detachable FUNCTION[TUPLE[IUP_BUTTON, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING])
  7. -- Action generated when any mouse button is pressed and when it is
  8. -- released. Both calls occur before the ACTION callback when button 1 is
  9. -- being used.
  10. --
  11. -- IUP_BUTTON: identifies the element that activated the event.
  12. -- button: identifies the activated mouse button:
  13. --
  14. -- 1 - left mouse button (button 1);
  15. -- 2 - middle mouse button (button 2);
  16. -- 3 - right mouse button (button 3).
  17. --
  18. -- pressed: indicates the state of the button:
  19. --
  20. -- 0 - mouse button was released;
  21. -- 1 - mouse button was pressed.
  22. --
  23. -- x, y: position in the canvas where the event has occurred, in pixels.
  24. --
  25. -- status: status of the mouse buttons and some keyboard keys at the
  26. -- moment the event is generated. The following IUP features must be used
  27. -- for verification:
  28. --
  29. -- is_shift(status)
  30. -- is_control(status)
  31. -- is_button_1(status)
  32. -- is_button_2(status)
  33. -- is_button_3(status)
  34. -- is_button_4(status)
  35. -- is_button_5(status)
  36. -- is_double(status)
  37. -- is_alt(status)
  38. -- is_sys(status)
  39. --
  40. -- Returns: IUP_CLOSE will be processed. On some controls if IUP_IGNORE
  41. -- is returned the action is ignored (this is system dependent).
  42. local
  43. operation: INTEGER
  44. do
  45. cb_button := act
  46. if cb_button /= Void then
  47. operation := 1
  48. else
  49. operation := 0
  50. end
  51. iup_open.set_callback (Current, "BUTTON_CB", "NONEEDED", operation)
  52. end
  53. feature {NONE}
  54. cb_button: detachable FUNCTION[TUPLE[IUP_BUTTON, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING]
  55. end
  56. -- The MIT License (MIT)
  57. -- Copyright (c) 2016, 2019, 2020 by German A. Arias
  58. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  59. -- of this software and associated documentation files (the "Software"), to deal
  60. -- in the Software without restriction, including without limitation the rights
  61. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  62. -- copies of the Software, and to permit persons to whom the Software is
  63. -- furnished to do so, subject to the following conditions:
  64. --
  65. -- The above copyright notice and this permission notice shall be included in
  66. -- all copies or substantial portions of the Software.
  67. --
  68. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  69. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  71. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  72. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  73. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  74. -- SOFTWARE.