本文整理汇总了C++中Allocation类的典型用法代码示例。如果您正苦于以下问题:C++ Allocation类的具体用法?C++ Allocation怎么用?C++ Allocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Allocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNode
TInt AVisWidget::GetParData(ParentSizeProv::TData aData)
{
TInt res = 0;
// Update parent of widget. It is requied because there is no notification of parent change or
// connection to parent change. In fact the observation via HandleCompChanged give us only
// info of local connection change, but not the whole connection chain change. Ref grayb uc_010
Container* parent = iWidget->get_parent();
if (parent == NULL) {
Elem* eprntcp = GetNode("../../ConnPoint:Child");
if (eprntcp != NULL) {
MVisContainer* mcont = (MVisContainer*) eprntcp->GetSIfiC(MVisContainer::Type(), this);
if (mcont != NULL) {
if (iWidget->get_parent() == NULL) {
Container& cont = mcont->GetContainer();
cont.add(*iWidget);
parent = iWidget->get_parent();
}
}
}
}
if (parent != NULL) {
Allocation palc = parent->get_allocation();
res = aData == ParentSizeProv::ED_W ? palc.get_width() : palc.get_height();
}
return res;
}
示例2: pageView
void ScrollCtrl::pageView(KeyEvent & e, const Allocation& a )
{
PPM delta = 0;
Dimension dim = 0;
if( e.isPageUp() && e.isPlainKey() )
{
dim = DimY;
delta = -PPM( a.getHeight() ) * g_page / d_area->getTwipPerPpm( dim );
}else if( e.isPageDown() && e.isPlainKey() )
{
dim = DimY;
delta = PPM( a.getHeight() ) * g_page / d_area->getTwipPerPpm( dim );
}else if( e.isPageUp() && e.isCtrl() )
{
dim = DimX;
delta = -PPM( a.getWidth() ) * g_page / d_area->getTwipPerPpm( dim );
}else if( e.isPageDown() && e.isCtrl() )
{
dim = DimX;
delta = PPM( a.getWidth() ) * g_page / d_area->getTwipPerPpm( dim );
}
if( d_do[ dim ] && d_area->inUse( dim ) )
{
PpmRange r = d_area->getRange( dim );
r.move( delta * r.getSign() );
d_area->setRange( dim, r );
getViewport()->damageAll();
}
}
示例3: transform
void View::transform(
Transformer& t, const Allocation& a, const Allocation&
) const {
scene2view(a);
const Allotment& ax = a.x_allotment();
const Allotment& ay = a.y_allotment();
csize(ax.begin(), ax.span(), ay.begin(), ay.span());
float sx = ax.span()/XYView::width();
float sy = ay.span()/XYView::height();
// if (sx > sy) sx = sy;
t.translate( -x(), -y());
t.scale(sx, sx);
View* v = (View*)this;
v->x_pick_epsilon_ = pick_epsilon/sx;
v->y_pick_epsilon_ = pick_epsilon/sx;
t.translate((ax.begin() + ax.end())/2,(ay.begin() + ay.end())/2);
//printf("\nx origin=%g span=%g alignment=%g begin=%g end=%g\n", ax.origin(), ax.span(), ax.alignment(), ax.begin(), ax.end());
//printf("\ny origin=%g span=%g alignment=%g begin=%g end=%g\n", ay.origin(), ay.span(), ay.alignment(), ay.begin(), ay.end());
Coord x1,y1;
t.transform(x() - x_span_/2, y() - y_span_/2, x1, y1);
if (!Math::equal(ax.begin(), x1, 1) || !Math::equal(ay.begin(), y1, 1)) {
t.inverse_transform(ax.begin(), ay.begin(), x1, y1);
v->x_span_ = 2*(x() - x1);
v->y_span_ = 2*(y() - y1);
v->size(x1,y1,x1+v->x_span_, y1+v->y_span_);
}
}
示例4: rsi_Allocation3DRead
void rsi_Allocation3DRead(Context *rsc, RsAllocation va,
uint32_t xoff, uint32_t yoff, uint32_t zoff,
uint32_t lod, uint32_t w, uint32_t h, uint32_t d,
void *data, size_t sizeBytes, size_t stride) {
Allocation *a = static_cast<Allocation *>(va);
a->read(rsc, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
}
示例5: view_ratio
void XYView::damage(Glyph* g, const Allocation& a, bool fixed, bool vf) {
if (canvas_) {
Extension e;
canvas_->push_transform();
canvas_->transformer(((XYView_helper*)body())->t_);
if (fixed) {
Coord x, y;
canvas_->transform(s2o());
if (vf) {
view_ratio(a.x(), a.y(), x, y);
} else {
s2o().inverse_transform(a.x(), a.y(), x, y);
}
Allocation a_fix = a;
a_fix.x_allotment().origin(x);
a_fix.y_allotment().origin(y);
g->allocate(canvas_, a_fix, e);
} else {
g->allocate(canvas_, a, e);
}
//printf("damage extension %g %g %g %g\n", e.left(), e.bottom(), e.right(), e.top());
//print_t("XYView::damage", canvas_->transformer());
canvas_->pop_transform();
canvas_->damage(e);
}
}
示例6: pick
void XYView_helper::pick(Canvas* c, const Allocation& a, int depth, Hit& h) {
if (MyMath::inside(h.left(), h.bottom(), v_->left(), v_->bottom(),
v_->right(), v_->top())) {
if (h.event()->grabber()) { // fixes a bug but I dont know why
#if 1
//The above fix broke the handling of keystrokes for crosshairs and Rotate3D
//It was needed so that buttons would appear normal when moving quickly from
// a button through a box to a scene. Now we put in the right handler in
//case event was a keystroke.
if (h.event()->type() == Event::key) {
h.target(depth, this, 0, h.event()->grabber());
}
#endif
return;
}
current_pick_view_ = v_;
MonoGlyph::pick(c, a, depth, h);
if (h.event()->type() == Event::down) {
#if 0
printf("XYView_helper hit (%g, %g) event (%g, %g)\n", h.left(), h.bottom(),
h.event()->pointer_x(), h.event()->pointer_y());
printf(" allocation lb=(%g, %g), rt=(%g,%g)\n", a.left(), a.bottom(), a.right(), a.top());
#endif
}
}
}
示例7: 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));
}
示例8: handleMousePress
bool CursorCtrl::handleMousePress( MouseEvent& e )
{
if( e.isLeft() && ( e.isNoKey() || e.isAlt() ) ||
e.isRight() && e.isShift() )
{
Allocation a;
allocation( a );
ViewAreaMdl* area = d_view->getArea();
if( d_do[ DimX ] && d_do[ DimY ] && area->getDimCount() == 2 )
{
PPM x = area->toPpm( e.getX(), a.getLeft(), DimX );
PPM y = area->toPpm( e.getY(), a.getTop(), DimY );
d_view->getModel()->setPos( d_view->getDim( DimX ), x,
d_view->getDim( DimY ), y, d_mouseVeto );
}else if( d_do[ DimX ] && area->inUse( DimX ) )
{
PPM x = area->toPpm( e.getX(), a.getLeft(), DimX );
d_view->getModel()->setPos( d_view->getDim( DimX ), x, d_mouseVeto );
}else if( d_do[ DimY ] && area->inUse( DimY ) )
{
PPM y = area->toPpm( e.getY(), a.getTop(), DimY );
d_view->getModel()->setPos( d_view->getDim( DimY ), y, d_mouseVeto );
}
return d_swallow; // Der Click soll nicht immer gefressen werden.
}else
return false;
}
示例9: allocate
void Character::allocate(Canvas* c, const Allocation& a, Extension& ext) {
Coord x = a.x();
Coord y = a.y();
ext.set_xy(
c, x - left_bearing_, y - descent_, x + right_bearing_, y + ascent_
);
}
示例10: pick
void Space::pick(Canvas*, const Allocation& a, int depth, Hit& h) {
Coord x = h.left();
Coord left = a.left();
Coord right = a.right();
if (x >= left && x < right) {
h.target(depth, this, (x > (left+right)/2) ? 1 : 0);
}
}
示例11: rsAssert
void *rsi_AllocationGetPointer(Context *rsc, RsAllocation valloc,
uint32_t lod, RsAllocationCubemapFace face,
uint32_t z, uint32_t array, size_t *stride, size_t strideLen) {
Allocation *alloc = static_cast<Allocation *>(valloc);
rsAssert(strideLen == sizeof(size_t));
return alloc->getPointer(rsc, lod, face, z, array, stride);
}
示例12: draw
void Background::draw(Canvas* c, const Allocation& a) const {
Extension ext;
ext.set(c, a);
if (c->damaged(ext)) {
c->fill_rect(a.left(), a.bottom(), a.right(), a.top(), color_);
}
MonoGlyph::draw(c, a);
}
示例13: draw
void MonoKitFrame::draw(Canvas* c, const Allocation& a) const {
BevelFrame::draw(c, a);
if (!state_->test(TelltaleState::is_enabled)) {
c->fill_rect(
a.left(), a.bottom(), a.right(), a.top(), info_->gray_out()
);
}
}
示例14: OnUpdated_H
void AVisDrawing::OnUpdated_H(int aData)
{
Allocation alc = iWidget->get_allocation();
Container* parent = iWidget->get_parent();
VisDrwArea* drw = GetDrawing();
drw->set_size_request(iW, iH);
drw->queue_draw_area(alc.get_x(), alc.get_y(), iW, iH);
}
示例15: get_window
bool VisDrwArea::on_expose_event(GdkEventExpose* aEvent)
{
DrawingArea::on_expose_event(aEvent);
Glib::RefPtr<Gdk::Window> drw = get_window();
Glib::RefPtr<Gtk::Style> style = get_style();
Glib::RefPtr<Gdk::GC> gc = style->get_fg_gc(get_state());
Allocation alc = get_allocation();
drw->draw_rectangle(gc, false, 0, 0, alc.get_width() - 1, alc.get_height() - 1);
}