Esempio n. 1
0
DualSpinScale::DualSpinScale(const char* label1, const char* label2, double value, double lower, double upper, double step_inc,
                               double climb_rate, int digits, const SPAttributeEnum a, char* tip_text1, char* tip_text2)
    : AttrWidget(a),
      _s1(label1, value, lower, upper, step_inc, climb_rate, digits, SP_ATTR_INVALID, tip_text1),
      _s2(label2, value, lower, upper, step_inc, climb_rate, digits, SP_ATTR_INVALID, tip_text2),
      //TRANSLATORS: "Link" means to _link_ two sliders together
      _link(C_("Sliders", "Link"))
{
    signal_value_changed().connect(signal_attr_changed().make_slot());

    _s1.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot());
    _s2.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot());
    _s1.get_adjustment()->signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinScale::update_linked));

    _link.signal_toggled().connect(sigc::mem_fun(*this, &DualSpinScale::link_toggled));

    Gtk::VBox* vb = Gtk::manage(new Gtk::VBox);
    vb->add(_s1);
    vb->add(_s2);
    pack_start(*vb);
    pack_start(_link, false, false);
    _link.set_active(true);

    show_all();
}
// Specifies the parent window of the dialog box and the title of the dialog box.
StartDialogBox::StartDialogBox( MainWindow & parentWindow, string title) : Dialog( title, parentWindow, true, true ) {
	this->set_default_size(300,300);

	window_ = &parentWindow;
	Gtk::VBox* contentArea = this->get_vbox();
	
	// Set up checkbuttons, one for each player to indicate human
	for ( int i = 0; i < 4; i++ ) {
		std::ostringstream oss;
		oss << "Player " << (i+1);
		button[i].set_label(oss.str());
		contentArea->add(button[i]);
	} 
	
	// Add a standard "ok" buttons with the appropriate responses when clicked.
    add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

	show_all_children();
	
	int result = run();
    switch (result) {
        case Gtk::RESPONSE_OK: //If ok is clicked
            for (int i = 0; i < 4; i++) {
				window_->humanPlayer[i] = button[i].get_active(); //keep track of which buttons were seleced
			} 
            break;
    } 
} 
Esempio n. 3
0
    DOFFilter():
      _focalLength(0.0f), _focalWidth(1.5f)
    { 
      _filter.build();
      
      //Build the controls
      {
	Gtk::VBox* labelVbox = manage(new Gtk::VBox);
	Gtk::Label* Label1 = manage(new Gtk::Label("Focal Length (0=auto)"));
	Gtk::Label* Label2 = manage(new Gtk::Label("Focal Width"));
	labelVbox->add(*Label1); Label1->show();
	labelVbox->add(*Label2); Label2->show();
	_optlist.add(*labelVbox);
	labelVbox->show();
      }
      
      {
	Gtk::VBox* sliderVbox = manage(new Gtk::VBox);
	sliderVbox->add(_focalLengthSlider);
	sliderVbox->add(_focalWidthSlider);
	_optlist.add(*sliderVbox);
	sliderVbox->show();
      }
      _optlist.show();

      _focalLengthSlider.set_text("0.0");
      _focalWidthSlider.set_text(boost::lexical_cast<std::string>(_focalWidth));

      _focalLengthSlider.show();
      _focalWidthSlider.show();
      
      _focalLengthSlider.signal_changed()
	.connect(sigc::bind(&magnet::gtk::forceNumericEntry, &_focalLengthSlider));

      _focalWidthSlider.signal_changed()
	.connect(sigc::bind(&magnet::gtk::forceNumericEntry, &_focalWidthSlider));

      _focalLengthSlider.signal_activate()
	.connect(sigc::mem_fun(this, &DOFFilter::settingsCallback));      
      _focalWidthSlider.signal_activate()
	.connect(sigc::mem_fun(this, &DOFFilter::settingsCallback));
    }
