The Gnome Chemistry Utils
0.13.7
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * GChemPaint library 00005 * brackets.h 00006 * 00007 * Copyright (C) 2010-2012 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 3 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 00044 typedef enum { 00048 BracketContentInvalid, 00052 BracketContentFragment, 00056 BracketContentMolecule, 00060 BracketContentGroup 00061 } BracketContent; 00062 00069 typedef enum { 00073 BracketDecorationNone = 0, 00077 BracketSubscript = 1, 00081 BracketSuperscript = 2 00082 } BracketsDecorations; 00083 00090 class Brackets: public gcu::Object, public gccv::ItemClient 00091 { 00092 public: 00098 Brackets (gccv::BracketsTypes type = gccv::BracketsTypeNormal); 00102 virtual ~Brackets(); 00103 00104 00108 void AddItem (); 00109 00117 bool Load (xmlNodePtr node); 00123 xmlNodePtr Save (xmlDocPtr xml) const; 00131 void SetSelected (int state); 00135 void OnLoaded (); 00136 00143 void OnUnlink (Object *object); 00152 bool BuildContextualMenu (gcu::UIManager *UIManager, Object *object, double x, double y); 00153 00159 void SetEmbeddedObjects (std::set < gcu::Object * > objects); 00160 00164 std::set < gcu::Object * > const &GetEmbeddedObjects () {return m_EmbeddedObjects;} 00165 00171 static bool ConnectedAtoms (std::set < gcu::Object * > const &objects); 00172 00173 private: 00174 std::set < gcu::Object * > m_EmbeddedObjects; 00175 bool m_Valid; 00176 BracketContent m_Content; 00177 00189 GCU_PROP (gccv::BracketsTypes, Type) 00190 00191 00202 GCU_PROP (gccv::BracketsUses, Used) 00203 00208 GCU_RO_PROP (unsigned, Decorations) 00209 00221 GCU_PROP (std::string, FontDesc) 00222 }; 00223 00224 } // namespace gcp 00225 00226 #endif //GCHEMPAINT_BRACKETS_H