[773] | 1 | // |
---|
| 2 | // "$Id: MultiImage.h 4303 2005-05-01 03:33:52Z spitzak $" |
---|
| 3 | // |
---|
| 4 | // Image type that draws a different image depending on the flags, |
---|
| 5 | // for instace VALUE or SELECTED or HIGHLIGHT. |
---|
| 6 | // |
---|
| 7 | // Copyright 1998-2003 by Bill Spitzak and others. |
---|
| 8 | // |
---|
| 9 | // This library is free software; you can redistribute it and/or |
---|
| 10 | // modify it under the terms of the GNU Library General Public |
---|
| 11 | // License as published by the Free Software Foundation; either |
---|
| 12 | // version 2 of the License, or (at your option) any later version. |
---|
| 13 | // |
---|
| 14 | // This library is distributed in the hope that it will be useful, |
---|
| 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | // Library General Public License for more details. |
---|
| 18 | // |
---|
| 19 | // You should have received a copy of the GNU Library General Public |
---|
| 20 | // License along with this library; if not, write to the Free Software |
---|
| 21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 22 | // USA. |
---|
| 23 | // |
---|
| 24 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
| 25 | // |
---|
| 26 | |
---|
| 27 | #ifndef fltk_MultiImage_h |
---|
| 28 | #define fltk_MultiImage_h |
---|
| 29 | |
---|
| 30 | #include "Symbol.h" |
---|
| 31 | |
---|
| 32 | namespace fltk { |
---|
| 33 | |
---|
| 34 | class FL_API MultiImage : public Symbol |
---|
| 35 | { |
---|
| 36 | enum {MAXIMAGES = 8}; |
---|
| 37 | Symbol* images[MAXIMAGES]; |
---|
| 38 | Flags flags[MAXIMAGES]; |
---|
| 39 | public: |
---|
| 40 | void _measure(int&, int&) const; |
---|
| 41 | void _draw(const Rectangle&) const; |
---|
| 42 | void inset(Rectangle&) const; |
---|
| 43 | bool fills_rectangle() const; |
---|
| 44 | bool is_frame() const; |
---|
| 45 | |
---|
| 46 | MultiImage(Symbol& image0, |
---|
| 47 | Flags flags1, Symbol& image1) { |
---|
| 48 | images[0] = &image0; |
---|
| 49 | flags[1] = flags1; images[1] = &image1; |
---|
| 50 | images[2] = 0; |
---|
| 51 | } |
---|
| 52 | MultiImage(Symbol& image0, |
---|
| 53 | Flags flags1, Symbol& image1, |
---|
| 54 | Flags flags2, Symbol& image2) { |
---|
| 55 | images[0] = &image0; |
---|
| 56 | flags[1] = flags1; images[1] = &image1; |
---|
| 57 | flags[2] = flags2; images[2] = &image2; |
---|
| 58 | images[3] = 0; |
---|
| 59 | } |
---|
| 60 | MultiImage(Symbol& image0, |
---|
| 61 | Flags flags1, Symbol& image1, |
---|
| 62 | Flags flags2, Symbol& image2, |
---|
| 63 | Flags flags3, Symbol& image3) { |
---|
| 64 | images[0] = &image0; |
---|
| 65 | flags[1] = flags1; images[1] = &image1; |
---|
| 66 | flags[2] = flags2; images[2] = &image2; |
---|
| 67 | flags[3] = flags3; images[3] = &image3; |
---|
| 68 | images[4] = 0; |
---|
| 69 | } |
---|
| 70 | MultiImage(Symbol& image0, |
---|
| 71 | Flags flags1, Symbol& image1, |
---|
| 72 | Flags flags2, Symbol& image2, |
---|
| 73 | Flags flags3, Symbol& image3, |
---|
| 74 | Flags flags4, Symbol& image4) { |
---|
| 75 | images[0] = &image0; |
---|
| 76 | flags[1] = flags1; images[1] = &image1; |
---|
| 77 | flags[2] = flags2; images[2] = &image2; |
---|
| 78 | flags[3] = flags3; images[3] = &image3; |
---|
| 79 | flags[4] = flags4; images[4] = &image4; |
---|
| 80 | images[5] = 0; |
---|
| 81 | } |
---|
| 82 | MultiImage(Symbol& image0, |
---|
| 83 | Flags flags1, Symbol& image1, |
---|
| 84 | Flags flags2, Symbol& image2, |
---|
| 85 | Flags flags3, Symbol& image3, |
---|
| 86 | Flags flags4, Symbol& image4, |
---|
| 87 | Flags flags5, Symbol& image5) { |
---|
| 88 | images[0] = &image0; |
---|
| 89 | flags[1] = flags1; images[1] = &image1; |
---|
| 90 | flags[2] = flags2; images[2] = &image2; |
---|
| 91 | flags[3] = flags3; images[3] = &image3; |
---|
| 92 | flags[4] = flags4; images[4] = &image4; |
---|
| 93 | flags[5] = flags5; images[5] = &image5; |
---|
| 94 | images[6] = 0; |
---|
| 95 | } |
---|
| 96 | MultiImage(Symbol& image0, |
---|
| 97 | Flags flags1, Symbol& image1, |
---|
| 98 | Flags flags2, Symbol& image2, |
---|
| 99 | Flags flags3, Symbol& image3, |
---|
| 100 | Flags flags4, Symbol& image4, |
---|
| 101 | Flags flags5, Symbol& image5, |
---|
| 102 | Flags flags6, Symbol& image6) { |
---|
| 103 | images[0] = &image0; |
---|
| 104 | flags[1] = flags1; images[1] = &image1; |
---|
| 105 | flags[2] = flags2; images[2] = &image2; |
---|
| 106 | flags[3] = flags3; images[3] = &image3; |
---|
| 107 | flags[4] = flags4; images[4] = &image4; |
---|
| 108 | flags[5] = flags5; images[5] = &image5; |
---|
| 109 | flags[6] = flags6; images[6] = &image6; |
---|
| 110 | images[7] = 0; |
---|
| 111 | } |
---|
| 112 | MultiImage(Symbol& image0, |
---|
| 113 | Flags flags1, Symbol& image1, |
---|
| 114 | Flags flags2, Symbol& image2, |
---|
| 115 | Flags flags3, Symbol& image3, |
---|
| 116 | Flags flags4, Symbol& image4, |
---|
| 117 | Flags flags5, Symbol& image5, |
---|
| 118 | Flags flags6, Symbol& image6, |
---|
| 119 | Flags flags7, Symbol& image7) { |
---|
| 120 | images[0] = &image0; |
---|
| 121 | flags[1] = flags1; images[1] = &image1; |
---|
| 122 | flags[2] = flags2; images[2] = &image2; |
---|
| 123 | flags[3] = flags3; images[3] = &image3; |
---|
| 124 | flags[4] = flags4; images[4] = &image4; |
---|
| 125 | flags[5] = flags5; images[5] = &image5; |
---|
| 126 | flags[6] = flags6; images[6] = &image6; |
---|
| 127 | flags[7] = flags7; images[7] = &image7; |
---|
| 128 | } |
---|
| 129 | }; |
---|
| 130 | |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | #endif |
---|
| 134 | |
---|
| 135 | // |
---|
| 136 | // End of "$Id: MultiImage.h 4303 2005-05-01 03:33:52Z spitzak $". |
---|
| 137 | // |
---|