Esempio n. 4
0
  BilateralBlurWrapper::BilateralBlurWrapper():
    _radius(1),
    _zdiff(0.0005)
  {
    _filter.build(); 

    //Build the controls
    {
      Gtk::VBox* labelVbox = manage(new Gtk::VBox);
      Gtk::Label* Label1 = manage(new Gtk::Label("Radius"));
      Gtk::Label* Label2 = manage(new Gtk::Label("Depth Cutoff"));
      labelVbox->add(*Label1); Label1->show();
      labelVbox->add(*Label2); Label2->show();
      _optlist.add(*labelVbox);
      labelVbox->show();
    }

    {
      Gtk::VBox* sliderVbox = manage(new Gtk::VBox);
      sliderVbox->add(_radiusSlider);
      sliderVbox->add(_zdiffSlider);
      _optlist.add(*sliderVbox);
      sliderVbox->show();
    }
    _optlist.show();

    _radiusSlider.set_range(1,20);
    _radiusSlider.set_increments(1,1);
    _radiusSlider.set_digits(0);
    _radiusSlider.set_value(_radius);
    _radiusSlider.signal_value_changed()
      .connect(sigc::mem_fun(this, &BilateralBlurWrapper::settingsCallback));
    _radiusSlider.show();

    _zdiffSlider.set_increments(0.0001,0.0001);
    _zdiffSlider.set_range(0.0001, 0.005);
    _zdiffSlider.set_digits(6);
    _zdiffSlider.set_value(_zdiff); 
    _zdiffSlider.signal_value_changed()
      .connect(sigc::mem_fun(this, &BilateralBlurWrapper::settingsCallback));
    _zdiffSlider.show();
  }
Esempio n. 5
0
int main(int argc, char* argv[]) {
	Gtk::Main kit(argc, argv);
	Gtk::Entry entry;
	BotonPasarAMayusculas boton(&entry);
	Gtk::VBox vbox;
	vbox.add(entry);
	vbox.add(boton);
	Gtk::Window v;
	v.add(vbox);
	v.show_all();
	Gtk::Main::run(v);
	return 0;
}	
Esempio n. 6
0
    DOFFilter():
      _focalLength(0.25f), _focalWidth(0.01f)
    { 
      _filter.build();
      
      //Build the controls
      {
	Gtk::VBox* labelVbox = manage(new Gtk::VBox);
	Gtk::Label* Label1 = manage(new Gtk::Label("Focal Length (0=auto)"));
	Gtk::Label* Label2 = manage(new Gtk::Label("Focal Width"));
	labelVbox->add(*Label1); Label1->show();
	labelVbox->add(*Label2); Label2->show();
	_optlist.add(*labelVbox);
	labelVbox->show();
      }
      
      {
	Gtk::VBox* sliderVbox = manage(new Gtk::VBox);
	sliderVbox->add(_focalLengthSlider);
	sliderVbox->add(_focalWidthSlider);
	_optlist.add(*sliderVbox);
	sliderVbox->show();
      }
      _optlist.show();
      
      _focalLengthSlider.set_range(0, 1);
      _focalLengthSlider.set_increments(0.01,0.001);
      _focalLengthSlider.set_digits(4);
      _focalLengthSlider.set_value(_focalLength);
      _focalLengthSlider.signal_value_changed().connect(sigc::mem_fun(this, &DOFFilter::settingsCallback));
      _focalLengthSlider.show();
      
      _focalWidthSlider.set_range(0, 1);
      _focalWidthSlider.set_increments(0.001,0.001);
      _focalWidthSlider.set_digits(4);
      _focalWidthSlider.set_value(_focalWidth); 
      _focalWidthSlider.signal_value_changed().connect(sigc::mem_fun(this, &DOFFilter::settingsCallback));
      _focalWidthSlider.show();
    }
