]> git.saurik.com Git - wxWidgets.git/blame - src/stc/scintilla/src/XPM.h
matrix and path to ref counting
[wxWidgets.git] / src / stc / scintilla / src / XPM.h
CommitLineData
9e730a78
RD
1// Scintilla source code edit control
2/** @file XPM.h
8e54aaed 3 ** Define a class that holds data in the X Pixmap (XPM) format.
9e730a78
RD
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 */
14class 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];
27public:
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();
8e54aaed 34 /// Similar to same named method in ViewStyle:
9e730a78 35 void RefreshColourPalette(Palette &pal, bool want);
8e54aaed 36 /// No palette used, so just copy the desired colours to the allocated colours
9e730a78 37 void CopyDesiredColours();
8e54aaed 38 /// Decompose image into runs and use FillRectangle for each run
9e730a78
RD
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 */
51class XPMSet {
8e54aaed
RD
52 XPM **set; ///< The stored XPMs.
53 int len; ///< Current number of XPMs.
54 int maximum; ///< Current maximum number of XPMs, increased by steps if reached.
55 int height; ///< Memorize largest height of the set.
56 int width; ///< Memorize largest width of the set.
9e730a78
RD
57public:
58 XPMSet();
59 ~XPMSet();
8e54aaed 60 /// Remove all XPMs.
9e730a78 61 void Clear();
8e54aaed 62 /// Add a XPM.
9e730a78 63 void Add(int id, const char *textForm);
8e54aaed 64 /// Get XPM by id.
9e730a78 65 XPM *Get(int id);
8e54aaed 66 /// Give the largest height of the set.
9e730a78 67 int GetHeight();
8e54aaed 68 /// Give the largest width of the set.
9e730a78
RD
69 int GetWidth();
70};
71
72#endif