Mercurial > octave-libgccjit
comparison libgui/graphics/BaseControl.cc @ 18612:9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
* Figure.cc (Figure::Figure): Enable mouse tracking if
windowbuttonmotionfcn callback is defined.
(Figure::update): Enable mouse tracking on canvas and all child widgets
when windowbuttonmotionfcn is defined.
* Panel.cc (Panel::Panel): Propagate mouse tracking to child widgets
during initialization.
* Container.h (Container::childEvent): New method.
* Container.cc (Container::childEvent): Likewise. Propagate mouse
tracking status to child widgets.
* BaseControl.cc (BaseControl::eventFilter): Handle mouse move events
and call figure's appropriate callback.
* Canvas.h (Canvas::updateCurrentPoint): New method.
* Canvas.cc (Canvas::updateCurrentPoint): Likewise. Update figure and
child axes currentpoint property.
(Canvas::canvasMouseMoveEvent): Update currentpoint properties and call
windowbuttonmotionfcn callback.
(Canvas::canvasMousePressEvent): Call updateCurrentPoint.
(Canvas::canvasMouseReleaseEvent): Likewise.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Tue, 01 Apr 2014 20:57:08 -0400 |
parents | fb96b7f55242 |
children | fe0e34be5576 |
comparison
equal
deleted
inserted
replaced
18606:0ede4dbb37f1 | 18612:9597e00ed2dd |
---|---|
193 gh_manager::post_set (fig.get_handle (), "selectiontype", | 193 gh_manager::post_set (fig.get_handle (), "selectiontype", |
194 octave_value ("normal"), false); | 194 octave_value ("normal"), false); |
195 } | 195 } |
196 } | 196 } |
197 break; | 197 break; |
198 case QEvent::MouseMove: | |
199 if (qWidget<QWidget> ()->hasMouseTracking ()) | |
200 { | |
201 gh_manager::auto_lock lock; | |
202 | |
203 QMouseEvent* m = dynamic_cast<QMouseEvent*> (event); | |
204 graphics_object go = object (); | |
205 graphics_object fig = go.get_ancestor ("figure"); | |
206 | |
207 gh_manager::post_set (fig.get_handle (), "currentpoint", | |
208 Utils::figureCurrentPoint (fig, m), false); | |
209 gh_manager::post_callback (fig.get_handle (), "windowbuttonmotionfcn"); | |
210 } | |
211 break; | |
198 case QEvent::KeyPress: | 212 case QEvent::KeyPress: |
199 if (m_keyPressHandlerDefined) | 213 if (m_keyPressHandlerDefined) |
200 { | 214 { |
201 gh_manager::auto_lock lock; | 215 gh_manager::auto_lock lock; |
202 | 216 |