~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmithContribItems/wxthings/wxthings/include/wx/things/genergdi.h

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/////////////////////////////////////////////////////////////////////////////
2
 
// Name:        genergdi.h
3
 
// Purpose:     Generic gdi pen and colour
4
 
// Author:      John Labenski
5
 
// Modified by:
6
 
// Created:     12/1/2000
7
 
// Copyright:   (c) John Labenski
8
 
// Licence:     wxWidgets licence
9
 
/////////////////////////////////////////////////////////////////////////////
10
 
 
11
 
#ifndef _WX_GENERGDI_H_
12
 
#define _WX_GENERGDI_H_
13
 
 
14
 
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15
 
    #pragma interface "genergdi.h"
16
 
#endif
17
 
 
18
 
#include "wx/colour.h"
19
 
#include "wx/pen.h"
20
 
#include "wx/brush.h"
21
 
#include "wx/things/thingdef.h"
22
 
 
23
 
class WXDLLIMPEXP_THINGS wxGenericColour;
24
 
class WXDLLIMPEXP_THINGS wxGenericPen;
25
 
class WXDLLIMPEXP_THINGS wxGenericBrush;
26
 
 
27
 
// Uncreated and invalid versions of the generic colour, pen, and brush
28
 
WXDLLIMPEXP_DATA_THINGS(extern const wxGenericColour) wxNullGenericColour;
29
 
WXDLLIMPEXP_DATA_THINGS(extern const wxGenericPen)    wxNullGenericPen;
30
 
WXDLLIMPEXP_DATA_THINGS(extern const wxGenericBrush)  wxNullGenericBrush;
31
 
 
32
 
// Arrays of the generic colours, pens, and brushes
33
 
WX_DECLARE_OBJARRAY_WITH_DECL(wxGenericColour, wxArrayGenericColour, class WXDLLIMPEXP_THINGS);
34
 
WX_DECLARE_OBJARRAY_WITH_DECL(wxGenericPen,    wxArrayGenericPen,    class WXDLLIMPEXP_THINGS);
35
 
WX_DECLARE_OBJARRAY_WITH_DECL(wxGenericBrush,  wxArrayGenericBrush,  class WXDLLIMPEXP_THINGS);
36
 
 
37
 
//----------------------------------------------------------------------------
38
 
// wxGenericColour - a RGBA colour that's converts from and to a wxColour.
39
 
//    You can have thousands of them without using up resources. (on MSW)
40
 
//----------------------------------------------------------------------------
41
 
 
42
 
class WXDLLIMPEXP_THINGS wxGenericColour : public wxObject
43
 
