comparison src/graphics.cc @ 11155:f0e9befd6a1c

add uimenu graphic object to fltk backend
author Kai Habel <kai.habel@gmx.de>
date Mon, 25 Oct 2010 11:26:43 +0200
parents b748b86cb8c1
children a981e2f56ec1
comparison
equal deleted inserted replaced
11154:92a7c136ab35 11155:f0e9befd6a1c
53 #include "txt-eng-ft.h" 53 #include "txt-eng-ft.h"
54 #include "unwind-prot.h" 54 #include "unwind-prot.h"
55 55
56 // forward declarations 56 // forward declarations
57 static octave_value xget (const graphics_handle& h, const caseless_str& name); 57 static octave_value xget (const graphics_handle& h, const caseless_str& name);
58 static graphics_object xget_ancestor (const graphics_object& go_arg, 58 graphics_object xget_ancestor (const graphics_object& go_arg,
59 const std::string& type); 59 const std::string& type);
60 60
61 static void 61 static void
62 gripe_set_invalid (const std::string& pname) 62 gripe_set_invalid (const std::string& pname)
63 { 63 {
539 graphics_object obj = gh_manager::get_object (0); 539 graphics_object obj = gh_manager::get_object (0);
540 Matrix sz = obj.get ("screensize").matrix_value (); 540 Matrix sz = obj.get ("screensize").matrix_value ();
541 return convert_position (sz, obj.get ("units").string_value (), "pixels", sz.extract_n (0, 2, 1, 2)).extract_n (0, 2, 1, 2); 541 return convert_position (sz, obj.get ("units").string_value (), "pixels", sz.extract_n (0, 2, 1, 2)).extract_n (0, 2, 1, 2);
542 } 542 }
543 543
544 static graphics_object 544 graphics_object
545 xget_ancestor (const graphics_object& go_arg, const std::string& type) 545 xget_ancestor (const graphics_object& go_arg, const std::string& type)
546 { 546 {
547 graphics_object go = go_arg; 547 graphics_object go = go_arg;
548 548
549 do 549 do
725 offset = 5; 725 offset = 5;
726 else if (len >= 6) 726 else if (len >= 6)
727 { 727 {
728 pfx = name.substr (0, 6); 728 pfx = name.substr (0, 6);
729 729
730 if (pfx.compare ("figure")) 730 if (pfx.compare ("figure") || pfx.compare ("uimenu"))
731 offset = 6; 731 offset = 6;
732 else if (len >= 7) 732 else if (len >= 7)
733 { 733 {
734 pfx = name.substr (0, 7); 734 pfx = name.substr (0, 7);
735 735
771 go = new patch (h, p); 771 go = new patch (h, p);
772 else if (type.compare ("surface")) 772 else if (type.compare ("surface"))
773 go = new surface (h, p); 773 go = new surface (h, p);
774 else if (type.compare ("hggroup")) 774 else if (type.compare ("hggroup"))
775 go = new hggroup (h, p); 775 go = new hggroup (h, p);
776 776 else if (type.compare ("uimenu"))
777 go = new uimenu (h, p);
777 return go; 778 return go;
778 } 779 }
779 780
780 // --------------------------------------------------------------------- 781 // ---------------------------------------------------------------------
781 782
1414 offset = 5; 1415 offset = 5;
1415 else if (len > 6) 1416 else if (len > 6)
1416 { 1417 {
1417 pfx = name.substr (0, 6); 1418 pfx = name.substr (0, 6);
1418 1419
1419 if (pfx.compare ("figure")) 1420 if (pfx.compare ("figure") || pfx.compare ("uimenu"))
1420 offset = 6; 1421 offset = 6;
1421 else if (len > 7) 1422 else if (len > 7)
1422 { 1423 {
1423 pfx = name.substr (0, 7); 1424 pfx = name.substr (0, 7);
1424 1425
1452 has_property = figure::properties::has_core_property (pname); 1453 has_property = figure::properties::has_core_property (pname);
1453 else if (pfx == "surface") 1454 else if (pfx == "surface")
1454 has_property = surface::properties::has_core_property (pname); 1455 has_property = surface::properties::has_core_property (pname);
1455 else if (pfx == "hggroup") 1456 else if (pfx == "hggroup")
1456 has_property = hggroup::properties::has_core_property (pname); 1457 has_property = hggroup::properties::has_core_property (pname);
1458 else if (pfx == "uimenu")
1459 has_property = uimenu::properties::has_core_property (pname);
1457 1460
1458 if (has_property) 1461 if (has_property)
1459 { 1462 {
1460 bool remove = false; 1463 bool remove = false;
1461 if (val.is_string ()) 1464 if (val.is_string ())
1510 offset = 5; 1513 offset = 5;
1511 else if (len > 6) 1514 else if (len > 6)
1512 { 1515 {
1513 pfx = name.substr (0, 6); 1516 pfx = name.substr (0, 6);
1514 1517
1515 if (pfx.compare ("figure")) 1518 if (pfx.compare ("figure") || pfx.compare ("uimenu"))
1516 offset = 6; 1519 offset = 6;
1517 else if (len > 7) 1520 else if (len > 7)
1518 { 1521 {
1519 pfx = name.substr (0, 7); 1522 pfx = name.substr (0, 7);
1520 1523
5454 plist_map["text"] = text::properties::factory_defaults (); 5457 plist_map["text"] = text::properties::factory_defaults ();
5455 plist_map["image"] = image::properties::factory_defaults (); 5458 plist_map["image"] = image::properties::factory_defaults ();
5456 plist_map["patch"] = patch::properties::factory_defaults (); 5459 plist_map["patch"] = patch::properties::factory_defaults ();
5457 plist_map["surface"] = surface::properties::factory_defaults (); 5460 plist_map["surface"] = surface::properties::factory_defaults ();
5458 plist_map["hggroup"] = hggroup::properties::factory_defaults (); 5461 plist_map["hggroup"] = hggroup::properties::factory_defaults ();
5462 plist_map["uimenu"] = uimenu::properties::factory_defaults ();
5459 5463
5460 return plist_map; 5464 return plist_map;
5461 } 5465 }
5462 5466
5463 // --------------------------------------------------------------------- 5467 // ---------------------------------------------------------------------
6023 @deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\ 6027 @deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\
6024 Undocumented internal function.\n\ 6028 Undocumented internal function.\n\
6025 @end deftypefn") 6029 @end deftypefn")
6026 { 6030 {
6027 GO_BODY (hggroup); 6031 GO_BODY (hggroup);
6032 }
6033
6034 DEFUN (__go_uimenu__, args, ,
6035 "-*- texinfo -*-\n\
6036 @deftypefn {Built-in Function} {} __go_uimenu__ (@var{parent})\n\
6037 Undocumented internal function.\n\
6038 @end deftypefn")
6039 {
6040 GO_BODY (uimenu);
6028 } 6041 }
6029 6042
6030 DEFUN (__go_delete__, args, , 6043 DEFUN (__go_delete__, args, ,
6031 "-*- texinfo -*-\n\ 6044 "-*- texinfo -*-\n\
6032 @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ 6045 @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\