comparison src/graphics.h.in @ 8058:ca39c21fa4b8

[mq]: generic_octave_to_backend_nofitication
author John W. Eaton <jwe@octave.org>
date Tue, 26 Aug 2008 13:23:27 -0400
parents 961d4c52ffae
children 75c99d3f97d7
comparison
equal deleted inserted replaced
8057:7670cd296687 8058:ca39c21fa4b8
370 370
371 bool is_hidden (void) const { return hidden; } 371 bool is_hidden (void) const { return hidden; }
372 372
373 void set_hidden (bool flag) { hidden = flag; } 373 void set_hidden (bool flag) { hidden = flag; }
374 374
375 void set (const octave_value& v, bool do_run = true) 375 // Sets property value, notifies backend.
376 { 376 // If do_run is true, runs associated listeners.
377 do_set (v); 377 void set (const octave_value& v, bool do_run = true);
378 378
379 if (do_run && ! error_state)
380 run_listeners (POSTSET);
381 }
382
383 virtual octave_value get (void) const 379 virtual octave_value get (void) const
384 { 380 {
385 error ("get: invalid property \"%s\"", name.c_str ()); 381 error ("get: invalid property \"%s\"", name.c_str ());
386 return octave_value (); 382 return octave_value ();
387 } 383 }
1349 } 1345 }
1350 1346
1351 virtual void set_figure_position (const graphics_handle&, const Matrix&) const 1347 virtual void set_figure_position (const graphics_handle&, const Matrix&) const
1352 { gripe_invalid ("set_figure_position"); } 1348 { gripe_invalid ("set_figure_position"); }
1353 1349
1350 // Called when graphics object using this backend changes it's property.
1351 virtual void property_changed (const graphics_handle&, const std::string&)
1352 { gripe_invalid ("property_changed"); }
1353
1354 // Called when new object using this backend is created.
1355 virtual void object_created (const graphics_handle&)
1356 { gripe_invalid ("object_created"); }
1357
1358 // Called when object using this backend is destroyed.
1359 virtual void object_destroyed (const graphics_handle&)
1360 { gripe_invalid ("object_destroyed"); }
1361
1354 private: 1362 private:
1355 std::string name; 1363 std::string name;
1356 int count; 1364 int count;
1357 1365
1358 private: 1366 private:
1428 Matrix get_screen_size (void) const 1436 Matrix get_screen_size (void) const
1429 { return rep->get_screen_size (); } 1437 { return rep->get_screen_size (); }
1430 1438
1431 void set_figure_position (const graphics_handle& h, const Matrix& pos) const 1439 void set_figure_position (const graphics_handle& h, const Matrix& pos) const
1432 { rep->set_figure_position (h, pos); } 1440 { rep->set_figure_position (h, pos); }
1433 1441
1442 // Notifies backend that object't property has changed.
1443 void property_changed (const graphics_handle& h, const std::string& prop)
1444 { rep->property_changed (h, prop); }
1445
1446 // Notifies backend that new object was created.
1447 void object_created (const graphics_handle& h)
1448 { rep->object_created (h); }
1449
1450 // Notifies backend that object was destroyed.
1451 // This is called only for explicitly deleted object. Children are
1452 // deleted implicitly and backend isn't notified.
1453 void object_destroyed (const graphics_handle& h)
1454 { rep->object_destroyed (h); }
1455
1434 OCTINTERP_API static graphics_backend default_backend (void); 1456 OCTINTERP_API static graphics_backend default_backend (void);
1435 1457
1436 static void register_backend (const graphics_backend& b) 1458 static void register_backend (const graphics_backend& b)
1437 { available_backends[b.get_name ()] = b; } 1459 { available_backends[b.get_name ()] = b; }
1438 1460