]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/stc/scintilla/src/XPM.h
948e557a924c7c243dfbebf1b11beb76aa66a9b1
[wxWidgets.git] / contrib / src / stc / scintilla / src / XPM.h
1 // Scintilla source code edit control
2 /** @file XPM.h
3 ** Define a class that holds data in the X Pixmap (XPM) format,
4 **/
5 // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
7
8 #ifndef XPM_H
9 #define XPM_H
10
11 /**
12 * Hold a pixmap in XPM format.
13 */
14 class XPM {
15 int id; // Assigned by container
16 int height;
17 int width;
18 int nColours;
19 char *data;
20 char codeTransparent;
21 char *codes;
22 ColourPair *colours;
23 ColourAllocated ColourFromCode(int ch);
24 void FillRun(Surface *surface, int code, int startX, int y, int x);
25 char **lines;
26 ColourPair *colourCodeTable[256];
27 public:
28 XPM(const char *textForm);
29 XPM(const char * const *linesForm);
30 ~XPM();
31 void Init(const char *textForm);
32 void Init(const char * const *linesForm);
33 void Clear();
34 // Similar to same named method in ViewStyle:
35 void RefreshColourPalette(Palette &pal, bool want);
36 // No palette used, so just copy the desired colours to the allocated colours:
37 void CopyDesiredColours();
38 // Decompose image into runs and use FillRectangle for each run:
39 void Draw(Surface *surface, PRectangle &rc);
40 char **InLinesForm() { return lines; }
41 void SetId(int id_) { id = id_; }
42 int GetId() { return id; }
43 int GetHeight() { return height; }
44 int GetWidth() { return width; }
45 static const char **LinesFormFromTextForm(const char *textForm);
46 };
47
48 /**
49 * A collection of pixmaps indexed by integer id.
50 */
51 class XPMSet {
52 XPM **set;
53 int len;
54 int maximum;
55 int height;
56 int width;
57 public:
58 XPMSet();
59 ~XPMSet();
60 void Clear();
61 void Add(int id, const char *textForm);
62 XPM *Get(int id);
63 int GetHeight();
64 int GetWidth();
65 };
66
67 #endif