~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/sdk/wxscintilla/src/scintilla/src/XPM.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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;      ///< 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.
 
57
public:
 
58
        XPMSet();
 
59
        ~XPMSet();
 
60
        /// Remove all XPMs.
 
61
        void Clear();
 
62
        /// Add a XPM.
 
63
        void Add(int id, const char *textForm);
 
64
        /// Get XPM by id.
 
65
        XPM *Get(int id);
 
66
        /// Give the largest height of the set.
 
67
        int GetHeight();
 
68
        /// Give the largest width of the set.
 
69
        int GetWidth();
 
70
};
 
71
 
 
72
#endif