comparison src/graphics.h.in @ 7865:b74039822fd2

Add support for hggroup
author Michael Goffioul <michael.goffioul@gmail.com>
date Fri, 25 Apr 2008 16:44:59 +0200
parents 56f781f38f0b
children e6d5532f760e
comparison
equal deleted inserted replaced
7864:56f781f38f0b 7865:b74039822fd2
1589 virtual void adopt (const graphics_handle& h) 1589 virtual void adopt (const graphics_handle& h)
1590 { 1590 {
1591 octave_idx_type n = children.numel (); 1591 octave_idx_type n = children.numel ();
1592 children.resize (1, n+1); 1592 children.resize (1, n+1);
1593 children(n) = h.value (); 1593 children(n) = h.value ();
1594 mark_modified ();
1594 } 1595 }
1595 1596
1596 virtual graphics_backend get_backend (void) const; 1597 virtual graphics_backend get_backend (void) const;
1597 1598
1598 virtual Matrix get_boundingbox (bool /*internal*/ = false) const 1599 virtual Matrix get_boundingbox (bool /*internal*/ = false) const
3391 const base_properties& get_properties (void) const { return xproperties; } 3392 const base_properties& get_properties (void) const { return xproperties; }
3392 3393
3393 bool valid_object (void) const { return true; } 3394 bool valid_object (void) const { return true; }
3394 }; 3395 };
3395 3396
3397 // ---------------------------------------------------------------------
3398
3399 class OCTINTERP_API hggroup : public base_graphics_object
3400 {
3401 public:
3402 class OCTINTERP_API properties : public base_properties
3403 {
3404 public:
3405 void remove_child (const graphics_handle& h)
3406 {
3407 base_properties::remove_child (h);
3408 update_limits ();
3409 }
3410
3411 void adopt (const graphics_handle& h)
3412 {
3413 base_properties::adopt (h);
3414 update_limits ();
3415 }
3416
3417 // See the genprops.awk script for an explanation of the
3418 // properties declarations.
3419
3420 BEGIN_PROPERTIES(hggroup)
3421 // hidden properties for limit computation
3422 row_vector_property xlim hr , Matrix()
3423 row_vector_property ylim hr , Matrix()
3424 row_vector_property zlim hr , Matrix()
3425 row_vector_property clim hr , Matrix()
3426 row_vector_property alim hr , Matrix()
3427 bool_property xliminclude h , "on"
3428 bool_property yliminclude h , "on"
3429 bool_property zliminclude h , "on"
3430 bool_property climinclude h , "on"
3431 bool_property aliminclude h , "on"
3432 END_PROPERTIES
3433
3434 private:
3435 void update_limits (void)
3436 {
3437 update_axis_limits ("xlim");
3438 update_axis_limits ("ylim");
3439 update_axis_limits ("zlim");
3440 update_axis_limits ("clim");
3441 update_axis_limits ("alim");
3442 }
3443
3444 protected:
3445 void init (void)
3446 { }
3447 };
3448
3449 private:
3450 properties xproperties;
3451
3452 public:
3453 hggroup (const graphics_handle& mh, const graphics_handle& p)
3454 : base_graphics_object (), xproperties (mh, p)
3455 {
3456 xproperties.override_defaults (*this);
3457 }
3458
3459 ~hggroup (void) { xproperties.delete_children (); }
3460
3461 base_properties& get_properties (void) { return xproperties; }
3462
3463 const base_properties& get_properties (void) const { return xproperties; }
3464
3465 bool valid_object (void) const { return true; }
3466
3467 void update_axis_limits (const std::string& axis_type);
3468 };
3469
3470 // ---------------------------------------------------------------------
3471
3396 octave_value 3472 octave_value
3397 get_property_from_handle (double handle, const std::string &property, 3473 get_property_from_handle (double handle, const std::string &property,
3398 const std::string &func); 3474 const std::string &func);
3399 bool 3475 bool
3400 set_property_in_handle (double handle, const std::string &property, 3476 set_property_in_handle (double handle, const std::string &property,