Skip to content
Newer
Older
100644 132 lines (103 sloc) 3.67 KB
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec @lylejohnson Updated copyright notice for all SWIG interface files
lylejohnson authored Nov 9, 2009
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547 @lylejohnson Replaced e-mail address "lyle@users.sourceforge.net" with
lylejohnson authored Nov 9, 2009
20 * at "lyle@lylejohnson.name".
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored Feb 2, 2009
21 ***********************************************************************/
22
23 %rename("empty?") FXExtentd::empty() const;
24 %rename("contains?") FXExtentd::contains(FXfloat x,FXfloat y) const;
25 %rename("contains?") FXExtentd::contains(const FXVec2d& p) const;
26 %rename("contains?") FXExtentd::contains(const FXExtentd& ext) const;
27 %rename("include!") FXExtentd::include(FXfloat x,FXfloat y);
28 %rename("include!") FXExtentd::include(const FXVec2d& v);
29 %rename("include!") FXExtentd::include(const FXExtentd& ext);
30 %rename("overlap?") FXExtentd::overlap(const FXExtentd& other) const;
31
32 /// Extent
33 class FXExtentd {
34 public:
35 FXVec2d lower;
36 FXVec2d upper;
37 public:
38
39 /// Default constructor
40 FXExtentd();
41
42 /// Copy constructor
43 FXExtentd(const FXExtentd& ext);
44
45 /// Initialize from two vectors
46 FXExtentd(const FXVec2d& lo,const FXVec2d& hi);
47
48 /// Initialize from six numbers
49 FXExtentd(FXdouble xlo,FXdouble xhi,FXdouble ylo,FXdouble yhi);
50
51 %extend {
52 /// Indexing with 0..1
53 FXVec2d& __setitem__(FXint i,FXVec2d& v) {
54 if(i<0||i>1) rb_raise(rb_eIndexError,"index %d out of bounds",i);
55 (*self)[i]=v;
56 return v;
57 }
58
59 /// Indexing with 0..1
60 const FXVec2d& __getitem__(FXint i) const {
61 if(i<0||i>1) rb_raise(rb_eIndexError,"index %d out of bounds",i);
62 return (*self)[i];
63 }
64 }
65
66 /// Width of box
67 FXdouble width() const;
68
69 /// Height of box
70 FXdouble height() const;
71
72 /// Longest side
73 FXdouble longest() const;
74
75 /// shortest side
76 FXdouble shortest() const;
77
78 /// Length of diagonal
79 FXdouble diameter() const;
80
81 /// Get radius of box
82 FXdouble radius() const;
83
84 /// Compute diagonal
85 FXVec2d diagonal() const;
86
87 /// Get center of box
88 FXVec2d center() const;
89
90 /// Test if empty
91 bool empty() const;
92
93 /// Test if box contains point x,y
94 bool contains(FXdouble x,FXdouble y) const;
95
96 /// Test if box contains point p
97 bool contains(const FXVec2d& p) const;
98
99 /// Test if box properly contains another box
100 bool contains(const FXExtentd& ext) const;
101
102 /// Include point
103 FXExtentd& include(FXdouble x,FXdouble y);
104
105 /// Include point
106 FXExtentd& include(const FXVec2d& v);
107
108 /// Include given range into extent
109 FXExtentd& include(const FXExtentd& ext);
110
111 /// Get corner number 0..3
112 FXVec2d corner(FXint c) const;
113
114 %extend {
115 /// Test if bounds overlap
116 bool overlap(const FXExtentd& other) const {
117 return overlap(*self,other);
118 }
119
120 /// Union of two boxes
121 FXExtentd unite_with(const FXExtentd& other) const {
122 return unite(*self,other);
123 }
124
125 /// Intersection of two boxes
126 FXExtentd intersect_with(const FXExtentd& other) const {
127 return intersect(*self,other);
128 }
129 }
130 };
131
Something went wrong with that request. Please try again.