本文整理汇总了C++中gdk::Rectangle::get_height方法的典型用法代码示例。如果您正苦于以下问题:C++ Rectangle::get_height方法的具体用法?C++ Rectangle::get_height怎么用?C++ Rectangle::get_height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdk::Rectangle
的用法示例。
在下文中一共展示了Rectangle::get_height方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundToScreenCoordinates
void GazeTracker::boundToScreenCoordinates(Point &estimate) {
int numMonitors = Gdk::Screen::get_default()->get_n_monitors();
Gdk::Rectangle monitorGeometry;
Glib::RefPtr<Gdk::Screen> screen = Gdk::Display::get_default()->get_default_screen();
// Geometry of main monitor
screen->get_monitor_geometry(numMonitors - 1, monitorGeometry);
// If x or y coordinates are outside screen boundaries, correct them
if (estimate.x < monitorGeometry.get_x()) {
estimate.x = monitorGeometry.get_x();
}
if (estimate.y < monitorGeometry.get_y()) {
estimate.y = monitorGeometry.get_y();
}
if (estimate.x >= monitorGeometry.get_x() + monitorGeometry.get_width()) {
estimate.x = monitorGeometry.get_x() + monitorGeometry.get_width();
}
if (estimate.y >= monitorGeometry.get_y() + monitorGeometry.get_height()) {
estimate.y = monitorGeometry.get_y() + monitorGeometry.get_height();
}
}
示例2: do_render
void EmblemCellRenderer::do_render(const Cairo::RefPtr<Cairo::Context>& context, int widget, int background_area, Gdk::Rectangle &cell_area, int flags) {
context->translate(cell_area.get_x(), cell_area.get_y());
context->rectangle(0, 0, cell_area.get_width(), cell_area.get_height());
context->clip();
// TODO: Incorporate padding
context->push_group();
if (!this->_icon_name.empty()) {
Glib::RefPtr<Gdk::Pixbuf> pixbuf = this->_get_pixbuf(this->_icon_name, this->_icon_size);
context->set_operator(Cairo::OPERATOR_SOURCE);
// Assumes square icons; may break if we don't get the requested size
int height_offset = int((cell_area.get_height() - pixbuf->get_height())/2);
Gdk::Cairo::set_source_pixbuf(context, pixbuf, 0, height_offset);
context->rectangle(0, height_offset,
pixbuf->get_width(), pixbuf->get_height());
context->fill();
if (this->_tint_color) {
Gdk::RGBA* c = this->_tint_color;
gushort r = c->get_red();
gushort g = c->get_green();
gushort b = c->get_blue();
// Figure out the difference between our tint colour and an
// empirically determined (i.e., guessed) satisfying luma and
// adjust the base colours accordingly
double luma = (r + r + b + g + g + g) / 6.;
double extra_luma = (1.2 - luma) / 3.;
r = std::min(r + extra_luma, 1.);
g = std::min(g + extra_luma, 1.);
b = std::min(b + extra_luma, 1.);
context->set_source_rgba(r, g, b, 0.4);
context->set_operator(Cairo::OPERATOR_ATOP);
context->paint();
}
if (!this->_emblem_name.empty()) {
Glib::RefPtr<Gdk::Pixbuf> pixbuf = this->_get_pixbuf(this->_emblem_name, this->_emblem_size);
int x_offset = this->_icon_size - this->_emblem_size;
context->set_operator(Cairo::OPERATOR_OVER);
Gdk::Cairo::set_source_pixbuf(context, pixbuf, x_offset, 0);
context->rectangle(x_offset, 0,
cell_area.get_width(), this->_emblem_size);
context->fill();
}
}
context->pop_group_to_source();
context->set_operator(Cairo::OPERATOR_OVER);
context->paint();
}
示例3: ChooseEntity
std::string EntityChooser::ChooseEntity(const std::string& preSelectedEntity)
{
gtkutil::Dialog dlg(_("Select Entity"), GlobalMainFrame().getTopLevelWindow());
Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow());
dlg.set_default_size(static_cast<int>(rect.get_width()/2), static_cast<int>(2*rect.get_height()/3));
// Instantiate a new chooser class
EntityChooserPtr chooser(new EntityChooser);
chooser->setSelectedEntity(preSelectedEntity);
// add this to the dialog window
IDialog::Handle handle = dlg.addElement(chooser);
if (dlg.run() == IDialog::RESULT_OK)
{
return dlg.getElementValue(handle);
}
else
{
// Cancelled
return "";
}
}
示例4: makeLUT
Gui_DisplayBaseClass::Gui_DisplayBaseClass(Gui_ProcessorHandler& processor_hand):
m_processor_hand(processor_hand),
m_deco(this,processor_hand,m_show_idx,m_show_point,m_ROI),
m_ROI(cv::Point(0,0),cv::Point(0,0)),
m_draw_result(false),
m_alph_mask(128),
m_show_idx(-1),m_show_point(false),m_show_mask(true),
m_cursor(Gdk::CROSS)
{
this->add_events( Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK );
this->signal_scroll_event().connect( sigc::mem_fun( *this, &Gui_DisplayBaseClass::on_scroll) );
this->signal_button_press_event().connect( sigc::mem_fun( *this, &Gui_DisplayBaseClass::on_click) );
m_color.set_rgb_p(0.2,0.2,0.2);
this->modify_bg(Gtk::STATE_NORMAL,m_color);
m_processor_hand.signal_state().connect( sigc::mem_fun(*this,&Gui_DisplayBaseClass::myRedraw));
Glib::RefPtr< Gdk::Screen > screen = Gdk::Screen::get_default();
Gdk::Rectangle rect;
screen->get_monitor_geometry(screen->get_primary_monitor(),rect);
set_size_request(rect.get_width()/4,rect.get_height()/4);
makeLUT();
}
示例5: GlobalMainFrame
// Construct the dialog
LightTextureChooser::LightTextureChooser()
: gtkutil::BlockingTransientWindow(_("Choose texture"), GlobalMainFrame().getTopLevelWindow()),
_selector(Gtk::manage(new ShaderSelector(this, getPrefixList(), true))) // true >> render a light texture
{
// Set the default size of the window
Gdk::Rectangle rect;
if (GlobalGroupDialog().getDialogWindow()->is_visible())
{
rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalGroupDialog().getDialogWindow());
}
else
{
rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow());
}
set_default_size(static_cast<int>(rect.get_width()*0.6f), static_cast<int>(rect.get_height()*0.6f));
// Construct main VBox, and pack in ShaderSelector and buttons panel
Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 6));
vbx->pack_start(*_selector, true, true, 0);
vbx->pack_start(createButtons(), false, false, 0);
add(*vbx);
}
示例6: drawButton
void ItemView::drawButton(const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Image* image, Gdk::Rectangle rect)
{
const Glib::RefPtr<Gdk::Pixbuf> icon = image->get_pixbuf();
const int iconLeft = rect.get_x() + (rect.get_width() * 0.5) - (icon->get_width() * 0.5);
const int iconTop = rect.get_y() + (rect.get_height() * 0.5) - (icon->get_height() * 0.5);
Gdk::Cairo::set_source_pixbuf(cr, icon, iconLeft, iconTop);
cr->rectangle(iconLeft, iconTop, icon->get_width(), icon->get_height());
cr->fill();
}
示例7: isHit
bool ItemView::isHit(GdkEventButton* event, Gdk::Rectangle& rect)
{
const int left = rect.get_x();
const int top = rect.get_y();
const int right = left + rect.get_width();
const int bottom = top + rect.get_height();
if (event->x > left && event->x < right)
if (event->y > top && event->y < bottom)
return true;
return false;}
示例8:
void sourceview___::scroll2__(SourceView*sv,Gtk::TextIter ti){
RefPtr<Gtk::TextBuffer> tb=sv->get_buffer();
tb->place_cursor(ti);
Gtk::TextBuffer::iterator i1,i2;
tb->get_selection_bounds(i1,i2);
Gdk::Rectangle rect;
sv->get_visible_rect(rect);
int y = -1;
int height = -1;
sv->get_line_yrange(i1, y, height);
if (y < rect.get_y() + rect.get_height() + 16)
sv->scroll_to_mark(tb->get_insert(), 0);
}
示例9: sample_width
void
studio::render_gradient_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::Gradient &gradient)
{
int height = ca.get_height();
int width = ca.get_width()-4;
float sample_width(1.0f/(float)width);
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(window));
const Color bg1(0.25, 0.25, 0.25);
const Color bg2(0.5, 0.5, 0.5);
Gdk::Color gdk_c;
int i;
for(i=0;i<width;i++)
{
const Color c(gradient(float(i)/float(width),sample_width));
const Color c1(Color::blend(c,bg1,1.0).clamped());
const Color c2(Color::blend(c,bg2,1.0).clamped());
gushort r1(256*App::gamma.r_F32_to_U8(c1.get_r()));
gushort g1(256*App::gamma.g_F32_to_U8(c1.get_g()));
gushort b1(256*App::gamma.b_F32_to_U8(c1.get_b()));
gushort r2(256*App::gamma.r_F32_to_U8(c2.get_r()));
gushort g2(256*App::gamma.g_F32_to_U8(c2.get_g()));
gushort b2(256*App::gamma.b_F32_to_U8(c2.get_b()));
if((i*2/height)&1)
{
gdk_c.set_rgb(r1,g1,b1);
gc->set_rgb_fg_color(gdk_c);
window->draw_rectangle(gc, true, ca.get_x()+i+2, ca.get_y(), 1, height/2);
gdk_c.set_rgb(r2,g2,b2);
gc->set_rgb_fg_color(gdk_c);
window->draw_rectangle(gc, true, ca.get_x()+i+2, ca.get_y()+height/2, 1, height/2);
}
else
{
gdk_c.set_rgb(r2,g2,b2);
gc->set_rgb_fg_color(gdk_c);
window->draw_rectangle(gc, true, ca.get_x()+i+2, ca.get_y(), 1, height/2);
gdk_c.set_rgb(r1,g1,b1);
gc->set_rgb_fg_color(gdk_c);
window->draw_rectangle(gc, true, ca.get_x()+i+2, ca.get_y()+height/2, 1, height/2);
}
}
gc->set_rgb_fg_color(Gdk::Color("#ffffff"));
window->draw_rectangle(gc, false, ca.get_x()+1, ca.get_y()+1, ca.get_width()-3, height-3);
gc->set_rgb_fg_color(Gdk::Color("#000000"));
window->draw_rectangle(gc, false, ca.get_x(), ca.get_y(), ca.get_width()-1, height-1);
}
示例10: GlobalMainFrame
MD5AnimationViewer::MD5AnimationViewer() :
gtkutil::BlockingTransientWindow(_("MD5 Animation Viewer"), GlobalMainFrame().getTopLevelWindow()),
_modelList(Gtk::TreeStore::create(_modelColumns)),
_modelPopulator(_modelList),
_animList(Gtk::ListStore::create(_animColumns)),
_preview(new AnimationPreview)
{
// Set the default border width in accordance to the HIG
set_border_width(12);
set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
// Set the default size of the window
const Glib::RefPtr<Gtk::Window>& mainWindow = GlobalMainFrame().getTopLevelWindow();
Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow);
int height = static_cast<int>(rect.get_height() * 0.6f);
set_default_size(
static_cast<int>(rect.get_width() * 0.8f), height
);
// Set the default size of the window
_preview->setSize(rect.get_width() * 0.2f, height);
// Main dialog vbox
Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12));
// Create a horizontal box to pack the treeview on the left and the preview on the right
Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6));
hbox->pack_start(createListPane(), true, true, 0);
Gtk::VBox* previewBox = Gtk::manage(new Gtk::VBox(false, 0));
previewBox->pack_start(*_preview, true, true, 0);
hbox->pack_start(*previewBox, true, true, 0);
vbox->pack_start(*hbox, true, true, 0);
vbox->pack_end(createButtons(), false, false, 0);
// Add main vbox to dialog
add(*vbox);
// Populate with model names
populateModelList();
}
示例11: dibujar
bool GraficoDeTorta::dibujar(const Cairo::RefPtr<Cairo::Context>& contexto){
Gdk::Rectangle rect = dibujo->get_allocation();
Pango::FontDescription font;
font.set_family("Monospace");
font.set_weight(Pango::WEIGHT_BOLD);
if(stock.size() == 0) return false;
contexto->set_source_rgb(1.0,1.0,1.0);
contexto->paint();
int total = 0;
for(unsigned int i = 0; i < stock.size(); i++){
total += stock[i].second;
}
float step = 2*M_PI/total;
total = 0;
float angulo0=0;
for(unsigned int i = 0; i < stock.size(); i++){
float angulo1 = step*stock[i].second + angulo0;
dibujarArco(contexto,rect.get_width()/2-rect.get_width()/4,rect.get_height()/2,rect.get_width()<rect.get_height()?rect.get_width()/4:rect.get_height()/4,angulo0,angulo1,red[i],green[i],blue[i]);
angulo0 = angulo1;
}
Glib::RefPtr<Pango::Layout> layout;
std::stringstream s;
for(unsigned int i = 0; i < stock.size(); i++){
s.str("");
s << stock[i].first << "\t" << stock[i].second;
layout = dibujo->create_pango_layout(s.str());
layout -> set_font_description(font);
int t_width, t_height;
layout->get_pixel_size(t_width,t_height);
contexto->set_source_rgb(0,0,0);
contexto -> move_to((rect.get_width())/2,15*(i+1)+5);
layout -> show_in_cairo_context(contexto);
contexto -> set_source_rgb(red[i],green[i],blue[i]);
contexto -> rectangle(rect.get_width()/2+80,15*(i+1)+5,30,15);
contexto -> fill();
}
return true;
}
示例12: insert__
int textview___::insert__(std::deque<Glib::ustring>* p,size_t start){
Gtk::TextView* tv=tv__(p,1+start);
if(!tv){
return 1;
}
int i=0;
size_t i_ctl=3+start;
if(p->size()>i_ctl){
if((*p)[i_ctl]=="头")
i=1;
else if((*p)[i_ctl]=="尾")
i=2;
else{
d_(sh_,err_show_buzhichi_,2,p,i_ctl);
return 1;
}
}
Glib::RefPtr < Gtk::TextBuffer > tb = tv->get_buffer();
Gtk::TextBuffer::iterator i1,i2;
switch(i){
case 1:
i1=tb->begin();
break;
case 2:
i1=tb->end();
break;
default:
tb->get_selection_bounds(i1,i2);
if(i2>i1){
i1=tb->erase(i1,i2);
}
break;
}
Gdk::Rectangle rect;
tv->get_visible_rect(rect);
int y = -1;
int height = -1;
tv->get_line_yrange(i1, y, height);
tb->place_cursor(tb->insert(i1, (*p)[2+start]));
if (y < rect.get_y() + rect.get_height() + 16)
tv->scroll_to_mark(tb->get_insert(), 0);
return 1;
}
示例13: GlobalMainFrame
ParticlesChooser::ParticlesChooser() :
gtkutil::BlockingTransientWindow(_("Choose particles"), GlobalMainFrame().getTopLevelWindow()),
_particlesList(Gtk::ListStore::create(COLUMNS())),
_selectedParticle(""),
_preview(new gtkutil::ParticlePreview)
{
set_border_width(12);
// Set the default size of the window
const Glib::RefPtr<Gtk::Window>& mainWindow = GlobalMainFrame().getTopLevelWindow();
Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow);
int height = static_cast<int>(rect.get_height() * 0.6f);
set_default_size(
static_cast<int>(rect.get_width() * 0.4f), height
);
// Set the default size of the window
_preview->setSize(rect.get_width() * 0.2f, height);
// Main dialog vbox
Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12));
// Create a horizontal box to pack the treeview on the left and the preview on the right
Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6));
hbox->pack_start(createTreeView(), true, true, 0);
Gtk::VBox* previewBox = Gtk::manage(new Gtk::VBox(false, 0));
previewBox->pack_start(*_preview, true, true, 0);
hbox->pack_start(*previewBox, true, true, 0);
vbox->pack_start(*hbox, true, true, 0);
vbox->pack_end(createButtons(), false, false, 0);
// Add main vbox to dialog
add(*vbox);
}
示例14: GlobalMainFrame
// Constructor
SoundChooser::SoundChooser() :
BlockingTransientWindow(_("Choose sound"), GlobalMainFrame().getTopLevelWindow()),
_treeStore(Gtk::TreeStore::create(_columns)),
_treeView(NULL),
_preview(Gtk::manage(new SoundShaderPreview))
{
set_border_width(12);
set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
// Set the default size of the window
Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow());
set_default_size(rect.get_width() / 2, rect.get_height() / 2);
// Main vbox
Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 12));
vbx->pack_start(createTreeView(), true, true, 0);
vbx->pack_start(*_preview, false, false, 0);
vbx->pack_start(createButtons(), false, false, 0);
add(*vbx);
}
示例15: if
bool
on_event(GdkEvent *event)
{
switch(event->type)
{
case GDK_SCROLL:
if(mimic_tree_view)
{
if(event->scroll.direction==GDK_SCROLL_DOWN)
{
mimic_tree_view->get_vadjustment()->set_value(
std::min(
mimic_tree_view->get_vadjustment()->get_value()+
mimic_tree_view->get_vadjustment()->get_step_increment(),
mimic_tree_view->get_vadjustment()->get_upper()-
mimic_tree_view->get_vadjustment()->get_page_size()
)
);
mimic_tree_view->get_vadjustment()->value_changed();
}
else if(event->scroll.direction==GDK_SCROLL_UP)
{
mimic_tree_view->get_vadjustment()->set_value(
std::max(
mimic_tree_view->get_vadjustment()->get_value()-
mimic_tree_view->get_vadjustment()->get_step_increment(),
mimic_tree_view->get_vadjustment()->get_lower()
)
);
mimic_tree_view->get_vadjustment()->value_changed();
}
}
break;
case GDK_BUTTON_PRESS:
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
if(!get_path_at_pos(
int(event->button.x),int(event->button.y), // x, y
path, // TreeModel::Path&
column, //TreeViewColumn*&
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
const Gtk::TreeRow row = *(get_model()->get_iter(path));
if(column && column->get_first_cell_renderer()==cellrenderer_time_track)
{
Gdk::Rectangle rect;
get_cell_area(path,*column,rect);
cellrenderer_time_track->property_value_desc()=row[model.value_desc];
cellrenderer_time_track->property_canvas()=row[model.canvas];
cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState());
queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
return true;
//return signal_param_user_click()(event->button.button,row,COLUMNID_TIME_TRACK);
}
}
break;
case GDK_MOTION_NOTIFY:
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
if(!get_path_at_pos(
(int)event->motion.x,(int)event->motion.y, // x, y
path, // TreeModel::Path&
column, //TreeViewColumn*&
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
if(!get_model()->get_iter(path))
break;
Gtk::TreeRow row = *(get_model()->get_iter(path));
if ((event->motion.state&GDK_BUTTON1_MASK || event->motion.state&GDK_BUTTON3_MASK) &&
column &&
cellrenderer_time_track == column->get_first_cell_renderer())
{
Gdk::Rectangle rect;
get_cell_area(path,*column,rect);
cellrenderer_time_track->property_value_desc()=row[model.value_desc];
cellrenderer_time_track->property_canvas()=row[model.canvas];
cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState());
queue_draw();
//queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
return true;
}
/* else
if(last_tooltip_path.get_depth()<=0 || path!=last_tooltip_path)
{
tooltips_.unset_tip(*this);
Glib::ustring tooltips_string(row[layer_model.tooltip]);
last_tooltip_path=path;
if(!tooltips_string.empty())
{
//.........这里部分代码省略.........