2011-07-06 20:37:13 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2011 Paul Davis
|
|
|
|
|
|
|
|
This program 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 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program 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 this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __gtk_ardour_gui_object_h__
|
|
|
|
#define __gtk_ardour_gui_object_h__
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <boost/variant.hpp>
|
|
|
|
|
|
|
|
#include "pbd/xml++.h"
|
|
|
|
#include "pbd/id.h"
|
|
|
|
|
2012-01-20 13:02:43 -05:00
|
|
|
class GUIObjectState
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GUIObjectState ();
|
2012-03-06 21:08:46 -05:00
|
|
|
|
2011-07-06 20:37:13 -04:00
|
|
|
XMLNode& get_state () const;
|
|
|
|
int set_state (const XMLNode&);
|
|
|
|
|
|
|
|
static const std::string xml_node_name;
|
|
|
|
void load (const XMLNode&);
|
|
|
|
|
2011-07-11 16:32:33 -04:00
|
|
|
std::string get_string (const std::string& id, const std::string& prop_name, bool* empty = 0);
|
2011-07-06 20:37:13 -04:00
|
|
|
|
2012-05-23 22:54:10 -04:00
|
|
|
template<typename T> void set_property (const std::string& id, const std::string& prop_name, const T& val) {
|
2012-01-20 13:02:48 -05:00
|
|
|
XMLNode* child = get_or_add_node (id);
|
2012-01-20 13:02:43 -05:00
|
|
|
std::stringstream s;
|
|
|
|
s << val;
|
|
|
|
child->add_property (prop_name.c_str(), s.str());
|
2011-07-06 20:37:13 -04:00
|
|
|
}
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2012-01-20 13:02:43 -05:00
|
|
|
std::list<std::string> all_ids () const;
|
2012-01-20 13:02:48 -05:00
|
|
|
|
|
|
|
static XMLNode* get_node (const XMLNode *, const std::string &);
|
|
|
|
XMLNode* get_or_add_node (const std::string &);
|
|
|
|
static XMLNode* get_or_add_node (XMLNode *, const std::string &);
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2015-03-30 15:27:18 -04:00
|
|
|
void remove_node (const std::string& id);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-07-11 16:32:33 -04:00
|
|
|
private:
|
2012-01-20 13:02:43 -05:00
|
|
|
XMLNode _state;
|
2011-07-06 20:37:13 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __gtk_ardour_gui_object_h__ */
|