# HG changeset patch # User Michael Goffioul # Date 1318630746 -3600 # Node ID 22ce748da25f877462253d2fe2fa6944dd607e1c # Parent c7fac37a2afc1c54621037852a8e13f85b23c1e3 Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool. * graphics.h.in (uicontextmenu, uitoolbar, uipushtool, uitoggletool): New graphic object classes. (uicontrol::properties::cdata): Allow "single" and "uint8" data. * graphics.cc (uitoolbar): New class implementation. * gl-render.cc (opengl_renderer::draw): Skip new object types. * plot/private/__uiobject_split_args__.m: Don't use varargin. Add parent_type and use_gcf arguments. Check that number of arguments is a multiple of 2. * plot/uicontrol.m: Adapt call to __uiobject_split_args__. * plot/uipanel.m: Likewise. * plot/uimenu.m: Rewrite to use __uiobject_split_args__. * plot/uicontextmenu.m: New file. * plot/uitoolbar.m: Likewise. * plot/uipushtool.m: Likewise. * plot/uitoggletool.m: Likewise. * plot/modules.mk (plot_FCN_FILES): Add uicontextmenu.m, uitoolbar.m, uipushtool.m and uitoggletool.m. diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/module.mk --- a/scripts/plot/module.mk Fri Oct 14 17:06:49 2011 -0400 +++ b/scripts/plot/module.mk Fri Oct 14 23:19:06 2011 +0100 @@ -182,12 +182,16 @@ plot/trimesh.m \ plot/triplot.m \ plot/trisurf.m \ + plot/uicontextmenu.m \ plot/uicontrol.m \ plot/uigetdir.m \ plot/uigetfile.m \ plot/uimenu.m \ plot/uipanel.m \ + plot/uipushtool.m \ plot/uiputfile.m \ + plot/uitoggletool.m \ + plot/uitoolbar.m \ plot/view.m \ plot/waitforbuttonpress.m \ plot/whitebg.m \ diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/private/__uiobject_split_args__.m --- a/scripts/plot/private/__uiobject_split_args__.m Fri Oct 14 17:06:49 2011 -0400 +++ b/scripts/plot/private/__uiobject_split_args__.m Fri Oct 14 23:19:06 2011 +0100 @@ -17,28 +17,30 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @dots{}) +## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{args}, @var{parent_type}, @var{use_gcf}) ## @end deftypefn ## Author: goffioul -function [parent, args] = __uiobject_split_args__ (who, varargin) +function [parent, args] = __uiobject_split_args__ (who, in_args, parent_type = {}, use_gcf = 1) parent = []; args = {}; offset = 1; - if (nargin > 1) - if (ishandle (varargin{1})) - parent = varargin{1}; + if (! isempty (in_args)) + if (ishandle (in_args{1})) + parent = in_args{1}; offset = 2; - elseif (! ischar (varargin{1})) + elseif (! ischar (in_args{1})) error ("%s: invalid parent handle.", who); endif - if (nargin > offset) - args = varargin(offset:end); - endif + args = in_args(offset:end); + endif + + if (rem (length (args), 2)) + error ("%s: expecting PROPERTY/VALUE pairs", who); endif if (! isempty (args)) @@ -53,10 +55,11 @@ endif if (! isempty (parent)) - if (isempty (find (strcmpi (get (parent, "type"), {"figure", "uipanel", "uibuttongroup"})))) - error ("%s: invalid parent, the parent must be a figure, uipanel or uibuttongroup handle", who); + if (! isempty (parent_type) && isempty (find (strcmpi (get (parent, "type"), parent_type)))) + error ("%s: invalid parent, the parent type must be: %s", ... + who, sprintf ("%s, ", parent_type{:})(1:end-2)); endif - else + elseif (use_gcf) parent = gcf (); endif diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/uicontextmenu.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/uicontextmenu.m Fri Oct 14 23:19:06 2011 +0100 @@ -0,0 +1,30 @@ +## Copyright (C) 2011 Michael Goffioul +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{handle} =} uicontextmenu ('Name', value, @dots{}) +## @end deftypefn + +## Author: goffioul + +function handle = uicontextmenu (varargin) + + [h, args] = __uiobject_split_args__ ("uicontextmenu", varargin, {"figure"}); + handle = __go_uicontextmenu__ (h, args{:}); + +endfunction diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/uicontrol.m --- a/scripts/plot/uicontrol.m Fri Oct 14 17:06:49 2011 -0400 +++ b/scripts/plot/uicontrol.m Fri Oct 14 23:19:06 2011 +0100 @@ -29,7 +29,7 @@ if (nargin == 1 && ishandle (varargin{1}) && strcmpi (get (varargin{1}, "type"), "uicontrol")) error ("uicontrol focusing not implemented yet."); else - [h, args] = __uiobject_split_args__ ("uicontrol", varargin{:}); + [h, args] = __uiobject_split_args__ ("uicontrol", varargin, {"figure", "uipanel", "uibuttongroup"}); handle = __go_uicontrol__ (h, args{:}); endif diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/uimenu.m --- a/scripts/plot/uimenu.m Fri Oct 14 17:06:49 2011 -0400 +++ b/scripts/plot/uimenu.m Fri Oct 14 23:19:06 2011 +0100 @@ -79,18 +79,7 @@ function hui = uimenu (varargin) - args = varargin; - - if (ishandle (args{1})) - h = args{1}; - args(1) = []; - else - h = gcf (); - endif - - if (rem (length (args), 2)) - error ("uimenu: expecting PROPERTY/VALUE pairs"); - endif + [h, args] = __uiobject_split_args__ ("uimenu", varargin, {"figure", "uicontextmenu", "uimenu"}); tmp = __go_uimenu__ (h, args{:}); diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/uipanel.m --- a/scripts/plot/uipanel.m Fri Oct 14 17:06:49 2011 -0400 +++ b/scripts/plot/uipanel.m Fri Oct 14 23:19:06 2011 +0100 @@ -25,7 +25,7 @@ function handle = uipanel (varargin) - [h, args] = __uiobject_split_args__ ("uipanel", varargin{:}); + [h, args] = __uiobject_split_args__ ("uipanel", varargin, {"figure", "uipanel", "uibuttongroup"}); handle = __go_uipanel__ (h, args{:}); endfunction diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/uipushtool.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/uipushtool.m Fri Oct 14 23:19:06 2011 +0100 @@ -0,0 +1,34 @@ +## Copyright (C) 2011 Michael Goffioul +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{handle} =} uipushtool ('Name', value, @dots{}) +## @deftypefnx {Function File} {@var{handle} =} uipushtool (@var{parent}, 'Name', value, @dots{}) +## @end deftypefn + +## Author: goffioul + +function handle = uipushtool (varargin) + + [h, args] = __uiobject_split_args__ ("uipushtool", varargin, {"uitoolbar"}, 0); + if (isempty (h)) + h = uitoolbar (); + endif + handle = __go_uipushtool__ (h, args{:}); + +endfunction diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/uitoggletool.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/uitoggletool.m Fri Oct 14 23:19:06 2011 +0100 @@ -0,0 +1,34 @@ +## Copyright (C) 2011 Michael Goffioul +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{handle} =} uitoggletool ('Name', value, @dots{}) +## @deftypefnx {Function File} {@var{handle} =} uitoggletool (@var{parent}, 'Name', value, @dots{}) +## @end deftypefn + +## Author: goffioul + +function handle = uitoggletool (varargin) + + [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, {"uitoolbar"}, 0); + if (isempty (h)) + h = uitoolbar (); + endif + handle = __go_uitoggletool__ (h, args{:}); + +endfunction diff -r c7fac37a2afc -r 22ce748da25f scripts/plot/uitoolbar.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/uitoolbar.m Fri Oct 14 23:19:06 2011 +0100 @@ -0,0 +1,31 @@ +## Copyright (C) 2011 Michael Goffioul +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{handle} =} uitoolbar ('Name', value, @dots{}) +## @deftypefnx {Function File} {@var{handle} =} uitoolbar (@var{parent}, 'Name', value, @dots{}) +## @end deftypefn + +## Author: goffioul + +function handle = uitoolbar (varargin) + + [h, args] = __uiobject_split_args__ ("uitoolbar", varargin, {"figure"}); + handle = __go_uitoolbar__ (h, args{:}); + +endfunction diff -r c7fac37a2afc -r 22ce748da25f src/gl-render.cc --- a/src/gl-render.cc Fri Oct 14 17:06:49 2011 -0400 +++ b/src/gl-render.cc Fri Oct 14 23:19:06 2011 +0100 @@ -567,7 +567,9 @@ draw_text (dynamic_cast (props)); else if (go.isa ("image")) draw_image (dynamic_cast (props)); - else if (go.isa ("uimenu") || go.isa ("uicontrol")) + else if (go.isa ("uimenu") || go.isa ("uicontrol") + || go.isa ("uicontextmenu") || go.isa ("uitoolbar") + || go.isa ("uipushtool") || go.isa ("uitoggletool")) /* SKIP */; else if (go.isa ("uipanel")) { diff -r c7fac37a2afc -r 22ce748da25f src/graphics.cc --- a/src/graphics.cc Fri Oct 14 17:06:49 2011 -0400 +++ b/src/graphics.cc Fri Oct 14 23:19:06 2011 +0100 @@ -813,14 +813,36 @@ pfx = name.substr (0, 7); if (pfx.compare ("surface") || pfx.compare ("hggroup") - || pfx.compare ("uipanel")) + || pfx.compare ("uipanel")) offset = 7; else if (len >= 9) { pfx = name.substr (0, 9); - if (pfx.compare ("uicontrol")) + if (pfx.compare ("uicontrol") + || pfx.compare ("uitoolbar")) offset = 9; + else if (len >= 10) + { + pfx = name.substr (0, 10); + + if (pfx.compare ("uipushtool")) + offset = 10; + else if (len >= 12) + { + pfx = name.substr (0, 12); + + if (pfx.compare ("uitoggletool")) + offset = 12; + else if (len >= 13) + { + pfx = name.substr (0, 13); + + if (pfx.compare ("uicontextmenu")) + offset = 13; + } + } + } } } } @@ -866,6 +888,14 @@ go = new uicontrol (h, p); else if (type.compare ("uipanel")) go = new uipanel (h, p); + else if (type.compare ("uicontextmenu")) + go = new uicontextmenu (h, p); + else if (type.compare ("uitoolbar")) + go = new uitoolbar (h, p); + else if (type.compare ("uipushtool")) + go = new uipushtool (h, p); + else if (type.compare ("uitoggletool")) + go = new uitoggletool (h, p); return go; } @@ -1657,8 +1687,30 @@ { pfx = name.substr (0, 9); - if (pfx.compare ("uicontrol")) + if (pfx.compare ("uicontrol") + || pfx.compare ("uitoolbar")) offset = 9; + else if (len > 10) + { + pfx = name.substr (0, 10); + + if (pfx.compare ("uipushtool")) + offset = 10; + else if (len > 12) + { + pfx = name.substr (0, 12); + + if (pfx.compare ("uitoogletool")) + offset = 12; + else if (len > 13) + { + pfx = name.substr (0, 13); + + if (pfx.compare ("uicontextmenu")) + offset = 13; + } + } + } } } } @@ -1696,6 +1748,12 @@ has_property = uicontrol::properties::has_core_property (pname); else if (pfx == "uipanel") has_property = uipanel::properties::has_core_property (pname); + else if (pfx == "uicontextmenu") + has_property = uicontextmenu::properties::has_core_property (pname); + else if (pfx == "uitoolbar") + has_property = uitoolbar::properties::has_core_property (pname); + else if (pfx == "uipushtool") + has_property = uipushtool::properties::has_core_property (pname); if (has_property) { @@ -1767,8 +1825,30 @@ { pfx = name.substr (0, 9); - if (pfx.compare ("uicontrol")) + if (pfx.compare ("uicontrol") + || pfx.compare ("uitoolbar")) offset = 9; + else if (len > 10) + { + pfx = name.substr (0, 10); + + if (pfx.compare ("uipushtool")) + offset = 10; + else if (len > 12) + { + pfx = name.substr (0, 12); + + if (pfx.compare ("uitoggletool")) + offset = 12; + else if (len > 13) + { + pfx = name.substr (0, 13); + + if (pfx.compare ("uicontextmenu")) + offset = 13; + } + } + } } } } @@ -6870,9 +6950,9 @@ elt = text_parser_none ().parse (get_string_string ()); #ifdef HAVE_FONTCONFIG text_renderer.set_font (get_fontname (), - get_fontweight (), - get_fontangle (), - get_fontsize ()); + get_fontweight (), + get_fontangle (), + get_fontsize ()); #endif box = text_renderer.get_extent (elt, 0); @@ -7116,6 +7196,30 @@ // --------------------------------------------------------------------- octave_value +uitoolbar::get_default (const caseless_str& name) const +{ + octave_value retval = default_properties.lookup (name); + + if (retval.is_undefined ()) + { + graphics_handle parent = get_parent (); + graphics_object parent_obj = gh_manager::get_object (parent); + + retval = parent_obj.get_default (name); + } + + return retval; +} + +void +uitoolbar::reset_default_properties (void) +{ + ::reset_default_properties (default_properties); +} + +// --------------------------------------------------------------------- + +octave_value base_graphics_object::get_default (const caseless_str& name) const { graphics_handle parent = get_parent (); @@ -7578,7 +7682,7 @@ gh_manager::unlock (); if (e.ok ()) - e.execute (); + e.execute (); } while (e.ok ()); @@ -7638,6 +7742,10 @@ plist_map["uimenu"] = uimenu::properties::factory_defaults (); plist_map["uicontrol"] = uicontrol::properties::factory_defaults (); plist_map["uipanel"] = uipanel::properties::factory_defaults (); + plist_map["uicontextmenu"] = uicontextmenu::properties::factory_defaults (); + plist_map["uitoolbar"] = uitoolbar::properties::factory_defaults (); + plist_map["uipushtool"] = uipushtool::properties::factory_defaults (); + plist_map["uitoggletool"] = uitoggletool::properties::factory_defaults (); return plist_map; } @@ -8166,7 +8274,7 @@ if (xisnan (val)) h = gh_manager::make_graphics_handle ("figure", 0, false, - false); + false); else if (val > 0 && D_NINT (val) == val) h = gh_manager::make_figure_handle (val, false); else @@ -8358,6 +8466,42 @@ GO_BODY (uipanel); } +DEFUN (__go_uicontextmenu__, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} __go_uicontextmenu__ (@var{parent})\n\ +Undocumented internal function.\n\ +@end deftypefn") +{ + GO_BODY (uicontextmenu); +} + +DEFUN (__go_uitoolbar__, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} __go_uitoolbar__ (@var{parent})\n\ +Undocumented internal function.\n\ +@end deftypefn") +{ + GO_BODY (uitoolbar); +} + +DEFUN (__go_uipushtool__, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} __go_uipushtool__ (@var{parent})\n\ +Undocumented internal function.\n\ +@end deftypefn") +{ + GO_BODY (uipushtool); +} + +DEFUN (__go_uitoggletool__, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} __go_uitoggletool__ (@var{parent})\n\ +Undocumented internal function.\n\ +@end deftypefn") +{ + GO_BODY (uitoggletool); +} + DEFUN (__go_delete__, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ diff -r c7fac37a2afc -r 22ce748da25f src/graphics.h.in --- a/src/graphics.h.in Fri Oct 14 17:06:49 2011 -0400 +++ b/src/graphics.h.in Fri Oct 14 23:19:06 2011 +0100 @@ -4613,6 +4613,51 @@ // --------------------------------------------------------------------- +class OCTINTERP_API uicontextmenu : public base_graphics_object +{ +public: + class OCTINTERP_API properties : public base_properties + { + public: + // See the genprops.awk script for an explanation of the + // properties declarations. + + BEGIN_PROPERTIES (uicontextmenu) + any_property __object__ , Matrix () + callback_property callback , Matrix() + array_property position , Matrix (1, 2, 0.0) + END_PROPERTIES + + protected: + void init (void) + { + position.add_constraint (dim_vector (1, 2)); + position.add_constraint (dim_vector (2, 1)); + } + }; + +private: + properties xproperties; + +public: + uicontextmenu (const graphics_handle& mh, const graphics_handle& p) + : base_graphics_object (), xproperties (mh, p) + { + xproperties.override_defaults (*this); + } + + ~uicontextmenu (void) { xproperties.delete_children (); } + + base_properties& get_properties (void) { return xproperties; } + + const base_properties& get_properties (void) const { return xproperties; } + + bool valid_object (void) const { return true; } + +}; + +// --------------------------------------------------------------------- + class OCTINTERP_API uicontrol : public base_graphics_object { public: @@ -4663,6 +4708,8 @@ void init (void) { cdata.add_constraint ("double"); + cdata.add_constraint ("single"); + cdata.add_constraint ("uint8"); cdata.add_constraint (dim_vector (-1, -1, 3)); position.add_constraint (dim_vector (1, 4)); sliderstep.add_constraint (dim_vector (1, 2)); @@ -4769,6 +4816,197 @@ // --------------------------------------------------------------------- +class OCTINTERP_API uitoolbar : public base_graphics_object +{ +public: + class OCTINTERP_API properties : public base_properties + { + public: + // See the genprops.awk script for an explanation of the + // properties declarations. + + BEGIN_PROPERTIES (uitoolbar) + any_property __object__ , Matrix () + END_PROPERTIES + + protected: + void init (void) + { } + }; + +private: + properties xproperties; + +public: + uitoolbar (const graphics_handle& mh, const graphics_handle& p) + : base_graphics_object (), xproperties (mh, p), default_properties () + { + xproperties.override_defaults (*this); + } + + ~uitoolbar (void) { xproperties.delete_children (); } + + void override_defaults (base_graphics_object& obj) + { + // Allow parent (figure) to override first (properties knows how + // to find the parent object). + xproperties.override_defaults (obj); + + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } + + void set (const caseless_str& name, const octave_value& value) + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } + + octave_value get (const caseless_str& name) const + { + octave_value retval; + + if (name.compare ("default", 7)) + retval = get_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } + + octave_value get_default (const caseless_str& name) const; + + octave_value get_defaults (void) const + { + return default_properties.as_struct ("default"); + } + + base_properties& get_properties (void) { return xproperties; } + + const base_properties& get_properties (void) const { return xproperties; } + + bool valid_object (void) const { return true; } + + void reset_default_properties (void); + +private: + property_list default_properties; +}; + +// --------------------------------------------------------------------- + +class OCTINTERP_API uipushtool : public base_graphics_object +{ +public: + class OCTINTERP_API properties : public base_properties + { + public: + // See the genprops.awk script for an explanation of the + // properties declarations. + + BEGIN_PROPERTIES (uipushtool) + any_property __object__ , Matrix () + array_property cdata , Matrix () + callback_property clickedcallback , Matrix() + bool_property enable , "on" + bool_property separator , "off" + string_property tooltipstring , "" + END_PROPERTIES + + protected: + void init (void) + { + cdata.add_constraint ("double"); + cdata.add_constraint ("single"); + cdata.add_constraint ("uint8"); + cdata.add_constraint (dim_vector (-1, -1, 3)); + } + }; + +private: + properties xproperties; + +public: + uipushtool (const graphics_handle& mh, const graphics_handle& p) + : base_graphics_object (), xproperties (mh, p) + { + xproperties.override_defaults (*this); + } + + ~uipushtool (void) { xproperties.delete_children (); } + + base_properties& get_properties (void) { return xproperties; } + + const base_properties& get_properties (void) const { return xproperties; } + + bool valid_object (void) const { return true; } + +}; + +// --------------------------------------------------------------------- + +class OCTINTERP_API uitoggletool : public base_graphics_object +{ +public: + class OCTINTERP_API properties : public base_properties + { + public: + // See the genprops.awk script for an explanation of the + // properties declarations. + + BEGIN_PROPERTIES (uitoggletool) + any_property __object__ , Matrix () + array_property cdata , Matrix () + callback_property clickedcallback , Matrix() + bool_property enable , "on" + callback_property offcallback , Matrix() + callback_property oncallback , Matrix() + bool_property separator , "off" + bool_property state , "off" + string_property tooltipstring , "" + END_PROPERTIES + + protected: + void init (void) + { + cdata.add_constraint ("double"); + cdata.add_constraint ("single"); + cdata.add_constraint ("uint8"); + cdata.add_constraint (dim_vector (-1, -1, 3)); + } + }; + +private: + properties xproperties; + +public: + uitoggletool (const graphics_handle& mh, const graphics_handle& p) + : base_graphics_object (), xproperties (mh, p) + { + xproperties.override_defaults (*this); + } + + ~uitoggletool (void) { xproperties.delete_children (); } + + base_properties& get_properties (void) { return xproperties; } + + const base_properties& get_properties (void) const { return xproperties; } + + bool valid_object (void) const { return true; } + +}; + +// --------------------------------------------------------------------- + octave_value get_property_from_handle (double handle, const std::string &property, const std::string &func);