Class: OpenCV::GUI::MouseEvent

Inherits:
CvPoint
  • Object
show all
Defined in:
ext/opencv/mouseevent.cpp

Instance Method Summary collapse

Methods inherited from CvPoint

compatible?, #initialize, #to_ary, #to_s, #x, #x=, #y, #y=

Constructor Details

This class inherits a constructor from OpenCV::CvPoint

Instance Method Details

#alt_key?Boolean

Return true when ALT key is pushed. Otherwise return false.

Returns:

  • (Boolean)


135
136
137
138
139
# File 'ext/opencv/mouseevent.cpp', line 135

VALUE
rb_alt_key_q(VALUE self)
{
  return MOUSEEVENT(self)->flags & CV_EVENT_FLAG_ALTKEY ? Qtrue : Qfalse;
}

#ctrl_key?Boolean

Return true when CTRL key is pushed. Otherwise return false.

Returns:

  • (Boolean)


117
118
119
120
121
# File 'ext/opencv/mouseevent.cpp', line 117

VALUE
rb_ctrl_key_q(VALUE self)
{
  return MOUSEEVENT(self)->flags & CV_EVENT_FLAG_CTRLKEY ? Qtrue : Qfalse;
}

#eventObject

Return Symbol about mouse event.

Currently, return these symbol:

:move
  When mouse move.
:right_button_down
  When mouse right button down.
:left_button_down
  When mosue left button down.
:middle_button_down
  When mosue middle button down.
:left_button_up
  When mouse left button down.
:right_button_up
  When mouse right button down.
:middle_button_up
  When mouse middle button down.

note: original OpenCV define “double-click” event(e.g. CV_EVENT_LBUTTONDBLCLK). But never call these event. Is it bug?



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'ext/opencv/mouseevent.cpp', line 60

VALUE rb_event(VALUE self)
{
  switch(MOUSEEVENT(self)->event) {
  case CV_EVENT_MOUSEMOVE:
    return ID2SYM(rb_intern("move"));
  case CV_EVENT_LBUTTONDOWN:
    return ID2SYM(rb_intern("left_button_down"));
  case CV_EVENT_RBUTTONDOWN:
    return ID2SYM(rb_intern("right_button_down"));
  case CV_EVENT_MBUTTONDOWN:
    return ID2SYM(rb_intern("middle_button_down"));
  case CV_EVENT_LBUTTONUP:
    return ID2SYM(rb_intern("left_button_up"));
  case CV_EVENT_RBUTTONUP:
    return ID2SYM(rb_intern("right_button_up"));
  case CV_EVENT_MBUTTONUP:
    return ID2SYM(rb_intern("middle_button_up"));
  case CV_EVENT_LBUTTONDBLCLK:
    return ID2SYM(rb_intern("left_button_double_click"));
  case CV_EVENT_RBUTTONDBLCLK:
    return ID2SYM(rb_intern("right_button_double_click"));
  case CV_EVENT_MBUTTONDBLCLK:
    return ID2SYM(rb_intern("middle_button_double_click"));
  }
  return Qnil;
}

#left_button?Boolean

Return true when mouse left button is pushed. Otherwise return false.

Returns:

  • (Boolean)


90
91
92
93
94
# File 'ext/opencv/mouseevent.cpp', line 90

VALUE
rb_left_button_q(VALUE self)
{
  return MOUSEEVENT(self)->flags & CV_EVENT_FLAG_LBUTTON ? Qtrue : Qfalse;
}

#middle_button?Boolean

Return true when mouse middle button is pushed. Otherwise return false.

Returns:

  • (Boolean)


108
109
110
111
112
# File 'ext/opencv/mouseevent.cpp', line 108

VALUE
rb_middle_button_q(VALUE self)
{
  return MOUSEEVENT(self)->flags & CV_EVENT_FLAG_MBUTTON ? Qtrue : Qfalse;
}

#right_button?Boolean

Return true when mouse right button is pushed. Otherwise return false.

Returns:

  • (Boolean)


99
100
101
102
103
# File 'ext/opencv/mouseevent.cpp', line 99

VALUE
rb_right_button_q(VALUE self)
{
  return MOUSEEVENT(self)->flags & CV_EVENT_FLAG_RBUTTON ? Qtrue : Qfalse;
}

#shift_key?Boolean

Return true when shift key is pushed. Otherwise return false.

Returns:

  • (Boolean)


126
127
128
129
130
# File 'ext/opencv/mouseevent.cpp', line 126

VALUE
rb_shift_key_q(VALUE self)
{
  return MOUSEEVENT(self)->flags & CV_EVENT_FLAG_SHIFTKEY ? Qtrue : Qfalse;
}