本文整理汇总了C++中Allocation::get_width方法的典型用法代码示例。如果您正苦于以下问题:C++ Allocation::get_width方法的具体用法?C++ Allocation::get_width怎么用?C++ Allocation::get_width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Allocation
的用法示例。
在下文中一共展示了Allocation::get_width方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParData
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: on_expose_event
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);
}
示例3: on_expose_event
bool CompVis::on_expose_event(GdkEventExpose* event) {
Glib::RefPtr<Gdk::Window> window = get_window();
Allocation allocation = get_allocation();
const int width = allocation.get_width();
const int height = allocation.get_height();
Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
// clip to the area indicated by the expose event so that we only redraw
// the portion of the window that needs to be redrawn
cr->rectangle(event->area.x, event->area.y,
event->area.width, event->area.height);
cr->clip();
rms_dB = 20*log10(rms);
thresh_fraction = (threshold - p_ports[p_threshold].min)/threshold_range;
rms_dB_fraction = (rms_dB - p_ports[p_threshold].min)/threshold_range;
// Draw the graph
cr->set_source_rgb(0.5,0.1,0.1);
cr->set_line_width(2);
cr->move_to(0,height);
if (rms_dB <= threshold) {
cr->line_to(rms_dB_fraction*width, height-rms_dB_fraction*height);
cr->line_to(rms_dB_fraction*width, height);
cr->line_to(0,height);
} else {
cr->line_to(thresh_fraction*width, height-thresh_fraction*height);
cr->line_to(rms_dB_fraction*width, height-(thresh_fraction*height + height*(rms_dB_fraction-thresh_fraction)/ratio));
cr->line_to(rms_dB_fraction*width, height);
cr->line_to(0,height);
}
cr->fill();
// draw the compression curve:
cr->set_source_rgb(0.1,0.1,0.1);
cr->move_to(0, height);
cr->line_to(thresh_fraction*width, height-thresh_fraction*height);
cr->line_to(width, height-(thresh_fraction*height + height*(1-thresh_fraction)/ratio));
cr->stroke();
// Draw the gain
cr->set_source_rgb(0.1,0.8,0.1);
cr->rectangle(0,(float)height - (float)height*gain, 10, height);
cr->fill();
return true;
}
示例4: props_on_size_allocate
void SettingsManager::props_on_size_allocate(Allocation &alloc) {
props.changeSize(alloc.get_width());
}