The Gnome Chemistry Utils 0.13.3
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * GChemPaint library 00005 * brackets.h 00006 * 00007 * Copyright (C) 2010-2011 Jean Bréfort <jean.brefort@normalesup.org> 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License as 00011 * published by the Free Software Foundation; either version 2 of the 00012 * License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00022 * USA 00023 */ 00024 00025 #ifndef GCHEMPAINT_BRACKETS_H 00026 #define GCHEMPAINT_BRACKETS_H 00027 00028 #include <gcu/object.h> 00029 #include <gccv/item-client.h> 00030 #include <gccv/brackets.h> 00031 #include <set> 00032 00034 namespace gcp { 00035 00036 extern gcu::TypeId BracketsType; 00037 00038 typedef enum { 00039 BracketContentInvalid, 00040 BracketContentFragment, 00041 BracketContentMolecule, 00042 BracketContentGroup 00043 } BracketContent; 00044 00045 typedef enum { 00046 BracketSubscript = 1, 00047 BracketSuperscript = 2 00048 } BracketsDecorations; 00049 00052 class Brackets: public gcu::Object, public gccv::ItemClient 00053 { 00054 public: 00058 Brackets (gccv::BracketsTypes type = gccv::BracketsTypeNormal); 00062 virtual ~Brackets(); 00063 00064 00068 void AddItem (); 00069 00077 bool Load (xmlNodePtr node); 00083 xmlNodePtr Save (xmlDocPtr xml) const; 00091 void SetSelected (int state); 00095 void OnLoaded (); 00096 00103 void OnUnlink (Object *object); 00104 00105 void SetEmbeddedObjects (std::set < gcu::Object * > objects); 00106 std::set < gcu::Object * > const &GetEmbeddedObjects () {return m_EmbeddedObjects;} 00107 static bool ConnectedAtoms (std::set < gcu::Object * > const &objects); 00108 00109 private: 00110 std::set < gcu::Object * > m_EmbeddedObjects; 00111 bool m_Valid; 00112 BracketContent m_Content; 00113 00114 GCU_PROP (gccv::BracketsTypes, Type) 00115 GCU_PROP (gccv::BracketsUses, Used) 00116 GCU_RO_PROP (unsigned, Decorations) 00117 GCU_PROP (std::string, FontDesc) 00118 }; 00119 00120 } // namespace gcp 00121 00122 #endif //GCHEMPAINT_BRACKETS_H