DownloadWindow::DownloadWindow() {
    // Self cofigure
    set_title ( "Reading data from device" );
    set_resizable ( false );
    set_deletable ( false );
    set_border_width ( 20 );
    // Widgets
    Gtk::VBox *box = get_vbox();
    progressBar.set_size_request ( 300, -1 );
    box->add ( progressBar );
    // Finally
    show_all_children();
}
Esempio n. 8
0
int main(int argc, char* argv[]) {
	Gtk::Main kit(argc, argv);
	Gtk::ComboBoxText combo;
	combo.append_text("asdfhbb");
	combo.append_text("45ggdfdfs");
	combo.append_text("avbbhrr");
	combo.append_text("khjgh2");
	combo.append_text("cxzeee");
	combo.append_text("quieroaprobartaller");
	BotonOrdenar boton(&combo);
	Gtk::VBox vbox;
	vbox.add(combo);
	vbox.add(boton);
	Gtk::Window v;
	v.add(vbox);
	v.show_all();
	Gtk::Main::run(v);
	return 0;
}	
Esempio n. 9
0
  SSAOWrapper::SSAOWrapper()
  { 
    _radius = 0.5;
    _totStrength = 1;
    _dropoff = 0.4;

    _filter.build(); 

    glGenTextures( 1, &_randomTexture);
    glBindTexture(GL_TEXTURE_2D, _randomTexture);

    std::vector<GLubyte> texture;
    texture.resize(3 * _randomTextureSize * _randomTextureSize);

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    
    srand(120121);
    for (size_t i(0); i < 3 * _randomTextureSize * _randomTextureSize; ++i)
      texture[i] = (rand() * 255.0) / RAND_MAX;
    
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _randomTextureSize, _randomTextureSize, 
		 0, GL_RGB, GL_UNSIGNED_BYTE, &texture[0]);
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );

    //Build the controls
    {
      Gtk::VBox* labelVbox = manage(new Gtk::VBox);
      Gtk::Label* Label1 = manage(new Gtk::Label("Radius"));
      Gtk::Label* Label2 = manage(new Gtk::Label("Magnitude"));
      Gtk::Label* Label3 = manage(new Gtk::Label("Drop off"));
      labelVbox->add(*Label1); Label1->show();
      labelVbox->add(*Label2); Label2->show();
      labelVbox->add(*Label3); Label3->show();
      _optlist.add(*labelVbox);
      labelVbox->show();
    }

    {
      Gtk::VBox* sliderVbox = manage(new Gtk::VBox);
      sliderVbox->add(_radiusSlider);
      sliderVbox->add(_totStrengthSlider);
      sliderVbox->add(_dropoffSlider);

      _optlist.add(*sliderVbox);
      sliderVbox->show();
    }
    _optlist.show();

    _radiusSlider.set_text(boost::lexical_cast<std::string>(_radius));
    _radiusSlider.signal_changed().connect(sigc::mem_fun(this, &SSAOWrapper::settingsCallback));
    _radiusSlider.show();

    _totStrengthSlider.set_text(boost::lexical_cast<std::string>(_totStrength));
    _totStrengthSlider.signal_changed().connect(sigc::mem_fun(this, &SSAOWrapper::settingsCallback));
    _totStrengthSlider.show();
    
    _dropoffSlider.set_text(boost::lexical_cast<std::string>(_dropoff));
    _dropoffSlider.signal_changed().connect(sigc::mem_fun(this, &SSAOWrapper::settingsCallback));
    _dropoffSlider.show();
  }
