OpenStructure
color_op.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_COLOR_OPS_COLOR_OP_HH
20 #define OST_COLOR_OPS_COLOR_OP_HH
21 
22 #include <string>
23 
25 
26 #include <ost/gfx/gfx_object_fw.hh>
27 #include <ost/gfx/module_config.hh>
28 
29 #include <ost/info/info.hh>
30 #include <ost/info/info_fw.hh>
31 
32 /*
33  Author: Stefan Scheuber
34 */
35 
36 namespace ost { namespace gfx {
37 
38 typedef enum {
40  MAIN_COLOR = 2
42 
43 typedef unsigned char ColorMask;
44 
46 public:
48  virtual ~ColorOp() {}
49  ColorOp(const String& selection, int mask=DETAIL_COLOR|MAIN_COLOR);
50  ColorOp(const mol::QueryViewWrapper& query_view, int mask=DETAIL_COLOR|MAIN_COLOR);
51  virtual bool CanApplyTo(const GfxObjP& obj) const;
52  virtual void ApplyTo(GfxObjP& obj) const;
53 
54  virtual const String& GetName() const;
55 
56  ColorMask GetMask() const;
57 
58  void SetMask(ColorMask mask);
59 
60  virtual void SetSelection(const String& selection);
61  virtual String GetSelection() const;
62 
63  virtual void SetSelectionFlags(mol::QueryFlags flags);
65 
66  virtual bool IsSelectionOnly() const;
67  virtual void SetView(const mol::EntityView& view);
68  virtual mol::EntityView GetView() const;
69 
70  virtual void ToInfo(info::InfoGroup& group) const;
72 
73 protected:
74  virtual void SetName(const String& name);
75 
76 private:
77  String name_;
78  mol::QueryViewWrapper query_view_;
79  ColorMask mask_;
80 };
81 
82 }}
83 
84 #endif
85 
virtual void SetSelection(const String &selection)
virtual void SetSelectionFlags(mol::QueryFlags flags)
virtual void SetView(const mol::EntityView &view)
virtual ~ColorOp()
Definition: color_op.hh:48
virtual void ApplyTo(GfxObjP &obj) const
virtual void ToInfo(info::InfoGroup &group) const
virtual const String & GetName() const
virtual void SetName(const String &name)
void SetMask(ColorMask mask)
virtual String GetSelection() const
virtual mol::EntityView GetView() const
virtual bool CanApplyTo(const GfxObjP &obj) const
ColorMask GetMask() const
ColorOp(const mol::QueryViewWrapper &query_view, int mask=DETAIL_COLOR|MAIN_COLOR)
virtual bool IsSelectionOnly() const
static gfx::ColorOp FromInfo(info::InfoGroup &group)
ColorOp(const String &selection, int mask=DETAIL_COLOR|MAIN_COLOR)
virtual mol::QueryFlags GetSelectionFlags() const
definition of EntityView
Definition: entity_view.hh:86
#define DLLEXPORT_OST_GFX
std::string String
Definition: base.hh:54
unsigned char ColorMask
Definition: color_op.hh:43
@ MAIN_COLOR
Definition: color_op.hh:40
@ DETAIL_COLOR
Definition: color_op.hh:39
boost::shared_ptr< GfxObj > GfxObjP
uint QueryFlags
Definition: query.hh:69
Definition: base.dox:1