本文整理汇总了C++中Allocation::y_allotment方法的典型用法代码示例。如果您正苦于以下问题:C++ Allocation::y_allotment方法的具体用法?C++ Allocation::y_allotment怎么用?C++ Allocation::y_allotment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Allocation
的用法示例。
在下文中一共展示了Allocation::y_allotment方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transform
void XYView::transform(
Transformer& t, const Allocation& a, const Allocation& n
) const {
#if 0
Allotment ax, ay;
if (view_margin()) {
const Allotment& alx = a.x_allotment();
ax.span(alx.span() - 2*view_margin());
ax.origin(alx.begin() + view_margin());
ax.alignment(0);
const Allotment& aly = a.y_allotment();
ay.span(aly.span() - 2*view_margin());
ay.origin(aly.begin() + view_margin());
ay.alignment(0);
} else {
ax = a.x_allotment();
ay = a.y_allotment();
}
Allocation al;
al.allot_x(ax);
al.allot_y(ay);
scene2view(al);
#else
scene2view(a);
const Allotment& ax = a.x_allotment();
const Allotment& ay = a.y_allotment();
#endif
const Allotment& nx = n.x_allotment();
const Allotment& ny = n.y_allotment();
XYView* v = (XYView*)this;
csize(ax.begin(), ax.span(), ay.begin(), ay.span());
float sx = xsize_/width();
float sy = ysize_/height();
XYView* xv = (XYView*)this;
xv->x_pick_epsilon_ = pick_epsilon/sx;
xv->y_pick_epsilon_ = pick_epsilon/sy;
t.translate( -left(), -bottom());
t.scale(sx, sy);
t.translate(ax.begin(), ay.begin());
#if 0
printf("XYView::transform ax origin=%g span=%g alignment=%g begin=%g\n",
ax.origin(), ax.span(), ax.alignment(), ax.begin());
printf("XYView::transform ay origin=%g span=%g alignment=%g begin=%g %g\n",
ay.origin(), ay.span(), ay.alignment(), ay.begin(), ay.end());
printf("XYView::transform natx origin=%g span=%g alignment=%g begin=%g\n",
nx.origin(), nx.span(), nx.alignment(), nx.begin());
printf("XYView::transform naty origin=%g span=%g alignment=%g begin=%g %g\n",
ny.origin(), ny.span(), ny.alignment(), ny.begin(), ny.end());
#endif
}
示例2: allocate_body
void BevelFrame::allocate_body(Glyph* g, Coord t, Allocation& a) const {
Requisition req;
g->request(req);
Coord h = hmargin_ ? t : 0, v = vmargin_ ? t : 0;
Allotment& ax = a.x_allotment();
Coord x_span = ax.span() - h - h;
Coord x_offset = h;
Coord x_align = ax.alignment();
const Requirement& rx = req.x_requirement();
if (rx.defined()) {
Coord x_usable = rx.natural() + rx.stretch();
if (x_span > x_usable) {
x_offset += xalign_ * (x_span - x_usable);
x_span = x_usable;
}
}
ax.span(x_span);
ax.offset(x_offset * (1 - x_align - x_align));
Allotment& ay = a.y_allotment();
Coord y_span = ay.span() - v - v;
Coord y_offset = v;
Coord y_align = ay.alignment();
const Requirement& ry = req.y_requirement();
if (ry.defined()) {
Coord y_usable = ry.natural() + ry.stretch();
if (y_span > y_usable) {
y_offset += yalign_ * (y_span - y_usable);
y_span = y_usable;
}
}
ay.span(y_span);
ay.offset(y_offset * (1 - y_align - y_align));
}
示例3: transform
void TransformFitter::transform(
Transformer& t, const Allocation& a, const Allocation& natural
) const {
const Allotment& natural_x = natural.x_allotment();
const Allotment& natural_y = natural.y_allotment();
if (!Math::equal(natural_x.span(), Coord(0), float(1e-2)) &&
!Math::equal(natural_y.span(), Coord(0), float(1e-2))
) {
const Allotment& ax = a.x_allotment();
const Allotment& ay = a.y_allotment();
t.scale(
a.x_allotment().span() / natural_x.span(),
a.y_allotment().span() / natural_y.span()
);
}
t.translate(a.x(), a.y());
}
示例4: allocate_thumb
void XSlider::allocate_thumb(const Allocation& a) {
redraw_thumb();
Allocation thumb_a;
allot_thumb_major_axis(
a, Dimension_X, adjustable_, minimum_thumb_size(),
xscale_, thumb_a.x_allotment()
);
allot_thumb_minor_axis(a.y_allotment(), thumb_a.y_allotment());
reallocate_thumb(thumb_a);
}
示例5: allocate
void XYView::allocate(Canvas* c, const Allocation& a, Extension& ext) {
#if defined(WIN32) || defined(CYGWIN)
if (a.y_allotment().span() <= 0. || a.x_allotment().span() <= 0.) {
// a bug in mswindows iconify
return;
}
#endif
if (canvas_ == NULL) {
canvas_ = c;
}
c->push_transform();
TransformSetter::allocate(c, a, ext);
c->pop_transform();
}
示例6: width
void XYView::scene2view(const Allocation& a) const {
float m00 = width()/a.x_allotment().span();
float m11 = height()/a.y_allotment().span();
//takes a canvas transformation from scene to parent glyph coordinates
// transforms vectors from original to xyview
XYView* xyv = (XYView*)this;
xyv->scene2viewparent_ = Transformer(
m00, 0,
0, m11,
left() - a.left()*m00,
bottom() - a.bottom()*m11
);
//print_t("scene2view", scene2viewparent_);
}
示例7: draw
void GLPolygonTest::draw(Canvas*, const Allocation& a) const {
RGBcolor(255, 255, 255);
clear();
Coord x_size = a.x_allotment().span();
Coord y_size = a.y_allotment().span();
Coord x_mid = x_size * 0.5;
Coord y_mid = y_size * 0.5;
RGBcolor(255, 0, 0);
triangle(
0.0, 0.0, 0.0,
x_mid, y_size, 0.0,
x_size, 0.0, 0.0
);
}