~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to wxPython/src/_region.i

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////
 
2
// Name:        _imaglist.i
 
3
// Purpose:     SWIG interface defs for wxImageList and releated classes
 
4
//
 
5
// Author:      Robin Dunn
 
6
//
 
7
// Created:     7-July-1997
 
8
// RCS-ID:      $Id: _region.i 63143 2010-01-14 03:08:17Z RD $
 
9
// Copyright:   (c) 2003 by Total Control Software
 
10
// Licence:     wxWindows license
 
11
/////////////////////////////////////////////////////////////////////////////
 
12
 
 
13
// Not a %module
 
14
 
 
15
 
 
16
//---------------------------------------------------------------------------
 
17
 
 
18
%{
 
19
%}
 
20
 
 
21
//---------------------------------------------------------------------------
 
22
%newgroup
 
23
 
 
24
 
 
25
enum wxRegionContain
 
26
{
 
27
    wxOutRegion = 0,
 
28
    wxPartRegion = 1,
 
29
    wxInRegion = 2
 
30
};
 
31
 
 
32
 
 
33
// // these constants are used with wxRegion::Combine() in the ports which have
 
34
// // this method
 
35
// enum wxRegionOp
 
36
// {
 
37
//     // Creates the intersection of the two combined regions.
 
38
//     wxRGN_AND,
 
39
 
 
40
//     // Creates a copy of the region
 
41
//     wxRGN_COPY,
 
42
 
 
43
//     // Combines the parts of first region that are not in the second one
 
44
//     wxRGN_DIFF,
 
45
 
 
46
//     // Creates the union of two combined regions.
 
47
//     wxRGN_OR,
 
48
 
 
49
//     // Creates the union of two regions except for any overlapping areas.
 
50
//     wxRGN_XOR
 
51
// };
 
52
 
 
53
 
 
54
 
 
55
MustHaveApp(wxRegion);
 
56
 
 
57
class wxRegion : public wxGDIObject {
 
58
public:
 
59
    wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
 
60
    %RenameCtor(RegionFromBitmap, wxRegion(const wxBitmap& bmp));
 
61
    %RenameCtor(RegionFromBitmapColour, wxRegion(const wxBitmap& bmp,
 
62
                                                 const wxColour& transColour,
 
63
                                                 int   tolerance = 0));
 
64
    %RenameCtor(RegionFromPoints, wxRegion(int points, wxPoint* points_array,
 
65
                                           wxPolygonFillMode fillStyle = wxWINDING_RULE));
 
66
 
 
67
    ~wxRegion();
 
68
 
 
69
 
 
70
    void Clear();
 
71
    bool Offset(wxCoord x, wxCoord y);
 
72
 
 
73
    wxRegionContain Contains(wxCoord x, wxCoord y);
 
74
    %Rename(ContainsPoint, wxRegionContain, Contains(const wxPoint& pt));
 
75
    %Rename(ContainsRect, wxRegionContain, Contains(const wxRect& rect));
 
76
    %Rename(ContainsRectDim, wxRegionContain, Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h));
 
77
 
 
78
    wxRect GetBox();
 
79
 
 
80
    bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
81
    %Rename(IntersectRect, bool, Intersect(const wxRect& rect));
 
82
    %Rename(IntersectRegion, bool, Intersect(const wxRegion& region));
 
83
 
 
84
    bool IsEmpty();
 
85
 
 
86
    // Is region equal (i.e. covers the same area as another one)?
 
87
    bool IsEqual(const wxRegion& region) const;
 
88
 
 
89
    bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
90
    %Rename(UnionRect, bool, Union(const wxRect& rect));
 
91
    %Rename(UnionRegion, bool, Union(const wxRegion& region));
 
92
 
 
93
    bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
94
    %Rename(SubtractRect, bool, Subtract(const wxRect& rect));
 
95
    %Rename(SubtractRegion, bool, Subtract(const wxRegion& region));
 
96
 
 
97
    bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
98
    %Rename(XorRect, bool, Xor(const wxRect& rect));
 
99
    %Rename(XorRegion, bool, Xor(const wxRegion& region));
 
100
 
 
101
    // Convert the region to a B&W bitmap with the white pixels being inside
 
102
    // the region.
 
103
    wxBitmap ConvertToBitmap();
 
104
 
 
105
    // Use the non-transparent pixels of a wxBitmap for the region to combine
 
106
    // with this region.  If the bitmap has a mask then it will be used,
 
107
    // otherwise the colour to be treated as transparent may be specified,
 
108
    // along with an optional tolerance value.
 
109
    %Rename(UnionBitmap, bool, Union(const wxBitmap& bmp));
 
110
    %Rename(UnionBitmapColour, bool, Union(const wxBitmap& bmp,
 
111
                                           const wxColour& transColour,
 
112
                                           int   tolerance = 0));
 
113
 
 
114
 
 
115
//     bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op);
 
116
//     %Rename(CombineRect, bool , Combine(const wxRect& rect, wxRegionOp op));
 
117
//     %Rename(CombineRegion, bool , Combine(const wxRegion& region, wxRegionOp op));
 
118
    
 
119
    %property(Box, GetBox, doc="See `GetBox`");    
 
120
};
 
121
 
 
122
 
 
123
 
 
124
MustHaveApp(wxRegionIterator);
 
125
 
 
126
class wxRegionIterator : public wxObject {
 
127
public:
 
128
    wxRegionIterator(const wxRegion& region);
 
129
    ~wxRegionIterator();
 
130
 
 
131
    wxCoord GetX();
 
132
    wxCoord GetY();
 
133
    wxCoord GetW();
 
134
    wxCoord GetWidth();
 
135
    wxCoord GetH();
 
136
    wxCoord GetHeight();
 
137
    wxRect GetRect();
 
138
    bool HaveRects();
 
139
    void Reset();
 
140
 
 
141
    %extend {
 
142
        void Next() {
 
143
            (*self) ++;
 
144
        }
 
145
 
 
146
        bool __nonzero__() {
 
147
            return self->operator bool();
 
148
        }
 
149
    };
 
150
 
 
151
    %property(H, GetH, doc="See `GetH`");
 
152
    %property(Height, GetHeight, doc="See `GetHeight`");
 
153
    %property(Rect, GetRect, doc="See `GetRect`");
 
154
    %property(W, GetW, doc="See `GetW`");
 
155
    %property(Width, GetWidth, doc="See `GetWidth`");
 
156
    %property(X, GetX, doc="See `GetX`");
 
157
    %property(Y, GetY, doc="See `GetY`");
 
158
};
 
159
 
 
160
 
 
161
 
 
162
//---------------------------------------------------------------------------
 
163
//---------------------------------------------------------------------------