Esempio n. 10
0
// Specifies the parent window of the dialog box and the title of the dialog box.
StartDialog::StartDialog( Gtk::Window & parentWindow, string title, Controller *c) : Dialog( title, parentWindow, true, true ), players(true, 0), instr("Enter a seed and identify the humans and players:"), seedBox(false, 10), seedLabel("Seed:"){
	controller_ = c;

	//strings to concatenate
	string playerIdStr[4] = { "Player 1:", "Player 2:", "Player 3:", "Player 4:" };
	string options[2] = { "Human", "Computer" };
	vector<bool> results; //0 for human and 1 for computer

	//should
	set_deletable(false);
	set_default_size(400, 100);

	Gtk::VBox* contentArea = this->get_vbox();
	contentArea->add(players);
	players.add(instr);

	//set up the seed
	seedLabel.set_justify(Gtk::JUSTIFY_LEFT);
	seedEntry.set_text("0");
	seedBox.pack_start(seedLabel);
	seedBox.pack_start(seedEntry);
	players.pack_start(seedBox);

	//create the groups for the buttons
	int j = 0;
	for(int i = 0; i < 4; i++) {
		playerId[i].set_label(playerIdStr[i]);
		pOptions[i].add(playerId[i]);
		Gtk::RadioButton::Group group = pRButton[j].get_group();

		pRButton[j].set_label(options[0]);
		pOptions[i].add(pRButton[j]);
		j++;

		pRButton[j].set_label(options[1]);
		pRButton[j].set_group(group);
		pOptions[i].add(pRButton[j]);
		j++;

		players.add(pOptions[i]);
	}

	//add the OK buttons
	okButton = add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK);
	show_all();
    
	int result = run();
    switch (result) {
        case Gtk::RESPONSE_OK:
        	//set up the results for the players and computers
        	for(int i = 0; i < 8; i+=2) {
        		if(pRButton[i].get_active() == 1)
        			results.push_back(0);
        		else 
        			results.push_back(1);
        	}
        	controller_->startGameButtonClicked(seedEntry.get_text(), results);
        	// send results to the model
            break;
    } // switch    	
} // MyDialogBox::MyDialogBox
Esempio n. 11
0
GrubSettingsDlgGtk::GrubSettingsDlgGtk()
	: event_lock(false), bttRemoveCustomEntry(Gtk::Stock::REMOVE),
	rbDefPredefined(gettext("pre_defined: "), true), rbDefSaved(gettext("previously _booted entry"), true),
	lblDefaultEntry(gettext("default entry")), lblView(gettext("visibility")), chkShowMenu(gettext("show menu")),
	lblTimeout(gettext("Timeout")), lblTimeout2(gettext("Seconds")), lblKernelParams(gettext("kernel parameters")),
	chkGenerateRecovery(gettext("generate recovery entries")), chkOsProber(gettext("look for other operating systems")),
	chkResolution(gettext("custom resolution: ")),
	gccNormalBackground(true), gccHighlightBackground(true)
{
	this->set_title("GPC - "+Glib::ustring(gettext("settings")));
	this->set_icon_name("gpc");
	Gtk::VBox* winBox = this->get_vbox();
	winBox->add(tabbox);
	tabbox.append_page(alignCommonSettings, gettext("_General"), true);
	tabbox.append_page(vbAppearanceSettings, gettext("A_ppearance"), true);
	tabbox.append_page(vbAllEntries, gettext("_Advanced"), true);
	
	vbAllEntries.pack_start(hbAllEntriesControl, Gtk::PACK_SHRINK);
	vbAllEntries.pack_start(scrAllEntries);
	hbAllEntriesControl.add(bttAddCustomEntry);
	hbAllEntriesControl.add(bttRemoveCustomEntry);
	hbAllEntriesControl.set_border_width(5);
	hbAllEntriesControl.set_spacing(5);
	scrAllEntries.add(tvAllEntries);
	scrAllEntries.set_border_width(5);
	scrAllEntries.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
	refAsListStore = Gtk::ListStore::create(asTreeModel);
	tvAllEntries.set_model(refAsListStore);
	tvAllEntries.append_column_editable(gettext("is active"), asTreeModel.active);
	tvAllEntries.append_column_editable(gettext("name"), asTreeModel.name);
	tvAllEntries.append_column_editable(gettext("value"), asTreeModel.value);
	refAsListStore->signal_row_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_setting_row_changed));
	vbCommonSettings.set_spacing(15);
	vbAppearanceSettings.set_spacing(15);
	
	vbCommonSettings.pack_start(groupDefaultEntry, Gtk::PACK_SHRINK);
	groupDefaultEntry.add(alignDefaultEntry);
	groupDefaultEntry.set_sensitive(false);
	groupDefaultEntry.set_label_widget(lblDefaultEntry);
	lblDefaultEntry.set_attributes(attrDefaultEntry);
	aDefaultEntry = Pango::Attribute::create_attr_weight(Pango::WEIGHT_BOLD);
	attrDefaultEntry.insert(aDefaultEntry);
	alignDefaultEntry.add(vbDefaultEntry);
	vbDefaultEntry.add(hbDefPredefined);
	vbDefaultEntry.add(rbDefSaved);
	
	hbDefPredefined.pack_start(rbDefPredefined, Gtk::PACK_SHRINK);
	hbDefPredefined.pack_start(cbDefEntry);
	
	vbDefaultEntry.set_spacing(5);
	groupDefaultEntry.set_shadow_type(Gtk::SHADOW_NONE);
	alignDefaultEntry.set_padding(2, 2, 25, 2);
	rbDefPredefined.set_group(rbgDefEntry);
	rbDefSaved.set_group(rbgDefEntry);
	
	Glib::ListHandle<Gtk::CellRenderer*> cellRenderers = cbDefEntry.get_cells();
	Gtk::CellRenderer* cellRenderer = *cellRenderers.begin();
	cellRenderer->set_fixed_size(200, -1);
	
	cbDefEntry.set_wrap_width(2);
	
	alignCommonSettings.add(vbCommonSettings);
	alignCommonSettings.set_padding(20, 0, 0, 0);
	vbCommonSettings.pack_start(groupView, Gtk::PACK_SHRINK);
	groupView.add(alignView);
	groupView.set_shadow_type(Gtk::SHADOW_NONE);
	groupView.set_label_widget(lblView);
	lblView.set_attributes(attrDefaultEntry);
	alignView.add(vbView);
	vbView.set_spacing(5);
	alignView.set_padding(2, 2, 25, 2);
	vbView.add(chkShowMenu);
	vbView.add(chkOsProber);
	vbView.add(hbTimeout);
	hbTimeout.set_spacing(5);
	hbTimeout.pack_start(lblTimeout, Gtk::PACK_SHRINK);
	hbTimeout.pack_start(spTimeout, Gtk::PACK_SHRINK);
	hbTimeout.pack_start(lblTimeout2, Gtk::PACK_SHRINK);
	
	spTimeout.set_digits(0);
	spTimeout.set_increments(1, 5);
	spTimeout.set_range(0, 1000000);
	
	vbCommonSettings.pack_start(groupKernelParams, Gtk::PACK_SHRINK);
	groupKernelParams.add(alignKernelParams);
	groupKernelParams.set_shadow_type(Gtk::SHADOW_NONE);
	groupKernelParams.set_label_widget(lblKernelParams);
	lblKernelParams.set_attributes(attrDefaultEntry);
	alignKernelParams.add(vbKernelParams);
	alignKernelParams.set_padding(10, 2, 25, 2);
	vbKernelParams.add(txtKernelParams);
	vbKernelParams.add(chkGenerateRecovery);
	vbKernelParams.set_spacing(5);
	
	vbAppearanceSettings.pack_start(alignResolution, Gtk::PACK_SHRINK);
	alignResolution.add(hbResolution);
	alignResolution.set_padding(10, 0, 6, 0);
	hbResolution.pack_start(chkResolution, Gtk::PACK_SHRINK);
	hbResolution.pack_start(cbResolution);
	cbResolution.append_text("saved");
	
	//color chooser
	vbAppearanceSettings.pack_start(groupColorChooser, Gtk::PACK_SHRINK);
	groupColorChooser.set_label_widget(lblColorChooser);
	groupColorChooser.set_shadow_type(Gtk::SHADOW_NONE);
	lblColorChooser.set_attributes(attrDefaultEntry);
	alignColorChooser.add(tblColorChooser);
	tblColorChooser.attach(lblforegroundColor, 1,2,0,1);
	tblColorChooser.attach(lblBackgroundColor, 2,3,0,1);
	tblColorChooser.attach(lblNormalColor, 0,1,1,2);
	tblColorChooser.attach(lblHighlightColor, 0,1,2,3);
	tblColorChooser.attach(gccNormalForeground, 1,2,1,2);
	tblColorChooser.attach(gccNormalBackground, 2,3,1,2);
	tblColorChooser.attach(gccHighlightForeground, 1,2,2,3);
	tblColorChooser.attach(gccHighlightBackground, 2,3,2,3);
	tblColorChooser.set_spacings(10);

	//background image
	vbAppearanceSettings.pack_start(groupBackgroundImage);
	groupBackgroundImage.set_shadow_type(Gtk::SHADOW_NONE);
	groupBackgroundImage.add(alignBackgroundImage);
	groupBackgroundImage.set_label_widget(lblBackgroundImage);
	lblBackgroundImage.set_attributes(attrDefaultEntry);
	alignBackgroundImage.add(vbBackgroundImage);

	vbBackgroundImage.pack_start(hbImgBtts);
	vbBackgroundImage.pack_start(lblBackgroundRequiredInfo);
	vbButtons.add(bttRemoveBackground);

	vbBackgroundImage.set_spacing(5);
	hbImgBtts.set_spacing(5);
	vbButtons.set_spacing(5);

	bttRemoveBackground.set_no_show_all(true);
	imgBackgroundImage.set_no_show_all(true);
	lblBackgroundRequiredInfo.set_no_show_all(true);
	
	//<signals>
	rbDefPredefined.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_default_entry_predefined_toggeled));
	rbDefSaved.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_default_entry_saved_toggeled));
	cbDefEntry.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_default_entry_changed));
	chkShowMenu.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_showMenu_toggled));
	chkOsProber.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_osProber_toggled));
	spTimeout.signal_value_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_timeout_changed));
	txtKernelParams.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_kernelparams_changed));
	chkGenerateRecovery.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_recovery_toggled));
	chkResolution.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_chkResolution_toggled));
	cbResolution.get_entry()->signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_resolution_selected));
	gccNormalForeground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed));
	gccNormalBackground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed));
	gccHighlightForeground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed));
	gccHighlightBackground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed));
	fcBackgroundImage.signal_file_set().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_other_image_chosen));
	bttRemoveBackground.signal_clicked().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_bttRemoveBackground_clicked));
	bttAddCustomEntry.signal_clicked().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_add_row_button_clicked));
	bttRemoveCustomEntry.signal_clicked().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_remove_row_button_clicked));

	this->add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
	this->set_default_size(300, 400);
}