Class: Wx::SF::ShapeMouseEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/wx/shapes/events.rb

Overview

Class encapsulates Wx::SF shape’s mouse event.

Instance Method Summary collapse

Constructor Details

#initialize(evt_type = Wx::EVT_NULL, id = 0) ⇒ ShapeMouseEvent

Constructor

Parameters:

  • evt_type (Integer) (defaults to: Wx::EVT_NULL)
  • id (Integer) (defaults to: 0)


89
90
91
92
93
# File 'lib/wx/shapes/events.rb', line 89

def initialize(evt_type = Wx::EVT_NULL, id = 0)
  super(evt_type, id.to_i)
  @shape = nil
  @mouse_pos = Wx::DEFAULT_POSITION
end

Instance Method Details

#get_mouse_positionWx::Point Also known as: mouse_position

Get absolute position of mouse cursor

Returns:

  • (Wx::Point)

    Mouse cursor’s absolute position



118
119
120
# File 'lib/wx/shapes/events.rb', line 118

def get_mouse_position
  @mouse_position
end

#get_shapeWx::SF::Shape? Also known as: shape

Get a shape object from the event object.

Returns:



104
105
106
# File 'lib/wx/shapes/events.rb', line 104

def get_shape
  @shape
end

#set_mouse_position(mouse_position) ⇒ Object Also known as: mouse_position=

Set absolute position of mouse cursor.

Parameters:

  • mouse_position (Wx::Point)

    Mouse cursor’s absolute position



111
112
113
# File 'lib/wx/shapes/events.rb', line 111

def set_mouse_position(mouse_position)
  @mouse_position = mouse_position.to_point
end

#set_shape(shape) ⇒ Object Also known as: shape=

Insert a shape object to the event object.

Parameters:



97
98
99
# File 'lib/wx/shapes/events.rb', line 97

def set_shape(shape)
  @shape = shape
end