本文整理汇总了C++中gtk::Container::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Container::add方法的具体用法?C++ Container::add怎么用?C++ Container::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk::Container
的用法示例。
在下文中一共展示了Container::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constructDeltaChooseScale
void MainWindow::constructDeltaChooseScale(Gtk::Container &parentContainer) {
deltaChooseLabel.set_text("Delta:");
parentContainer.add(deltaChooseLabel);
deltaChooseScale.set_adjustment(Gtk::Adjustment::create(0, 0, 10, 1, 1));
deltaChooseScale.set_digits(0);
deltaChooseScale.set_size_request(100);
parentContainer.add(deltaChooseScale);
}
示例2: constructBrushSizeScale
void MainWindow::constructBrushSizeScale(Gtk::Container &parentContainer) {
brushSizeLabel.set_text("Brush size:");
parentContainer.add(brushSizeLabel);
brushSizeScale.set_adjustment(Gtk::Adjustment::create(30, 1, 75, 1, 5));
brushSizeScale.set_digits(0);
brushSizeScale.set_size_request(100);
parentContainer.add(brushSizeScale);
}
示例3: constructScale
void MainWindow::constructScale(Gtk::Container &parentContainer, Gtk::Scale &scale, Gtk::Label &label, const std::string &name) {
label.set_text(name + ":");
parentContainer.add(label);
scale.set_adjustment(Gtk::Adjustment::create(1.0, -10000.0, 150000.0, 10.0, 1.0));
scale.set_digits(4);
scale.set_size_request(100);
scale.signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::on_scale_value_changed));
parentContainer.add(scale);
}
示例4: constructModeChooseComboBox
void MainWindow::constructModeChooseComboBox(Gtk::Container &parentContainer) {
modeChooseLabel.set_text("Mode:");
parentContainer.add(modeChooseLabel);
for (std::vector<std::string>::iterator mode = modes.begin(); mode != modes.end(); ++mode) {
modeChooseComboBox.append(*mode);
}
modeChooseComboBox.signal_changed().connect(sigc::mem_fun(*this, &MainWindow::on_modeChooseComboBox_changed));
modeChooseComboBox.set_active(0);
parentContainer.add(modeChooseComboBox);
}
示例5: constructGUIComponents
void CamWnd::constructGUIComponents()
{
constructToolbar();
// Set up GL widget
_camGLWidget->set_events( Gdk::EXPOSURE_MASK
| Gdk::BUTTON_PRESS_MASK
| Gdk::BUTTON_RELEASE_MASK
| Gdk::POINTER_MOTION_MASK
| Gdk::SCROLL_MASK);
_camGLWidget->set_flags(Gtk::CAN_FOCUS);
_camGLWidget->set_size_request(CAMWND_MINSIZE_X, CAMWND_MINSIZE_Y);
_camGLWidget->property_can_focus() = true;
_camGLWidget->signal_size_allocate().connect(
sigc::mem_fun(*this, &CamWnd::onSizeAllocate)
);
_camGLWidget->signal_expose_event().connect(
sigc::mem_fun(*this, &CamWnd::onExpose)
);
// Pack GL widget into outer widget
Gtk::Container* glWidgetFrame = gladeWidget<Gtk::Container>(
"glWidgetFrame"
);
glWidgetFrame->add(*_camGLWidget);
}
示例6: onWindowStateEvent
bool CamWnd::onWindowStateEvent(GdkEventWindowState* ev)
{
if ((ev->changed_mask & (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_WITHDRAWN)) != 0)
{
// Now let's see what the new state of the window is
if ((ev->new_window_state & (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_WITHDRAWN)) == 0)
{
// Window got maximised again, re-add the GL widget to fix it from going gray
Gtk::Widget* glWidget = getWidget();
// greebo: Unfortunate hack to fix the grey GL renderviews in Win32
Gtk::Container* container = glWidget->get_parent();
if (container != NULL)
{
glWidget->reference();
container->remove(*glWidget);
container->add(*glWidget);
glWidget->unreference();
}
}
}
return false;
}
示例7: PackTrackWindow
void PackTrackWindow(Gtk::Container& contr, TWFunctor tw_fnr)
{
Gtk::VPaned& vpaned = *Gtk::manage(new Gtk::VPaned);
contr.add(vpaned);
Timeline::DAMonitor& mon = *Gtk::manage(new Timeline::DAMonitor);
#ifdef VOB_MVIEWER_INTRUSION
{
Mpeg::Player& plyr = mon.GetPlayer();
Bunch& bunch = Bunch::Instance();
//const char* dvd_path = "/mnt/ntfs/DVD_Demystified";
const char* dvd_path = "/media/cdrom";
bunch.dvd = DVDOpen(dvd_path);
bunch.wrp = new DtorAction(bl::bind(&DVDClose, bunch.dvd));
DVD::FillVobArr(bunch.dvd_vobs, bunch.dvd);
DVD::VobPtr vob = DVD::FindVob(bunch.dvd_vobs, 1, 1); //34, 1);
ptr::shared<DVD::VobStreambuf> strm_buf = new DVD::VobStreambuf(vob, bunch.dvd);
io::cout << "Vob size = " << strm_buf->Size() << io::endl;
plyr.OpenFBuf(strm_buf);
}
#endif // VOB_MVIEWER_INTRUSION
TrackLayout& layout = *Gtk::manage(new TrackLayout(mon));
{
Gtk::VBox& vbox = *Gtk::manage(new Gtk::VBox);
vpaned.add1(vbox);
Gtk::HPaned& hpaned = *Gtk::manage(new Gtk::HPaned);
SetUpdatePos(hpaned, UnnamedPrefs().srcBrw1Wdh);
vbox.pack_start(hpaned, true, true, 0);
tw_fnr(hpaned, mon, layout);
Gtk::HSeparator& hsep = *Gtk::manage(new Gtk::HSeparator);
vbox.pack_end(hsep, false, true, 0);
}
// 2 шкала
PackTrackLayout(vpaned, layout);
// 3 приведение к гармоничной форме
gtk_container_child_set(vpaned.Gtk::Container::gobj(),
vpaned.get_child1()->gobj(), "resize", TRUE, NULL);
gtk_container_child_set(vpaned.Gtk::Container::gobj(),
vpaned.get_child2()->gobj(), "resize", FALSE, NULL);
vpaned.signal_realize().connect(bb::bind(&SetGarmonicHeightForTrk, boost::ref(vpaned)));
}
示例8: init
void VRGuiVectorEntry::init(string placeholder, string label, sigc::slot<void, OSG::Vec3f&> sig) {
Gtk::Fixed* ph;
VRGuiBuilder()->get_widget(placeholder.c_str(), ph);
Gtk::Container* frame = ph->get_parent();
frame->remove(*ph);
Gtk::HBox* hb = new Gtk::HBox();
frame->add(*hb);
Gtk::Label* lbl = new Gtk::Label();
lbl->set_text(label.c_str());
lbl->set_size_request(50, -1);
ex = new Gtk::Entry();
ey = new Gtk::Entry();
ez = new Gtk::Entry();
ex->set_has_frame(false);
ey->set_has_frame(false);
ez->set_has_frame(false);
ex->set_size_request(50, -1);
ey->set_size_request(50, -1);
ez->set_size_request(50, -1);
Gtk::VSeparator *s1, *s2, *s3;
s1 = new Gtk::VSeparator();
s2 = new Gtk::VSeparator();
s3 = new Gtk::VSeparator();
hb->pack_start(*lbl, false, false, 2);
hb->pack_start(*s1, false, false, 0);
hb->pack_start(*ex, false, false, 0);
hb->pack_start(*s2, false, false, 0);
hb->pack_start(*ey, false, false, 0);
hb->pack_start(*s3, false, false, 0);
hb->pack_start(*ez, false, false, 0);
frame->show_all();
sigc::slot<bool,GdkEventFocus*> sif = sigc::bind(&VRGuiVectorEntry::proxy, sig, ex, ey, ez);
ex->signal_focus_out_event().connect( sif );
ey->signal_focus_out_event().connect( sif );
ez->signal_focus_out_event().connect( sif );
sigc::slot<bool> sia_b = sigc::bind<GdkEventFocus*>(&VRGuiVectorEntry::proxy, 0, sig, ex, ey, ez);
sigc::slot<void> sia = sigc::hide_return( sia_b );
ex->signal_activate().connect(sia);
ey->signal_activate().connect(sia);
ez->signal_activate().connect(sia);
}
示例9: add
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL, 6),
m_Button_Quit(Gtk::Stock::QUIT),
m_Button_Clear("Clear")
{
set_title("Gtk::InfoBar example");
set_border_width(6);
set_default_size(400, 200);
add(m_VBox);
// Add the message label to the InfoBar:
Gtk::Container* infoBarContainer =
dynamic_cast<Gtk::Container*>(m_InfoBar.get_content_area());
if (infoBarContainer)
infoBarContainer->add(m_Message_Label);
// Add an ok button to the InfoBar:
m_InfoBar.add_button(Gtk::Stock::OK, 0);
// Add the InfoBar to the vbox:
m_VBox.pack_start(m_InfoBar, Gtk::PACK_SHRINK);
// Create the buffer and set it for the TextView:
m_refTextBuffer = Gtk::TextBuffer::create();
m_TextView.set_buffer(m_refTextBuffer);
// Add the TreeView, inside a ScrolledWindow:
m_ScrolledWindow.add(m_TextView);
// Show the scrollbars only when they are necessary:
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
m_VBox.pack_start(m_ScrolledWindow);
// Add button box:
m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);
m_ButtonBox.pack_start(m_Button_Clear, Gtk::PACK_SHRINK);
m_ButtonBox.pack_start(m_Button_Quit, Gtk::PACK_SHRINK);
m_ButtonBox.set_spacing(6);
m_ButtonBox.set_layout(Gtk::BUTTONBOX_END);
// Connect signals:
m_InfoBar.signal_response().connect(sigc::mem_fun(*this,
&ExampleWindow::on_infobar_response) );
m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_quit) );
m_Button_Clear.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_clear) );
m_refTextBuffer->signal_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_textbuffer_changed) );
show_all_children();
// Keep the InfoBar hidden until a message needs to be shown:
m_InfoBar.hide();
// Make the clear button insensitive until text is typed in the buffer. When
// the button is sensitive and it is pressed, the InfoBar is displayed with a
// message.
m_Button_Clear.set_sensitive(false);
}
示例10:
BookReader::BookReader() :
m_popover(m_book_area),
m_popover_label("Go to page:"),
m_popover_box(Gtk::ORIENTATION_HORIZONTAL, 12)
{
//sort out signal handlers.
info_bar_hide_dispatcher.connect(sigc::mem_fun(*this, &BookReader::info_bar_hide));
set_orientation(ORIENTATION_VERTICAL);
m_infobar_label.set_text("");
m_infobar_box.set_orientation(ORIENTATION_HORIZONTAL);
m_infobar_box.set_spacing(12);
m_infobar_box.pack_start(m_infobar_spinner);
m_infobar_box.pack_start(m_infobar_label);
m_infobar_box.show_all();
Gtk::Container * infoBarContainer =
dynamic_cast<Gtk::Container *>(m_infobar.get_content_area());
if (infoBarContainer) {
infoBarContainer->add(m_infobar_box);
}
m_infobar.set_no_show_all(true);
m_infobar.set_show_close_button(true);
m_infobar.signal_response().connect(sigc::mem_fun( *this, &BookReader::on_infobar_response) );
pack_start(m_infobar, Gtk::PACK_SHRINK);
m_book_area.set_hexpand(true);
m_box.pack_start(m_book_area);
m_box.set_border_width(15);
pack_start(m_box);
//m_entry.set_max_length(10);
m_popover_entry.set_width_chars(4);
m_popover_entry.set_max_width_chars(4);
m_popover_entry.set_text("");
m_popover_entry.signal_activate().connect(sigc::mem_fun(*this, &BookReader::on_goto_page));
m_popover_box.set_vexpand(true);
m_popover_box.set_hexpand(true);
m_popover_box.pack_start(m_popover_label);
m_popover_box.pack_start(m_popover_entry);
m_popover_box.show_all();
//m_popover.add_label("Sup holmes");
m_popover.add(m_popover_box);
m_popover.set_position(Gtk::POS_LEFT);
m_popover.set_border_width(8);
m_popover.set_modal(true);
//m_popover.set_visible(true);
auto stylecontext = m_popover.get_style_context();
stylecontext->add_class(GTK_STYLE_CLASS_INFO);
if(!pages.finished_loading()) {
info_bar_loading();
}
else {
info_bar_hide();
}
}
示例11: constructLayout
void SplitPaneLayout::constructLayout()
{
_splitPane = SplitPaneView();
_cameraPosition = getCameraPositionFromRegistry();
const Glib::RefPtr<Gtk::Window>& parent = GlobalMainFrame().getTopLevelWindow();
// Create a new camera window and parent it
_camWnd = GlobalCamera().createCamWnd();
// greebo: The mainframe window acts as parent for the camwindow
_camWnd->setContainer(parent);
_camera = Gtk::manage(new gtkutil::FramedWidget(*_camWnd->getWidget()));
// Allocate paned widgets
_splitPane.horizPane.reset(new Gtk::HPaned);
_splitPane.vertPane1 = Gtk::manage(new Gtk::VPaned);
_splitPane.vertPane2 = Gtk::manage(new Gtk::VPaned);
// Arrange the widgets into the paned views
_splitPane.horizPane->pack1(*_splitPane.vertPane1, true, true);
_splitPane.horizPane->pack2(*_splitPane.vertPane2, true, true);
// Retrieve the main container of the main window
Gtk::Container* mainContainer = GlobalMainFrame().getMainContainer();
mainContainer->add(*_splitPane.horizPane);
_splitPane.horizPane->set_position(200);
_splitPane.vertPane1->set_position(200);
_splitPane.vertPane2->set_position(400);
_splitPane.posHPane.connect(_splitPane.horizPane.get());
_splitPane.posVPane1.connect(_splitPane.vertPane1);
_splitPane.posVPane2.connect(_splitPane.vertPane2);
// Attempt to restore this layout's state, this will also construct the orthoviews
restoreStateFromPath(RKEY_SPLITPANE_ROOT);
// Distribute widgets among quadrants
distributeWidgets();
{
Gtk::Frame* textureBrowser = Gtk::manage(new gtkutil::FramedWidget(
*GlobalTextureBrowser().constructWindow(parent)
));
// Add the Media Browser page
GlobalGroupDialog().addPage(
"textures", // name
"Textures", // tab title
"icon_texture.png", // tab icon
*textureBrowser, // page widget
_("Texture Browser")
);
}
GlobalGroupDialog().showDialogWindow();
// greebo: Now that the dialog is shown, tell the Entity Inspector to reload
// the position info from the Registry once again.
GlobalEntityInspector().restoreSettings();
GlobalGroupDialog().hideDialogWindow();
mainContainer->show_all();
}
示例12: constructExitButton
void MainWindow::constructExitButton(Gtk::Container &parentContainer) {
exitButton.set_label("Exit");
parentContainer.add(exitButton);
}
示例13: constructSaveButton
void MainWindow::constructSaveButton(Gtk::Container &parentContainer) {
saveButton.set_label("Save");
saveButton.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_saveButton_clicked) );
parentContainer.add(saveButton);
}
示例14: constructOpenButton
void MainWindow::constructOpenButton(Gtk::Container &parentContainer) {
openButton.set_label("Open");
openButton.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_openButton_clicked));
parentContainer.add(openButton);
}
示例15: constructPlayButton
void MainWindow::constructPlayButton(Gtk::Container &parentContainer) {
playButton.set_label("Play");
playButton.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_playButton_clicked));
playButton.set_sensitive(false);
parentContainer.add(playButton);
}