1 /*
2  * legend_tile.h -- ePiX screen implemenation for legends
3  *
4  * This file is part of ePiX, a C++ library for creating high-quality
5  * figures in LaTeX
6  *
7  * Version 1.2.1
8  * Last Change: September 28, 2007
9  *
10  *
11  * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
12  * Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
13  * Department of Mathematics and Computer Science
14  * College of the Holy Cross
15  * Worcester, MA, 01610-2395, USA
16  *
17  *
18  * ePiX is free software; you can redistribute it and/or modify it
19  * under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * (at your option) any later version.
22  *
23  * ePiX is distributed in the hope that it will be useful, but WITHOUT
24  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
26  * License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with ePiX; if not, write to the Free Software Foundation, Inc.,
30  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31  */
32 
33 #ifndef EPIX_LEGEND_TILE
34 #define EPIX_LEGEND_TILE
35 #include <string>
36 
37 #include "enums.h"
38 
39 #include "pairs.h"
40 #include "length.h"
41 #include "Color.h"
42 
43 #include "label_style.h"
44 #include "pen_data.h"
45 
46 #include "tile.h"
47 
48 namespace ePiX {
49 
50   class format;
51   class legend_item;
52   class affine;
53   class screen_mask;
54 
55   class legend_tile : public tile {
56   public:
57     legend_tile(const pair& here, const pair& offset,
58 		epix_label_posn align, const label_state& style,
59 		const pen_data& item_border, double key_size, double skip,
60 		std::list<legend_item*> items);
61 
62     legend_tile(const legend_tile&);
63     legend_tile& operator= (const legend_tile&);
64     ~legend_tile();
65 
66     legend_tile& map_by(const affine&);
67     legend_tile& crop_to(const screen_mask&);
68 
69     legend_tile* clone() const;
70 
71     bool is_empty() const;
72 
73     std::string print_to(const format&, const std::string&) const;
74     void add_to_palette() const;
75 
76   private:
77     pair m_here;
78     pair m_offset;
79 
80     epix_label_posn m_align;
81 
82     label_state m_style;
83 
84     pen_data m_item_border;
85 
86     double m_key_size;   // dims of key boxes in pt
87     double m_label_skip; // \hskip between box and item value
88 
89     std::list<legend_item*> m_items;
90   }; // end of class legend_tile
91 
92 } // end of namespace
93 
94 #endif /* EPIX_LEGEND_TILE */
95