Mercurial > octave-nkf
changeset 20555:7d7c91ddc736 stable
Handle hggroup objects "buttondownfcn" when children are clicked (bug #45621)
* Canvas.cc (Canvas::canvasMousePressEvent): when an object is clicked and has an empty "buttondownfcn",
execute it's parents "buttondownfcn" if the parent is a hggroup.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sun, 23 Aug 2015 21:45:49 +0200 |
parents | 7395fdd45d5f |
children | bbe6a846d8ac |
files | libgui/graphics/Canvas.cc |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc Sat Sep 26 10:44:08 2015 +0200 +++ b/libgui/graphics/Canvas.cc Sun Aug 23 21:45:49 2015 +0200 @@ -602,9 +602,20 @@ "windowbuttondownfcn", button_number (event)); - gh_manager::post_callback (currentObj.get_handle (), - "buttondownfcn", - button_number (event)); + if (currentObj.get ("buttondownfcn").is_empty ()) + { + graphics_object parentObj = + gh_manager::get_object (currentObj.get_parent ()); + + if (parentObj.valid_object () && parentObj.isa ("hggroup")) + gh_manager::post_callback (parentObj.get_handle (), + "buttondownfcn", + button_number (event)); + } + else + gh_manager::post_callback (currentObj.get_handle (), + "buttondownfcn", + button_number (event)); if (event->button () == Qt::RightButton) ContextMenu::executeAt (currentObj.get_properties (),