scintilla: Update scintilla with changeset 3662:1d1c06df8a2f using gtk+3
[anjuta-extras.git] / plugins / scintilla / scintilla / XPM.h
blobcb05aae3e2c4889deed0c25afdf87daa83d90b46
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.
8 #ifndef XPM_H
9 #define XPM_H
11 #ifdef SCI_NAMESPACE
12 namespace Scintilla {
13 #endif
15 /**
16 * Hold a pixmap in XPM format.
18 class XPM {
19 int pid; // Assigned by container
20 int height;
21 int width;
22 int nColours;
23 char *data;
24 char codeTransparent;
25 char *codes;
26 ColourPair *colours;
27 ColourAllocated ColourFromCode(int ch) const;
28 void FillRun(Surface *surface, int code, int startX, int y, int x);
29 char **lines;
30 ColourPair *colourCodeTable[256];
31 public:
32 XPM(const char *textForm);
33 XPM(const char *const *linesForm);
34 ~XPM();
35 void Init(const char *textForm);
36 void Init(const char *const *linesForm);
37 void Clear();
38 /// Similar to same named method in ViewStyle:
39 void RefreshColourPalette(Palette &pal, bool want);
40 /// No palette used, so just copy the desired colours to the allocated colours
41 void CopyDesiredColours();
42 /// Decompose image into runs and use FillRectangle for each run
43 void Draw(Surface *surface, PRectangle &rc);
44 char **InLinesForm() { return lines; }
45 void SetId(int pid_) { pid = pid_; }
46 int GetId() const { return pid; }
47 int GetHeight() const { return height; }
48 int GetWidth() const { return width; }
49 static const char **LinesFormFromTextForm(const char *textForm);
52 /**
53 * A collection of pixmaps indexed by integer id.
55 class XPMSet {
56 XPM **set; ///< The stored XPMs.
57 int len; ///< Current number of XPMs.
58 int maximum; ///< Current maximum number of XPMs, increased by steps if reached.
59 int height; ///< Memorize largest height of the set.
60 int width; ///< Memorize largest width of the set.
61 public:
62 XPMSet();
63 ~XPMSet();
64 /// Remove all XPMs.
65 void Clear();
66 /// Add a XPM.
67 void Add(int id, const char *textForm);
68 /// Get XPM by id.
69 XPM *Get(int id);
70 /// Give the largest height of the set.
71 int GetHeight();
72 /// Give the largest width of the set.
73 int GetWidth();
76 #ifdef SCI_NAMESPACE
78 #endif
80 #endif