comparison src/graphics.cc @ 10265:8c583af2cf64

validate text object children of axes objects
author John W. Eaton <jwe@octave.org>
date Thu, 04 Feb 2010 03:56:28 -0500
parents cd96d29c5efa
children 4b124317dc38
comparison
equal deleted inserted replaced
10264:e58c1711d752 10265:8c583af2cf64
2662 void 2662 void
2663 axes::properties::set_text_child (handle_property& hp, 2663 axes::properties::set_text_child (handle_property& hp,
2664 const std::string& who, 2664 const std::string& who,
2665 const octave_value& v) 2665 const octave_value& v)
2666 { 2666 {
2667 graphics_handle val = ::reparent (v, "set", who, __myhandle__, false); 2667 graphics_handle val;
2668
2669 if (v.is_string ())
2670 {
2671 val = gh_manager::make_graphics_handle ("text", __myhandle__, false);
2672
2673 xset (val, "string", v);
2674 }
2675 else
2676 {
2677 graphics_object go = gh_manager::get_object (gh_manager::lookup (v));
2678
2679 if (go.isa ("text"))
2680 val = ::reparent (v, "set", who, __myhandle__, false);
2681 else
2682 {
2683 std::string cname = v.class_name ();
2684
2685 error ("set: expecting text graphics object or character string for %s property, found %s",
2686 who.c_str (), cname.c_str ());
2687 }
2688 }
2668 2689
2669 if (! error_state) 2690 if (! error_state)
2670 { 2691 {
2671 xset (val, "handlevisibility", "off"); 2692 xset (val, "handlevisibility", "off");
2672 2693