Mercurial > octave
diff libinterp/corefcn/graphics.in.h @ 20077:69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
*graphics.in.h (base_graphics_opbject::properties): add updater for uicontextmenu property
*graphics.in.h (uicontextmenu::properties::dependent_obj_list): new private
attribute to store the list of objects that may depend on this uicontextmenu.
*graphics.in.h (uicontextmenu::properties::get_dependent_obj_list (),
uicontextmenu::properties::add_dependent_obj ()): new methods
* graphics.cc (base_graphics_opbject::properties::update_uicontextmenu):
new method to mark this graphics object as dependent on an
uicontextmenu object.
* graphics.cc (uicontextmenu::~uicontextmenu): reset the "uicontextmenu"
property of objects that have this uicontextmenu as current.
* graphics.cc (handle_property::do_set): let users reset a handle property
using empty matrix.
* graphics.cc: add BIST for bug #44801
* genpropdoc.m: document "uicontextmenu" property
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sat, 11 Apr 2015 17:25:35 +0200 |
parents | 10600b2dd3c1 |
children | b70f8da6dcd3 |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.in.h Tue Apr 14 14:27:22 2015 -0400 +++ b/libinterp/corefcn/graphics.in.h Sat Apr 11 17:25:35 2015 +0200 @@ -2595,6 +2595,8 @@ virtual void update_axis_limits (const std::string& axis_type, const graphics_handle& h) const; + virtual void update_uicontextmenu (void) const; + virtual void delete_children (bool clear = false) { children.delete_children (clear); @@ -2663,7 +2665,7 @@ bool_property selectionhighlight , "on" string_property tag s , "" string_property type frs , ty - handle_property uicontextmenu , graphics_handle () + handle_property uicontextmenu u , graphics_handle () any_property userdata , Matrix () bool_property visible , "on" // additional (Octave-specific) properties @@ -5355,6 +5357,15 @@ class OCTINTERP_API properties : public base_properties { public: + + void add_dependent_obj (graphics_handle gh) + { dependent_obj_list.push_back (gh); } + + // FIXME: the list may contain duplicates. + // Should we return only unique elements? + const std::list<graphics_handle> get_dependent_obj_list (void) + { return dependent_obj_list; } + // See the genprops.awk script for an explanation of the // properties declarations. // Programming note: Keep property list sorted if new ones are added. @@ -5372,6 +5383,10 @@ position.add_constraint (dim_vector (2, 1)); visible.set (octave_value (true)); } + + private: + // List of objects that might depend on this uicontextmenu object + std::list<graphics_handle> dependent_obj_list; }; private: @@ -5382,7 +5397,7 @@ : base_graphics_object (), xproperties (mh, p) { } - ~uicontextmenu (void) { } + ~uicontextmenu (void); base_properties& get_properties (void) { return xproperties; }