Example #1
0
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);
}
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();
}