// Main constructor
ModalProgressDialog::ModalProgressDialog(const Glib::RefPtr<Gtk::Window>& parent, const std::string& title)
: gtkutil::TransientWindow(title, GlobalMainFrame().getTopLevelWindow()),
  _label(Gtk::manage(new Gtk::Label)),
  _progressBar(Gtk::manage(new Gtk::ProgressBar)),
  _aborted(false)
{
  	// Window properties
	set_modal(true);
	set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
	set_default_size(360, 80);
	set_border_width(12);

	// Create a vbox
	Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 12));

	// Pack a progress bar into the window
	vbx->pack_start(*_progressBar, false, false, 0);

	// Pack the label into the window
	vbx->pack_start(*_label, true, false, 0);
	add(*vbx);

	// Pack a right-aligned cancel button at the bottom
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onCancel));

	vbx->pack_end(*Gtk::manage(new gtkutil::RightAlignment(*cancelButton)), false, false, 0);

	// Connect the realize signal to remove the window decorations
	signal_realize().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onRealize));

	// Show the window
	show_all();
	handleEvents();
}
Esempio n. 2
0
/**
	Creates a connection dialog. This will change pointers to strings and int
	representing the connection. Mainly user, host and port. The final values of
	the pointers will be assigned when the dialog will be closed.
	
	\param[in,out] u Pointer on the username
	\param[in,out] pw Pointer on the password
	\param[in,out] h Pointer on the host
	\param[in,out] p Pointer on the port
*/
DialogConnect::DialogConnect(std::string *u, std::string *pw, std::string *h, int *p) {
	user = u;
	host = h;
	port = p;
	pass = pw;
	
	Gtk::VBox *layout = Gtk::manage(new Gtk::VBox);
	
	Glib::RefPtr<Gtk::Adjustment> adj = Gtk::Adjustment::create(*p, 0, 65535, 1);
	portSpinButton = Gtk::manage(new Gtk::SpinButton(adj));
	
	okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	
	userEntry = Gtk::manage(new Gtk::Entry());
	userEntry->set_text(*u);
	
	passEntry = Gtk::manage(new Gtk::Entry());
	passEntry->set_visibility(false);
	passEntry->set_text(*pw);
	
	hostEntry = Gtk::manage(new Gtk::Entry());
	hostEntry->set_text(*h);
	
	Gtk::Label* ul = Gtk::manage(new Gtk::Label("Username : "******"Password : "******"Hostname : "));
	Gtk::Label* pl = Gtk::manage(new Gtk::Label("Port     : "));
	
	Gtk::HBox *h1 = Gtk::manage(new Gtk::HBox());
	Gtk::HBox *h2 = Gtk::manage(new Gtk::HBox());
	Gtk::HBox *h3 = Gtk::manage(new Gtk::HBox());
	Gtk::HBox *h4 = Gtk::manage(new Gtk::HBox());
	
	h1->add(*ul);
	h1->add(*userEntry);
	
	h4->add(*pwl);
	h4->add(*passEntry);
	
	h2->add(*hl);
	h2->add(*hostEntry);
	
	h3->add(*pl);
	h3->add(*portSpinButton);
	
	layout->pack_start(*h1, Gtk::PACK_SHRINK);
	layout->pack_start(*h4, Gtk::PACK_SHRINK);
	layout->pack_start(*h2, Gtk::PACK_SHRINK);
	layout->pack_start(*h3, Gtk::PACK_SHRINK);
	layout->pack_end(*okButton, Gtk::PACK_SHRINK);
	
	remove();
	add(*layout);
	
	okButton->signal_clicked().connect(sigc::mem_fun(*this, &DialogConnect::onOk));
	passEntry->signal_activate().connect(sigc::mem_fun(*this, &DialogConnect::onOk));
	hostEntry->signal_activate().connect(sigc::mem_fun(*this, &DialogConnect::onOk));
	
	show_all();
}
Esempio n. 3
0
MainWindow::MainWindow()
{
	set_default_size(600, 400);
	toggling_show_menubar = App::enable_mainwin_menubar;

	main_dock_book_ = manage(new DockBook());
	main_dock_book_->allow_empty = true;
	main_dock_book_->show();

	class Bin : public Gtk::Bin {
	public:
		Bin() { }
	protected:
		void on_size_allocate(Gtk::Allocation &allocation) {
			Gtk::Bin::on_size_allocate(allocation);
			if (get_child() != NULL)
				get_child()->size_allocate(allocation);
		}
	};

	bin_ = manage((Gtk::Bin*)new Bin());
	bin_->add(*main_dock_book_);
	bin_->show();

	Gtk::VBox *vbox = manage(new Gtk::VBox());

	Gtk::Widget* menubar = App::ui_manager()->get_widget("/menubar-main");
	if (menubar != NULL)
	{
		vbox->pack_start(*menubar, false, false, 0);
	}

	vbox->pack_end(*bin_, true, true, 0);
	vbox->show();
	if(!App::enable_mainwin_menubar) menubar->hide();

	add(*vbox);

	add_accel_group(App::ui_manager()->get_accel_group());

	init_menus();
	window_action_group = Gtk::ActionGroup::create("mainwindow-recentfiles");
	App::ui_manager()->insert_action_group(window_action_group);

	App::signal_recent_files_changed().connect(
		sigc::mem_fun(*this, &MainWindow::on_recent_files_changed) );

	signal_delete_event().connect(
		sigc::ptr_fun(App::shutdown_request) );

	App::dock_manager->signal_dockable_registered().connect(
		sigc::mem_fun(*this,&MainWindow::on_dockable_registered) );

	App::dock_manager->signal_dockable_unregistered().connect(
		sigc::mem_fun(*this,&MainWindow::on_dockable_unregistered) );

	GRAB_HINT_DATA("mainwindow");
}
Gtk::Widget& SoundShaderPreview::createControlPanel()
{
	Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 6));
	vbox->set_size_request(200, -1);

	// Create the playback button
	_playButton = Gtk::manage(new Gtk::Button(Gtk::Stock::MEDIA_PLAY));
	_stopButton = Gtk::manage(new Gtk::Button(Gtk::Stock::MEDIA_STOP));

	_playButton->signal_clicked().connect(sigc::mem_fun(*this, &SoundShaderPreview::onPlay));
	_stopButton->signal_clicked().connect(sigc::mem_fun(*this, &SoundShaderPreview::onStop));

	Gtk::HBox* btnHBox = Gtk::manage(new Gtk::HBox(true, 6));

	btnHBox->pack_start(*_playButton, true, true);
	btnHBox->pack_start(*_stopButton, true, true);

	vbox->pack_end(*btnHBox, false, false);

	_statusLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(""));
	vbox->pack_end(*_statusLabel, false, false);

	return *vbox;
}
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();
}
Esempio n. 6
0
// 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);
}
Esempio n. 7
0
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);
}
void
ServiceChooserDialog::ctor()
{
  set_default_size(360, 240);

  __treeview.set_model(__service_model->get_list_store());
  __treeview.append_column("Service", __service_model->get_column_record().name);
  __treeview.append_column("IP Address", __service_model->get_column_record().ipaddr);
  __scrollwin.add(__treeview);
  __scrollwin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  __treeview.show();
  __expander.add(__entry);
  __entry.show();
  __entry.set_activates_default(true);

  char * fawkes_ip = getenv("FAWKES_IP");
  if (fawkes_ip) __entry.set_text(fawkes_ip);
  else __entry.set_text("localhost");

  Gtk::VBox *vbox = get_vbox();
  vbox->pack_start(__scrollwin);
  vbox->pack_end(__expander, Gtk::PACK_SHRINK);
  __scrollwin.show();
  __expander.show();

  add_button(Gtk::Stock::CANCEL, 0);
  add_button(Gtk::Stock::OK, 1);

  set_default_response(1);

  __treeview.signal_row_activated().connect(sigc::bind(sigc::hide<0>(sigc::hide<0>(sigc::mem_fun(*this, &ServiceChooserDialog::response))), 1));

#ifdef GLIBMM_PROPERTIES_ENABLED
  __expander.property_expanded().signal_changed().connect(sigc::mem_fun(*this, &ServiceChooserDialog::on_expander_changed));
#endif
}