{
44
 
public:
45
 
    wxGenericColour() : wxObject() {}
46
 
    wxGenericColour( const wxGenericColour& c ) { Create(c); }
47
 
    wxGenericColour( const wxColour& c )        { Create(c); }
48
 
    wxGenericColour( unsigned char red,  unsigned char green,
49
 
                     unsigned char blue, unsigned char alpha=255 )
50
 
                : wxObject() { Create(red, green, blue, alpha); }
51
 
    wxGenericColour( unsigned long colABGR ) : wxObject() { CreateABGR(colABGR); }
52
 
 
53
 
    // Implicit conversion from the colour name
54
 
    wxGenericColour( const wxString &colourName ) : wxObject() { Create(colourName); }
55
 
    wxGenericColour( const char *colourName )     : wxObject() { Create(wxString::FromAscii(colourName)); }
56
 
#if wxUSE_UNICODE
57
 
    wxGenericColour( const wxChar *colourName )   : wxObject() { Create(wxString(colourName)); }
58
 
#endif
59
 
 
60
 
    virtual ~wxGenericColour() {}
61
 
    // Destroy the refed data
62
 
    void Destroy() { UnRef(); }
63
 
    // Is this colour valid, has refed data
64
 
    bool Ok() const { return m_refData != NULL; }
65
 
 
66
 
    // -----------------------------------------------------------------------
67
 
    // (re)Create this colour, unrefing this colour first.
68
 
    //    Use these to detach this colour from it's refed copies.
69
 
    void Create( const wxGenericColour& c );
70
 
    void Create( const wxColour& c);
71
 
    void Create( unsigned char red = 0, unsigned char green = 0,
72
 
                 unsigned char blue = 0, unsigned char alpha=255 );
73
 
    void CreateABGR( unsigned long colABGR );
74
 
    void CreateARGB( unsigned long colARGB );
75
 
    void Create( const wxString& colourName );
76
 
 
77
 
    // -----------------------------------------------------------------------
78
 
    // Set the colour values of the refed data.
79
 
    //   Use these to adjust the values of all the refed copies.
80
 
    void Set( const wxGenericColour &c );
81
 
    void Set( const wxColour& c );
82
 
    void Set( unsigned char red,  unsigned char green,
83
 
              unsigned char blue, unsigned char alpha=255 );
84
 
    void SetABGR( unsigned long colABGR );
85
 
    void SetARGB( unsigned long colARGB );
86
 
    void Set( const wxString& colourName );
87
 
 
88
 
    void SetRed  ( unsigned char r );
89
 
    void SetGreen( unsigned char g );
90
 
    void SetBlue ( unsigned char b );
91
 
    void SetAlpha( unsigned char a );
92
 
 
93
 
    // -----------------------------------------------------------------------
94
 
    // Get the colour values
95
 
    inline wxColour GetColour() const { return wxColour(GetRed(), GetGreen(), GetBlue()); }
96
 
 
97
 
    unsigned char GetRed() const;
98
 
    unsigned char GetGreen() const;
99
 
    unsigned char GetBlue() const;
100
 
    unsigned char GetAlpha() const;
101
 
 
102
 
    // wxWidgets wxColour compatibility functions
103
 
    unsigned char Red() const   { return GetRed(); }
104
 
    unsigned char Green() const { return GetGreen(); }
105
 
    unsigned char Blue() const  { return GetBlue(); }
106
 
    unsigned char Alpha() const { return GetAlpha(); }
107
 
 
108
 
    // -----------------------------------------------------------------------
109
 
    // Equivalency tests
110
 
    bool IsSameAs( const wxGenericColour& c ) const;
111
 
    bool IsSameAs( const wxColour& c ) const;
112
 
 
113
 
    // Get a "hot to cold" colour where i ranges from 0 to 255
114
 
    wxGenericColour GetHotColdColour(double i) const;
115
 
 
116
 
    // Read colour to and from string
117
 
    //wxString WriteString(const wxString& format = wxT("%d,%d,%d,%d")) const;
118
 
    //bool ReadString(const wxString& str, const wxString& format = wxT("%d,%d,%d,%d"));
119
 
 
120
 
    // operators
121
 
    bool operator == (const wxGenericColour& c) const
122
 
        { return m_refData == c.m_refData; }
123
 
    bool operator != (const wxGenericColour& c) const
124
 
        { return m_refData != c.m_refData; }
125
 
 
126
 
    wxGenericColour& operator = (const wxGenericColour& c)
127
 
    {
128
 
        if ( (*this) != c )
129
 
            Ref(c);
130
 
        return *this;
131
 
    }
132
 
    wxGenericColour& operator = ( const wxColour& c ) { Create(c); return *this; }
133
 
 
134
 
private:
135
 
    // ref counting code
136
 
    virtual wxObjectRefData *CreateRefData() const;
137
 
    virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
138
 
 
139
 
    DECLARE_DYNAMIC_CLASS(wxGenericColour)
140
 
};
141
 
 
142
 
//----------------------------------------------------------------------------
143
 
// wxGenericPen - a pen structure that converts to and from wxPen
144
 
//    You can have thousands of them without using up resources. (on MSW)
145
 
//----------------------------------------------------------------------------
146
 
 
147
 
class WXDLLIMPEXP_THINGS wxGenericPen : public wxObject
148
 
