OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2011 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 {
41 } ColorBit;
42 
43 typedef unsigned char ColorMask;
44 
46 public:
47  ColorOp();
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);
64  virtual mol::QueryFlags GetSelectionFlags() const;
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;
71  static gfx::ColorOp FromInfo(info::InfoGroup& group);
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