1 | // |
---|
2 | // "$Id: LabelType.h 4303 2005-05-01 03:33:52Z spitzak $" |
---|
3 | // |
---|
4 | // A LabelType determines how to draw the text of the label. This |
---|
5 | // is not used very much, it can be used to draw engraved or shadowed |
---|
6 | // labels. You could also put in code that interprets the text of |
---|
7 | // the label and draws anything you want with it. |
---|
8 | // |
---|
9 | // Copyright 1998-2003 by Bill Spitzak and others. |
---|
10 | // |
---|
11 | // This library is free software; you can redistribute it and/or |
---|
12 | // modify it under the terms of the GNU Library General Public |
---|
13 | // License as published by the Free Software Foundation; either |
---|
14 | // version 2 of the License, or (at your option) any later version. |
---|
15 | // |
---|
16 | // This library is distributed in the hope that it will be useful, |
---|
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | // Library General Public License for more details. |
---|
20 | // |
---|
21 | // You should have received a copy of the GNU Library General Public |
---|
22 | // License along with this library; if not, write to the Free Software |
---|
23 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
24 | // USA. |
---|
25 | // |
---|
26 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
27 | // |
---|
28 | |
---|
29 | #ifndef fltk_LabelType_h |
---|
30 | #define fltk_LabelType_h |
---|
31 | |
---|
32 | #include "Flags.h" |
---|
33 | #include "Rectangle.h" |
---|
34 | |
---|
35 | namespace fltk { |
---|
36 | |
---|
37 | class Style; |
---|
38 | |
---|
39 | class FL_API LabelType { |
---|
40 | public: |
---|
41 | virtual void draw(const char*, const Rectangle&, Flags) const; |
---|
42 | const char* name; |
---|
43 | LabelType* next; |
---|
44 | static LabelType* first; |
---|
45 | LabelType(const char* n) : name(n), next(first) {first = this;} |
---|
46 | static LabelType* find(const char* name); |
---|
47 | // virtual ~LabelType() {} // not done as it slows program exit |
---|
48 | }; |
---|
49 | |
---|
50 | // You can use this to draw overlapping patterns |
---|
51 | class FL_API EngravedLabel : public LabelType { |
---|
52 | const int* data; |
---|
53 | public: |
---|
54 | void draw(const char*, const Rectangle&, Flags) const; |
---|
55 | EngravedLabel(const char * n, const int p[][3]) |
---|
56 | : LabelType(n), data((const int*)p) {} |
---|
57 | }; |
---|
58 | |
---|
59 | } |
---|
60 | |
---|
61 | #endif |
---|