{
149
 
public:
150
 
    wxGenericPen() : wxObject() {}
151
 
    wxGenericPen( const wxGenericPen &pen ) : wxObject() { Create(pen); }
152
 
    wxGenericPen( const wxPen &pen ) : wxObject() { Create(pen); }
153
 
    wxGenericPen( const wxGenericColour &colour, int width = 1, int style = wxSOLID,
154
 
                  int cap = wxCAP_ROUND, int join = wxJOIN_ROUND ) : wxObject()
155
 
        { Create(colour, width, style, cap, join); }
156
 
    wxGenericPen( const wxColour &colour, int width = 1, int style = wxSOLID,
157
 
                  int cap = wxCAP_ROUND, int join = wxJOIN_ROUND ) : wxObject()
158
 
        { Create(colour, width, style, cap, join); }
159
 
 
160
 
    virtual ~wxGenericPen() {}
161
 
    // Destroy the refed data
162
 
    void Destroy() { UnRef(); }
163
 
    // Is this colour valid, has refed data
164
 
    bool Ok() const { return m_refData != NULL; }
165
 
 
166
 
    // -----------------------------------------------------------------------
167
 
    // (re)Create this pen, unrefing this pen first.
168
 
    //    Use these to detach this pen from it's refed copies.
169
 
    void Create( const wxGenericPen &pen );
170
 
    void Create( const wxPen &pen );
171
 
    void Create( const wxGenericColour &colour, int width = 1, int style = wxSOLID,
172
 
                int cap = wxCAP_ROUND, int join = wxJOIN_ROUND );
173
 
    void Create( const wxColour &colour, int width = 1, int style = wxSOLID,
174
 
                int cap = wxCAP_ROUND, int join = wxJOIN_ROUND );
175
 
 
176
 
    // -----------------------------------------------------------------------
177
 
    // Set the values of the refed data.
178
 
    //   Use these to adjust the values of all the refed copies.
179
 
    void Set( const wxGenericPen& pen );
180
 
    void Set( const wxPen& pen );
181
 
    void SetColour( const wxGenericColour &colour );
182
 
    void SetColour( const wxColour &colour );
183
 
    void SetColour( int red, int green, int blue, int alpha=255 );
184
 
    void SetCap( int capStyle );
185
 
    void SetJoin( int joinStyle );
186
 
    void SetStyle( int style );
187
 
    void SetWidth( int width );
188
 
    void SetDashes( int number_of_dashes, const wxDash *dash );
189
 
 
190
 
    // -----------------------------------------------------------------------
191
 
    // Get the pen values
192
 
    wxPen GetPen() const;
193
 
 
194
 
    wxGenericColour GetGenericColour() const;
195
 
    wxColour GetColour() const;
196
 
    int GetWidth() const;
197
 
    int GetStyle() const;
198
 
    int GetCap() const;
199
 
    int GetJoin() const;
200
 
    int GetDashes(wxDash **ptr) const;
201
 
    int GetDashCount() const;
202
 
    wxDash* GetDash() const;
203
 
 
204
 
    // -----------------------------------------------------------------------
205
 
    // Equivalency tests
206
 
    bool IsSameAs(const wxGenericPen& pen) const;
207
 
    bool IsSameAs(const wxPen& pen) const;
208
 
 
209
 
    // Read pen to and from string
210
 
    //wxString WriteString() const;
211
 
    //bool ReadString(const wxString& str);
212
 
 
213
 
    // operators
214
 
    bool operator == (const wxGenericPen& pen) const
215
 
        { return m_refData == pen.m_refData; }
216
 
    bool operator != (const wxGenericPen& pen) const
217
 
        { return m_refData != pen.m_refData; }
218
 
 
219
 
    wxGenericPen& operator = (const wxGenericPen& pen)
220
 
    {
221
 
        if ( (*this) != pen )
222
 
            Ref(pen);
223
 
        return *this;
224
 
    }
225
 
    wxGenericPen& operator = ( const wxPen& pen ) { Create(pen); return *this; }
226
 
 
227
 
private:
228
 
    // ref counting code
229
 
    virtual wxObjectRefData *CreateRefData() const;
230
 
    virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
231
 
 
232
 
    DECLARE_DYNAMIC_CLASS(wxGenericPen)
233
 
};
234
 
 
235
 
