本文整理汇总了C++中gdk::Rectangle类的典型用法代码示例。如果您正苦于以下问题:C++ Rectangle类的具体用法?C++ Rectangle怎么用?C++ Rectangle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insert_bug
bool BugzillaNoteAddin::insert_bug(int x, int y, const std::string & uri, int id)
{
try {
BugzillaLink::Ptr link_tag =
BugzillaLink::Ptr::cast_dynamic(get_note()->get_tag_table()->create_dynamic_tag(TAG_NAME));
link_tag->set_bug_url(uri);
// Place the cursor in the position where the uri was
// dropped, adjusting x,y by the TextView's VisibleRect.
Gdk::Rectangle rect;
get_window()->editor()->get_visible_rect(rect);
x = x + rect.get_x();
y = y + rect.get_y();
Gtk::TextIter cursor;
gnote::NoteBuffer::Ptr buffer = get_buffer();
get_window()->editor()->get_iter_at_location(cursor, x, y);
buffer->place_cursor (cursor);
std::string string_id = boost::lexical_cast<std::string>(id);
buffer->undoer().add_undo_action (new InsertBugAction (cursor,
string_id,
link_tag));
std::vector<Glib::RefPtr<Gtk::TextTag> > tags;
tags.push_back(link_tag);
buffer->insert_with_tags (cursor,
string_id,
tags);
return true;
}
catch (...)
{
}
return false;
}
示例2: 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);
}
示例3: 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();
}
示例4: 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 "";
}
}
示例5: 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();
}
示例6: 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;}
示例7: change
void LinkHints::change(ElementProperty *prop) {
bool ch = false;
Gdk::Rectangle r = prop->parent->drawRect();
for(iterator h = begin(); h != end(); h++)
if((*h)->prop == prop) {
(*h)->updateText();
ch = true;
}
if(ch) {
r.join(prop->parent->drawRect());
prop->parent->parent->on_redraw_rect.run(&r);
}
}
示例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: 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();
}
示例10: GlobalMainFrame
// Create GTK stuff in c-tor
OverlayDialog::OverlayDialog() :
PersistentTransientWindow(_(DIALOG_TITLE), GlobalMainFrame().getTopLevelWindow(), true),
_callbackActive(false)
{
set_border_width(12);
// Set default size
Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow());
set_default_size(static_cast<int>(rect.get_width()/3), -1);
// Pack in widgets
Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12));
vbox->pack_start(createWidgets(), true, true, 0);
vbox->pack_end(createButtons(), false, false, 0);
add(*vbox);
}
示例11: 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;
}
示例12: queueDrawIfNeccesary
bool MouseAwareTreeView::queueDrawIfNeccesary(int32_t x, int32_t y, Glib::ustring* pPath)
{
Gtk::TreeModel::Path mousePath;
Gtk::TreeViewColumn* pColumn;
Gdk::Rectangle rect;
convert_bin_window_to_widget_coords (x, y, m_MouseInfo.x, m_MouseInfo.y);
if (get_path_at_pos(x, y, mousePath, pColumn, x, y))
{
int32_t offsetX, offsetY;
convert_bin_window_to_widget_coords(0, 0, offsetX, offsetY);
m_MouseInfo.x -= offsetX;
m_MouseInfo.y -= offsetY;
get_cell_area(mousePath, *pColumn, rect);
queue_draw_area(rect.get_x() + offsetX, rect.get_y() + offsetY, rect.get_width(), rect.get_height());
if (rect.get_y() != m_CurrentCell)
{
m_CurrentCell = rect.get_y();
m_CellChanged = true;
}
if (pPath)
{
*pPath = mousePath.to_string();
}
return true;
}
return false;
}
示例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: getObjectAtPos
bool LinkHints::getObjectAtPos(gdouble x, gdouble y, ObjectType *obj) {
for(iterator h = begin(); h != end(); h++) {
Gdk::Rectangle r = (*h)->drawRect();
if(x >= r.get_x() && y >= r.get_y() && x <= r.get_x() + r.get_width() && y <= r.get_y() + r.get_height()) {
*obj = ObjectType(*h);
return true;
}
}
return false;
}