iup_widget_cb_button.e 2.8 KB

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