//----------------------------------------------------------------------------
236
 
// wxGenericBrush - a brush structure that converts to and from wxBrush
237
 
//    You can have thousands of them without using up resources. (on MSW)
238
 
//----------------------------------------------------------------------------
239
 
 
240
 
class WXDLLIMPEXP_THINGS wxGenericBrush : public wxObject
241
 
{
242
 
public:
243
 
    wxGenericBrush() : wxObject() {}
244
 
    wxGenericBrush( const wxGenericBrush &brush ) : wxObject() { Create(brush); }
245
 
    wxGenericBrush( const wxBrush &brush ) : wxObject() { Create(brush); }
246
 
    wxGenericBrush( const wxGenericColour &colour, int style = wxSOLID)
247
 
        : wxObject() { Create(colour, style); }
248
 
    wxGenericBrush( const wxColour &colour, int style = wxSOLID)
249
 
        : wxObject() { Create(colour, style); }
250
 
    wxGenericBrush( const wxBitmap& stipple ) : wxObject() { Create(stipple); }
251
 
 
252
 
    virtual ~wxGenericBrush() {}
253
 
    // Destroy the refed data
254
 
    void Destroy() { UnRef(); }
255
 
    // Is this colour valid, has refed data
256
 
    bool Ok() const { return m_refData != NULL; }
257
 
 
258
 
    // -----------------------------------------------------------------------
259
 
    // (re)Create this brush, unrefing this pen first.
260
 
    //    Use these to detach this pen from it's refed copies.
261
 
    void Create( const wxGenericBrush &brush );
262
 
    void Create( const wxBrush &brush );
263
 
    void Create( const wxGenericColour &colour, int style = wxSOLID );
264
 
    void Create( const wxColour &colour, int style = wxSOLID );
265
 
    void Create( const wxBitmap &stipple );
266
 
 
267
 
    // -----------------------------------------------------------------------
268
 
    // Set the values of the refed data.
269
 
    //   Use these to adjust the values of all the refed copies.
270
 
    void Set( const wxGenericBrush& brush );
271
 
    void Set( const wxBrush& brush );
272
 
    void SetColour( const wxGenericColour &colour );
273
 
    void SetColour( const wxColour &colour );
274
 
    void SetColour( int red, int green, int blue, int alpha=255 );
275
 
    void SetStyle( int style );
276
 
    void SetStipple( const wxBitmap& stipple );
277
 
 
278
 
    // -----------------------------------------------------------------------
279
 
    // Get the brush values
280
 
    wxBrush GetBrush() const;
281
 
 
282
 
    wxGenericColour GetGenericColour() const;
283
 
    wxColour GetColour() const;
284
 
    int GetStyle() const;
285
 
    wxBitmap* GetStipple() const;
286
 
 
287
 
    bool IsHatch() const
288
 
        { return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); }
289
 
 
290
 
    // -----------------------------------------------------------------------
291
 
    // Equivalency tests
292
 
    bool IsSameAs(const wxGenericBrush& brush) const;
293
 
    bool IsSameAs(const wxBrush& brush) const;
294
 
 
295
 
    // operators
296
 
    bool operator == (const wxGenericBrush& brush) const
297
 
        { return m_refData == brush.m_refData; }
298
 
    bool operator != (const wxGenericBrush& brush) const
299
 
        { return m_refData != brush.m_refData; }
300
 
 
301
 
    wxGenericBrush& operator = (const wxGenericBrush& brush)
302
 
    {
303
 
        if ( (*this) != brush )
304
 
            Ref(brush);
305
 
        return *this;
306
 
    }
307
 
    wxGenericBrush& operator = ( const wxBrush& brush ) { Create(brush); return *this; }
308
 
 
309
 
private:
310
 
    // ref counting code
311
 
    virtual wxObjectRefData *CreateRefData() const;
312
 
    virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
313
 
 
314
 
    DECLARE_DYNAMIC_CLASS(wxGenericBrush)
315
 
};
316
 
 
317
 
#endif // _WX_GENERGDI_H_