本文整理汇总了C++中gtk::Allocation::get_y方法的典型用法代码示例。如果您正苦于以下问题:C++ Allocation::get_y方法的具体用法?C++ Allocation::get_y怎么用?C++ Allocation::get_y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk::Allocation
的用法示例。
在下文中一共展示了Allocation::get_y方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_size_allocate
void MyWidget::on_size_allocate(Gtk::Allocation& allocation)
{
//Do something with the space that we have actually been given:
//(We will not be given heights or widths less than we have requested, though
//we might get more)
//Use the offered allocation for this container:
set_allocation(allocation);
if(m_refGdkWindow)
{
m_refGdkWindow->move_resize( allocation.get_x(), allocation.get_y(),
allocation.get_width(), allocation.get_height() );
}
}
示例2: on_size_allocate
/**
* Does something with the space that we have actually been given.
*/
void GtkBlockBar::on_size_allocate(Gtk::Allocation& allocation)
{
//
//(We will not be given heights or widths less than we have requested, though
//we might get more)
//Use the offered allocation for this container:
set_allocation(allocation);
if(m_refGdkWindow)
{
m_refGdkWindow->move_resize( allocation.get_x(), allocation.get_y(),
allocation.get_width(), allocation.get_height() );
}
}
示例3: on_size_allocate
void OSGDrawingArea::on_size_allocate (Gtk::Allocation& pAllocation)
{
#ifdef DEBUG
//??std::cout <<"void OSGDrawingArea::on_size_allocate (Gtk::Allocation& pAllocation)<<"<< std::endl;
#endif
set_allocation (pAllocation);
if (is_realized ())
{
get_window ()->move_resize (pAllocation.get_x (), pAllocation.get_y (),
pAllocation.get_width (), pAllocation.get_height ());
}//if
#ifdef DEBUG
//??std::cout <<"void OSGDrawingArea::on_size_allocate (Gtk::Allocation& pAllocation)>>"<< std::endl;
#endif
}
示例4: on_realize
void MyWidget::on_realize()
{
//Do not call base class Gtk::Widget::on_realize().
//It's intended only for widgets that set_has_window(false).
set_realized();
//Get the themed style from the CSS file:
get_style_property("example_scale", m_scale);
std::cout << "m_scale (example_scale from the theme/css-file) is: "
<< m_scale << std::endl;
if(!m_refGdkWindow)
{
//Create the GdkWindow:
GdkWindowAttr attributes;
memset(&attributes, 0, sizeof(attributes));
Gtk::Allocation allocation = get_allocation();
//Set initial position and size of the Gdk::Window:
attributes.x = allocation.get_x();
attributes.y = allocation.get_y();
attributes.width = allocation.get_width();
attributes.height = allocation.get_height();
attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
m_refGdkWindow = Gdk::Window::create(get_parent_window(), &attributes,
GDK_WA_X | GDK_WA_Y);
set_window(m_refGdkWindow);
//set colors
override_background_color(Gdk::RGBA("red"));
override_color(Gdk::RGBA("blue"));
//make the widget receive expose events
m_refGdkWindow->set_user_data(gobj());
}
}
示例5: on_realize
/**
* Does something when the block bar is realized.
*/
void GtkBlockBar::on_realize()
{
//Do not call base class Gtk::Widget::on_realize().
//It's intended only for widgets that set_has_window(false).
set_realized();
if(!m_refGdkWindow)
{
//Create the GdkWindow:
GdkWindowAttr attributes;
memset(&attributes, 0, sizeof(attributes));
Gtk::Allocation allocation = get_allocation();
//Set initial position and size of the Gdk::Window:
attributes.x = allocation.get_x();
attributes.y = allocation.get_y();
attributes.width = allocation.get_width();
attributes.height = allocation.get_height();
attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
m_refGdkWindow = Gdk::Window::create(get_parent_window(), &attributes,
GDK_WA_X | GDK_WA_Y);
set_window(m_refGdkWindow);
//set colors TODO
//override_background_color(Gdk::RGBA("red"));
//override_color(Gdk::RGBA("green"));
//make the widget receive expose events
m_refGdkWindow->set_user_data(gobj());
}
}
示例6: window_expose_event
bool Liveplay::window_expose_event(GdkEventExpose *event) {
Cairo::RefPtr<Cairo::Context> cr = Glib::wrap(event->window, true)->create_cairo_context();
Gtk::Allocation a = liveplay_canvas->get_allocation();
Gdk::Region region(a);
region.intersect(Glib::wrap(event->region, true));
Gdk::Cairo::add_region_to_path(cr, region);
cr->clip();
cr->set_operator(Cairo::OPERATOR_SOURCE);
cr->set_source_rgb(0,0,0);
cr->paint();
//gdk_cairo_set_source_window(cr->cobj(), liveplay_canvas->get_window()->gobj(), a.get_x(), a.get_y()); gtk 2.24
gdk_cairo_set_source_pixmap(cr->cobj(), liveplay_canvas->get_window()->gobj(), a.get_x(), a.get_y());
cr->paint_with_alpha(pow(brightness_adj->get_value(),2.2));
return false;
}