00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_COLOR_OPS_COLOR_OP_HH 00020 #define OST_COLOR_OPS_COLOR_OP_HH 00021 00022 #include <string> 00023 00024 #include <ost/mol/query_view_wrapper.hh> 00025 00026 #include <ost/gfx/gfx_object_fw.hh> 00027 #include <ost/gfx/module_config.hh> 00028 00029 #include <ost/info/info.hh> 00030 #include <ost/info/info_fw.hh> 00031 00032 /* 00033 Author: Stefan Scheuber 00034 */ 00035 00036 namespace ost { namespace gfx { 00037 00038 typedef enum { 00039 DETAIL_COLOR = 1, 00040 MAIN_COLOR = 2 00041 } ColorBit; 00042 00043 typedef unsigned char ColorMask; 00044 00045 class DLLEXPORT_OST_GFX ColorOp { 00046 public: 00047 ColorOp(); 00048 virtual ~ColorOp() {} 00049 ColorOp(const String& selection, int mask=DETAIL_COLOR|MAIN_COLOR); 00050 ColorOp(const mol::QueryViewWrapper& query_view, int mask=DETAIL_COLOR|MAIN_COLOR); 00051 virtual bool CanApplyTo(const GfxObjP& obj) const; 00052 virtual void ApplyTo(GfxObjP& obj) const; 00053 00054 virtual const String& GetName() const; 00055 00056 ColorMask GetMask() const; 00057 00058 void SetMask(ColorMask mask); 00059 00060 virtual void SetSelection(const String& selection); 00061 virtual String GetSelection() const; 00062 00063 virtual void SetSelectionFlags(mol::QueryFlags flags); 00064 virtual mol::QueryFlags GetSelectionFlags() const; 00065 00066 virtual bool IsSelectionOnly() const; 00067 virtual void SetView(const mol::EntityView& view); 00068 virtual mol::EntityView GetView() const; 00069 00070 virtual void ToInfo(info::InfoGroup& group) const; 00071 static gfx::ColorOp FromInfo(info::InfoGroup& group); 00072 00073 protected: 00074 virtual void SetName(const String& name); 00075 00076 private: 00077 String name_; 00078 mol::QueryViewWrapper query_view_; 00079 ColorMask mask_; 00080 }; 00081 00082 }} 00083 00084 #endif 00085