/usr/include/InterViews/geometry.h is in ivtools-dev 1.2.11a1-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | /*
* Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University
* Copyright (c) 1991 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Stanford and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Stanford and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef iv_geometry_h
#define iv_geometry_h
#include <InterViews/coord.h>
#include <InterViews/_enter.h>
/*
* Can't make DimensionName an enum because we want to be able
* to iterate from 0 to number_of_dimensions. Alas,
* C++ does not allow arithmetic on enums.
*/
typedef unsigned int DimensionName;
enum {
Dimension_X = 0, Dimension_Y, Dimension_Z, Dimension_Undefined
};
class CoordinateSpace {
public:
enum { x = 0, y, z, dimensions };
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
};
class Requirement {
public:
Requirement();
Requirement(Coord natural);
Requirement(Coord natural, Coord stretch, Coord shrink, float alignment);
Requirement(
Coord natural_lead, Coord max_lead, Coord min_lead,
Coord natural_trail, Coord max_trail, Coord min_trail
);
boolean equals(const Requirement&, float epsilon) const;
boolean defined() const;
void natural(Coord);
Coord natural() const;
void stretch(Coord);
Coord stretch() const;
void shrink(Coord);
Coord shrink() const;
void alignment(float);
float alignment() const;
private:
Coord natural_;
Coord stretch_;
Coord shrink_;
float alignment_;
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
};
class Requisition {
public:
Requisition();
Requisition(const Requisition&);
void penalty(int);
int penalty() const;
boolean equals(const Requisition&, float epsilon) const;
void require(DimensionName, const Requirement&);
void require_x(const Requirement&);
void require_y(const Requirement&);
const Requirement& requirement(DimensionName) const;
const Requirement& x_requirement() const;
const Requirement& y_requirement() const;
Requirement& requirement(DimensionName);
Requirement& x_requirement();
Requirement& y_requirement();
private:
int penalty_;
Requirement x_;
Requirement y_;
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
};
class Allotment {
public:
Allotment();
Allotment(Coord origin, Coord span, float alignment);
boolean equals(const Allotment&, float epsilon) const;
void origin(Coord);
void offset(Coord);
Coord origin() const;
void span(Coord);
Coord span() const;
void alignment(float);
float alignment() const;
Coord begin() const;
Coord end() const;
private:
Coord origin_;
Coord span_;
float alignment_;
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
};
//: actual size a glyph is given.
// <a href=../refman3.1/refman.html#PAGE18>in reference manual</a>.
class Allocation {
public:
Allocation();
Allocation(const Allocation&);
boolean equals(const Allocation&, float epsilon) const;
void allot(DimensionName, const Allotment&);
void allot_x(const Allotment&);
void allot_y(const Allotment&);
Allotment& allotment(DimensionName);
const Allotment& allotment(DimensionName) const;
Allotment& x_allotment();
Allotment& y_allotment();
const Allotment& x_allotment() const;
const Allotment& y_allotment() const;
Coord x() const;
Coord y() const;
Coord left() const;
Coord right() const;
Coord bottom() const;
Coord top() const;
private:
Allotment x_;
Allotment y_;
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
};
class Canvas;
//: area where a glyph actually draws after all.
// <a href=../refman3.1/refman.html#PAGE18>in reference manual</a>.
class Extension {
public:
Extension();
Extension(const Extension&);
void operator =(const Extension&);
static void transform_xy(
Canvas*, Coord& left, Coord& bottom, Coord& right, Coord& top
);
void set(Canvas*, const Allocation&);
void set_xy(Canvas*, Coord left, Coord bottom, Coord right, Coord top);
void clear();
void merge(const Extension&);
void merge(Canvas*, const Allocation&);
void merge_xy(Canvas*, Coord left, Coord bottom, Coord right, Coord top);
Coord left() const;
Coord bottom() const;
Coord right() const;
Coord top() const;
private:
Coord x_begin_;
Coord x_end_;
Coord y_begin_;
Coord y_end_;
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
};
inline Requirement::Requirement() {
natural_ = -fil;
stretch_ = 0;
shrink_ = 0;
alignment_ = 0;
}
inline Requirement::Requirement(Coord natural) {
natural_ = natural;
stretch_ = 0;
shrink_ = 0;
alignment_ = 0;
}
inline Requirement::Requirement(
Coord natural, Coord stretch, Coord shrink, float alignment
) {
natural_ = natural;
stretch_ = stretch;
shrink_ = shrink;
alignment_ = alignment;
}
inline boolean Requirement::defined() const {
return natural_ != -fil;
}
inline void Requirement::natural(Coord c) { natural_ = c; }
inline Coord Requirement::natural() const { return natural_; }
inline void Requirement::stretch(Coord c) { stretch_ = c; }
inline Coord Requirement::stretch() const { return stretch_; }
inline void Requirement::shrink(Coord c) { shrink_ = c; }
inline Coord Requirement::shrink() const { return shrink_; }
inline void Requirement::alignment(float a) { alignment_ = a; }
inline float Requirement::alignment() const { return alignment_; }
inline int Requisition::penalty() const { return penalty_; }
inline void Requisition::penalty(int penalty) { penalty_ = penalty; }
inline void Requisition::require_x(const Requirement& r) { x_ = r; }
inline void Requisition::require_y(const Requirement& r) { y_ = r; }
inline const Requirement& Requisition::x_requirement() const { return x_; }
inline const Requirement& Requisition::y_requirement() const { return y_; }
inline Requirement& Requisition::x_requirement() { return x_; }
inline Requirement& Requisition::y_requirement() { return y_; }
inline Allotment::Allotment() {
origin_ = 0;
span_ = 0;
alignment_ = 0;
}
inline Allotment::Allotment(Coord origin, Coord span, float alignment) {
origin_ = origin;
span_ = span;
alignment_ = alignment;
}
inline void Allotment::origin(Coord o) { origin_ = o; }
inline void Allotment::offset(Coord o) { origin_ += o; }
inline Coord Allotment::origin() const { return origin_; }
inline void Allotment::span(Coord c) { span_ = c; }
inline Coord Allotment::span() const { return span_; }
inline void Allotment::alignment(float a) { alignment_ = a; }
inline float Allotment::alignment() const { return alignment_; }
inline Coord Allotment::begin() const {
return origin_ - Coord(alignment_ * span_);
}
inline Coord Allotment::end() const {
return origin_ - Coord(alignment_ * span_) + span_;
}
inline void Allocation::allot_x(const Allotment& a) { x_ = a; }
inline void Allocation::allot_y(const Allotment& a) { y_ = a; }
inline Allotment& Allocation::x_allotment() { return x_; }
inline Allotment& Allocation::y_allotment() { return y_; }
inline const Allotment& Allocation::x_allotment() const { return x_; }
inline const Allotment& Allocation::y_allotment() const { return y_; }
inline Coord Allocation::x() const { return x_.origin(); }
inline Coord Allocation::y() const { return y_.origin(); }
inline Coord Allocation::left() const { return x_.begin(); }
inline Coord Allocation::right() const { return x_.end(); }
inline Coord Allocation::bottom() const { return y_.begin(); }
inline Coord Allocation::top() const { return y_.end(); }
inline Coord Extension::left() const { return x_begin_; }
inline Coord Extension::bottom() const { return y_begin_; }
inline Coord Extension::right() const { return x_end_; }
inline Coord Extension::top() const { return y_end_; }
#include <InterViews/_leave.h>
#endif
|