コード例 #1
0
         aboutDialog::aboutDialog()
         {
            Gtk::Dialog *ad = this;

            Gtk::Button *okbutton    = Gtk::manage(new class Gtk::Button("ok"));
            Gtk::Label *aboutLabel   = Gtk::manage(new class Gtk::Label( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + ", build " + GPD->sBUILD() ));
            Gtk::TextView *textview  = Gtk::manage(new class Gtk::TextView());
            Gtk::ScrolledWindow *scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow());
            Gtk::VBox *vbox                     = Gtk::manage(new class Gtk::VBox(false, 0));

            okbutton->set_flags(Gtk::CAN_FOCUS);
            okbutton->set_relief(Gtk::RELIEF_NORMAL);

            ad->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END);
            ad->set_default_size(300, 200);

            aboutLabel->set_alignment(0.5,0.5);
            aboutLabel->set_padding(0,0);
            aboutLabel->set_justify(Gtk::JUSTIFY_LEFT);
            aboutLabel->set_line_wrap(false);
            aboutLabel->set_use_markup(false);
            aboutLabel->set_selectable(false);

            textview->set_flags(Gtk::CAN_FOCUS);
            textview->set_editable(true);
            textview->set_cursor_visible(true);
            textview->set_pixels_above_lines(0);
            textview->set_pixels_below_lines(0);
            textview->set_pixels_inside_wrap(0);
            textview->set_left_margin(0);
            textview->set_right_margin(0);
            textview->set_indent(0);
            textview->set_wrap_mode(Gtk::WRAP_NONE);
            textview->set_justification(Gtk::JUSTIFY_LEFT);

            using namespace std;
            string text;
            text += "btg Copyright (C) 2005 Michael Wojciechowski.";
            text += GPD->sNEWLINE();
            text += "This program is free software; you can redistribute it and/or modify";
            text += GPD->sNEWLINE();
            text += "it under the terms of the GNU General Public License as published by ";
            text += GPD->sNEWLINE();
            text += "the Free Software Foundation; either version 2 of the License, or ";
            text += GPD->sNEWLINE();
            text += "(at your option) any later version.";
            text += GPD->sNEWLINE();
            text += "This program is distributed in the hope that it will be useful, ";
            text += GPD->sNEWLINE();
            text += "but WITHOUT ANY WARRANTY; without even the implied warranty of ";
            text += GPD->sNEWLINE();
            text += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the ";
            text += GPD->sNEWLINE();
            text += "GNU General Public License for more details.";
            text += GPD->sNEWLINE();
            text += "You should have received a copy of the GNU General Public License ";
            text += GPD->sNEWLINE();
            text += "along with this program; if not, write to the Free Software ";
            text += GPD->sNEWLINE();
            text += "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA";
            text += GPD->sNEWLINE();

            textview->get_buffer()->set_text(text);

            scrolledwindow->set_flags(Gtk::CAN_FOCUS);
            scrolledwindow->set_shadow_type(Gtk::SHADOW_IN);
            scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
            scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT);
            scrolledwindow->add(*textview);
            vbox->pack_start(*aboutLabel, Gtk::PACK_SHRINK, 0);
            vbox->pack_start(*scrolledwindow);
            ad->get_vbox()->set_homogeneous(false);
            ad->get_vbox()->set_spacing(0);
            ad->get_vbox()->pack_start(*vbox);
            //ad->set_title( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() );
            ad->set_title( GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + " / About" );
            ad->set_modal(true);
            ad->property_window_position().set_value(Gtk::WIN_POS_CENTER);
            ad->set_resizable(true);
            ad->property_destroy_with_parent().set_value(false);
            ad->set_has_separator(true);
            ad->add_action_widget(*okbutton, -5);
            okbutton->show();
            aboutLabel->show();
            textview->show();
            scrolledwindow->show();
            vbox->show();

            okbutton->signal_clicked().connect(sigc::mem_fun(*this, &aboutDialog::on_ok_clicked));
            // ad->show();
         }
コード例 #2
0
ファイル: test4.cpp プロジェクト: tschoonj/gtkmm-plplot
    Window() : canvas(), checkbutton1("Plot 1"),
      checkbutton2("Plot 2"), checkbutton3("Plot 3"),
      label_x("X:"),
      label_y("Y:") {
      set_default_size(720, 580);
      Gdk::Geometry geometry;
      geometry.min_aspect = geometry.max_aspect = double(720)/double(580);
      set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT);
      set_title("Gtkmm-PLplot test4");
      canvas.set_hexpand(true);
      canvas.set_vexpand(true);
      canvas.set_background_color(Gdk::RGBA("Light Gray"));
      grid.set_column_homogeneous(true);
      checkbutton1.set_vexpand(false);
      checkbutton1.set_hexpand(false);
      checkbutton1.set_halign(Gtk::ALIGN_CENTER);
      checkbutton2.set_vexpand(false);
      checkbutton2.set_hexpand(false);
      checkbutton2.set_halign(Gtk::ALIGN_CENTER);
      checkbutton3.set_vexpand(false);
      checkbutton3.set_hexpand(false);
      checkbutton3.set_halign(Gtk::ALIGN_CENTER);

      std::valarray<double> x_va = Gtk::PLplot::indgen_va(1000)/50.0 - 10.0;
      std::valarray<double> y_va1 = sinh(x_va);
      std::valarray<double> y_va2 = cosh(x_va);
      std::valarray<double> y_va3 = tanh(x_va);

      //generate the data, the plot, add them to the canvas and use the return value to pass it to the checkbutton
      Gtk::PLplot::Plot2D *plot1 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va1,
              Gdk::RGBA("blue"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic sine",
          0.5,
          0.5,
          0.0,
          0.0
        )
      );
      canvas.add_plot(*plot1);
      checkbutton1.connect_plot(plot1);

      Gtk::PLplot::Plot2D *plot2 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va2,
              Gdk::RGBA("red"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic cosine",
          0.5,
          0.5,
          0.5,
          0.0
        )
      );
      canvas.add_plot(*plot2);
      checkbutton2.connect_plot(plot2);

      Gtk::PLplot::Plot2D *plot3 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va3,
              Gdk::RGBA("green"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic tangent",
          0.4,
          0.4,
          0.2,
          0.55
        )
      );
      canvas.add_plot(*plot3);
      checkbutton3.connect_plot(plot3);

      checkbutton1.set_active();
      checkbutton2.set_active(false);
      checkbutton3.set_active();

      //let's make the first plot unpannable
      plot1->set_region_pannable(false);

      //let's override the background color of the second plot and hide it to make the surprise complete!!
      plot2->set_background_color(Gdk::RGBA("Yellow Green"));
      plot2->hide();

      //also let's disable the region selection, for no reason whatsoever!
      plot2->set_region_selectable(false);

      //let's override the default region of this plot, this is NOT influenced by set_region_selectable()!!!
      plot2->set_region(-10, 10, -10, 10);

      //we can also change some other colors
      plot2->set_axes_color(Gdk::RGBA("Blue"));
      plot2->set_titles_color(Gdk::RGBA("Purple"));
      plot2->set_box_style(Gtk::PLplot::BOX_TICKS_TICK_LABELS_MAIN_AXES_MAJOR_MINOR_TICK_GRID);

      //lets'give the third plot a nice opaque background color
      plot3->set_background_color(Gdk::RGBA("White"));

      //but disable zooming by scrolling
      plot3->set_region_zoomable(false);

      //and give it an unusual selection box
      plot3->set_region_selection_color(Gdk::RGBA("Purple"));
      plot3->set_region_selection_width(4.0);

      //hook up signal_cursor_motion to the entries
      unsigned int plotnr = 0;
      while (1) {
        try {
          Gtk::PLplot::Plot2D *plot = dynamic_cast<Gtk::PLplot::Plot2D *>(canvas.get_plot(plotnr++));
          plot->signal_cursor_motion().connect([this](double x, double y){
            entry_x.set_text(Glib::Ascii::dtostr(x));
            entry_y.set_text(Glib::Ascii::dtostr(y));
          });
        }
        catch (Gtk::PLplot::Exception &e) {
          break;
        }
      }

      grid.attach(checkbutton1, 0, 0, 1, 1);
      grid.attach(checkbutton2, 1, 0, 1, 1);
      grid.attach(checkbutton3, 2, 0, 1, 1);
      grid.attach(canvas, 0, 1, 3, 1);

      coordinates_grid.set_column_homogeneous(false);
      coordinates_grid.attach(label_x, 0, 0, 1, 1);
      coordinates_grid.attach(entry_x, 1, 0, 1, 1);
      coordinates_grid.attach(label_y, 2, 0, 1, 1);
      coordinates_grid.attach(entry_y, 3, 0, 1, 1);
      label_x.set_vexpand(false);
      label_x.set_hexpand(true);
      label_x.set_halign(Gtk::ALIGN_END);
      label_y.set_vexpand(false);
      label_y.set_hexpand(false);
      label_y.set_halign(Gtk::ALIGN_CENTER);
      entry_x.set_vexpand(false);
      entry_x.set_hexpand(false);
      entry_x.set_halign(Gtk::ALIGN_END);
      entry_y.set_vexpand(false);
      entry_y.set_hexpand(true);
      entry_y.set_halign(Gtk::ALIGN_START);
      coordinates_grid.set_column_spacing(5);
      grid.attach(coordinates_grid, 0, 2, 3, 1);
      grid.set_row_spacing(5);

      add(grid);
      set_border_width(10);
      grid.show_all();
    }
コード例 #3
0
//dialog_previewoptions stuff
Dialog_PreviewOptions::Dialog_PreviewOptions()
:Dialog(_("Preview Options")),
adj_zoom(Gtk::Adjustment::create(0.5,0.1,5.0,0.1,0.2)),
adj_fps(Gtk::Adjustment::create(12,1,120,1,5)),
check_overbegin(_("_Begin time"),false),
check_overend(_("_End time"),false),
settings(this,"prevoptions")
{
	//framerate = 15.0f;
	//zoom = 0.2f;

	//set the fps of the time widgets
	Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	dialogPadding->set_padding(12, 12, 12, 12);
	get_vbox()->add(*dialogPadding);

	Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
	dialogPadding->add(*dialogBox);

	Gtk::Frame *generalFrame = manage(new Gtk::Frame(_("General settings")));
	generalFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) generalFrame->get_label_widget())->set_markup(_("<b>General settings</b>"));
	dialogBox->pack_start(*generalFrame, false, false, 0);

	Gtk::Alignment *generalPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	generalPadding->set_padding(6, 0, 24, 0);
	generalFrame->add(*generalPadding);

	Gtk::Table *generalTable = manage(new Gtk::Table(2, 2, false));
	generalTable->set_row_spacings(6);
	generalTable->set_col_spacings(12);
	generalPadding->add(*generalTable);

	Gtk::Label *zoomLabel = manage(new Gtk::Label(_("_Quality")));
	zoomLabel->set_alignment(0, 0.5);
	zoomLabel->set_use_underline(TRUE);
	Gtk::SpinButton *zoomSpinner = manage(new Gtk::SpinButton(adj_zoom, 0.1, 2));
	zoomLabel->set_mnemonic_widget(*zoomSpinner);
	zoomSpinner->set_alignment(1);
	generalTable->attach(*zoomLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	generalTable->attach(*zoomSpinner, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *fpsLabel = manage(new Gtk::Label(_("_FPS")));
	fpsLabel->set_alignment(0, 0.5);
	fpsLabel->set_use_underline(TRUE);
	Gtk::SpinButton *fpsSpinner = manage(new Gtk::SpinButton(adj_fps, 1, 1));
	fpsLabel->set_mnemonic_widget(*fpsSpinner);
	fpsSpinner->set_alignment(1);
	generalTable->attach(*fpsLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	generalTable->attach(*fpsSpinner, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Frame *timeFrame = manage(new Gtk::Frame(_("Time settings")));
	timeFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) timeFrame->get_label_widget())->set_markup(_("<b>Time settings</b>"));
	dialogBox->pack_start(*timeFrame, false, false, 0);

	Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	timePadding->set_padding(6, 0, 24, 0);
	timeFrame->add(*timePadding);

	Gtk::Table *timeTable = manage(new Gtk::Table(2, 2, false));
	timeTable->set_row_spacings(6);
	timeTable->set_col_spacings(12);
	timePadding->add(*timeTable);

	check_overbegin.set_alignment(0, 0.5);
	check_overbegin.set_use_underline(TRUE);
	check_overend.set_alignment(0, 0.5);
	check_overend.set_use_underline(TRUE);
	time_begin.set_alignment(1);
	time_end.set_alignment(1);
	timeTable->attach(check_overbegin, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(time_begin, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(check_overend, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(time_end, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	check_overbegin.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overbegin_toggle));
	check_overend.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overend_toggle));

	Gtk::Button *cancelButton = manage(new Gtk::Button(Gtk::StockID("gtk-cancel")));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_PreviewOptions::on_cancel_pressed));
	add_action_widget(*cancelButton, 1);
	cancelButton->show();

	Gtk::Button *okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-go-forward")));
	okbutton->set_label(_("Preview"));
	okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_ok_pressed));
	add_action_widget(*okbutton, 0);
	okbutton->show();

	time_begin.set_sensitive(false);
	time_end.set_sensitive(false);
	show_all();
}
コード例 #4
0
ファイル: renddesc.cpp プロジェクト: blackwarthog/synfig
Gtk::Widget *
Widget_RendDesc::create_image_tab()
{
	Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1));
	paddedPanel->set_padding(12, 12, 12, 12);

	Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12));
	panelBox->set_homogeneous(false);
	paddedPanel->add(*panelBox);

	Gtk::Frame *imageSizeFrame = manage(new Gtk::Frame(_("Image Size")));
	imageSizeFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) imageSizeFrame->get_label_widget())->set_markup(_("<b>Image Size</b>"));
//	panelBox->pack_start(*imageSizeFrame, false, false, 0);
	panelBox->pack_start(*imageSizeFrame, Gtk::PACK_SHRINK);

	Gtk::Alignment *tableSizePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	tableSizePadding->set_padding(6, 0, 24, 0);
	Gtk::Grid *imageSizeGrid = manage(new Gtk::Grid());

	tableSizePadding->add(*imageSizeGrid);
	imageSizeFrame->add(*tableSizePadding);

	Gtk::Label *size_width_label = manage(new Gtk::Label(_("_Width"), 0, 0.5, true));
	size_width_label->set_mnemonic_widget(*entry_width);

	Gtk::Label *size_height_label = manage(new Gtk::Label(_("_Height"), 0, 0.5, true));
	size_height_label->set_mnemonic_widget(*entry_height);

	Gtk::Label *size_xres_label = manage(new Gtk::Label(_("_XRes"), 0, 0.5, true));
	size_xres_label->set_mnemonic_widget(*entry_xres);

	Gtk::Label *size_yres_label = manage(new Gtk::Label(_("_YRes"), 0, 0.5, true));
	size_yres_label->set_mnemonic_widget(*entry_yres);

	Gtk::Label *size_physwidth_label = manage(new Gtk::Label(_("_Physical Width"), 0, 0.5, true));
	size_physwidth_label->set_mnemonic_widget(*entry_phy_width);

	Gtk::Label *size_physheight_label = manage(new Gtk::Label(_("Phy_sical Height"), 0, 0.5, true));
	size_physheight_label->set_mnemonic_widget(*entry_phy_height);

	imageSizeGrid->set_row_spacing(6);

	imageSizeGrid->attach(*size_width_label, 		0, 0, 1, 1);
	imageSizeGrid->attach(*size_height_label, 		0, 1, 1, 1);
	entry_width->set_hexpand(true);
	entry_height->set_hexpand(true);
	imageSizeGrid->attach(*entry_width, 			1, 0, 1, 1);
	imageSizeGrid->attach(*entry_height, 			1, 1, 1, 1);
	toggle_wh_ratio->set_margin_right(6);
	imageSizeGrid->attach(*toggle_wh_ratio, 		2, 0, 1, 2);

	imageSizeGrid->attach(*size_xres_label, 		3, 0, 1, 1);
	imageSizeGrid->attach(*size_yres_label, 		3, 1, 1, 1);
	entry_xres->set_hexpand(true);
	entry_yres->set_hexpand(true);
	imageSizeGrid->attach(*entry_xres, 				4, 0, 1, 1);
	imageSizeGrid->attach(*entry_yres, 				4, 1, 1, 1);
	toggle_res_ratio->set_margin_right(6);
	imageSizeGrid->attach(*toggle_res_ratio,		5, 0, 1, 2);

	imageSizeGrid->attach(*size_physwidth_label,	6, 0, 1, 1);
	imageSizeGrid->attach(*size_physheight_label,	6, 1, 1, 1);
	entry_phy_width->set_hexpand(true);
	entry_phy_height->set_hexpand(true);
	imageSizeGrid->attach(*entry_phy_width,			7, 0, 1, 1);
	imageSizeGrid->attach(*entry_phy_height,		7, 1, 1, 1);

	imageSizeGrid->attach(*pixel_ratio_label,		0, 3, 3, 1);

	Gtk::Frame *imageAreaFrame = manage(new Gtk::Frame(_("Image Area")));
	imageAreaFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) imageAreaFrame->get_label_widget())->set_markup(_("<b>Image Area</b>"));
	//panelBox->pack_start(*imageAreaFrame, false, false, 0);
	panelBox->pack_start(*imageAreaFrame, Gtk::PACK_SHRINK);

	Gtk::Alignment *imageAreaPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	imageAreaPadding->set_padding(6, 0, 24, 0);
	imageAreaFrame->add(*imageAreaPadding);

	Gtk::Box *imageAreaBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,12));
	Gtk::Box *imageAreaTlbrLabelBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL,6));
	Gtk::Box *imageAreaTlbrBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL,6));
	Gtk::Box *imageAreaSpanBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,6));
	imageAreaPadding->add(*imageAreaBox);

	Gtk::Label *imageAreaTopLeftLabel = manage(new Gtk::Label(_("_Top Left"), 0, 0.5, true));
	imageAreaTopLeftLabel->set_mnemonic_widget(*entry_tl);

	Gtk::Label *imageAreaBottomRightLabel = manage(new Gtk::Label(_("_Bottom Right"), 0, 0.5, true));
	imageAreaBottomRightLabel->set_mnemonic_widget(*entry_br);

	Gtk::Label *size_span = manage(new Gtk::Label(_("I_mage Span"), 0, 0.5, true));
	size_span->set_mnemonic_widget(*entry_span);

	imageAreaTlbrLabelBox->pack_start(*imageAreaTopLeftLabel);
	imageAreaTlbrLabelBox->pack_start(*imageAreaBottomRightLabel);
	imageAreaTlbrBox->pack_start(*entry_tl);
	imageAreaTlbrBox->pack_start(*entry_br);

	imageAreaSpanBox->pack_start(*size_span);
	imageAreaSpanBox->pack_start(*entry_span);

	imageAreaBox->pack_start(*imageAreaTlbrLabelBox);
	imageAreaBox->pack_start(*imageAreaTlbrBox);
	imageAreaBox->pack_start(*imageAreaSpanBox);

	paddedPanel->show_all();
	return paddedPanel;
}
コード例 #5
0
ファイル: bugzillapreferences.cpp プロジェクト: haobug/gnote
void BugzillaPreferences::add_clicked()
{
    Gtk::FileChooserDialog dialog(_("Select an icon..."),
                                  Gtk::FILE_CHOOSER_ACTION_OPEN);
    dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    dialog.add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_OK);

    dialog.set_default_response(Gtk::RESPONSE_OK);
    dialog.set_local_only(true);
    dialog.set_current_folder (last_opened_dir);

    Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
    filter->add_pixbuf_formats ();

    dialog.add_filter(filter);

    // Extra Widget
    Gtk::Label *l = manage(new Gtk::Label (_("_Host name:"), true));
    Gtk::Entry *host_entry = manage(new Gtk::Entry ());
    l->set_mnemonic_widget(*host_entry);
    Gtk::HBox *hbox = manage(new Gtk::HBox (false, 6));
    hbox->pack_start (*l, false, false, 0);
    hbox->pack_start (*host_entry, true, true, 0);
    hbox->show_all ();

    dialog.set_extra_widget(*hbox);

    int response;
    std::string icon_file;
    std::string host;

    while(1) {
        response = dialog.run ();
        icon_file = dialog.get_filename();
        host = sharp::string_trim(host_entry->get_text());


        if (response == (int) Gtk::RESPONSE_OK) {

            bool valid = sanitize_hostname(host);

            if(valid && !host.empty()) {
                break;
            }
            // Let the user know that they
            // have to specify a host name.
            gnote::utils::HIGMessageDialog warn(
                NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
                Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK,
                _("Host name invalid"),
                _("You must specify a valid Bugzilla "
                  "host name to use with this icon."));
            warn.run ();

            host_entry->grab_focus ();
        }
        else if (response != (int) Gtk::RESPONSE_OK) {
            return;
        }
    }

    // Keep track of the last directory the user had open
    last_opened_dir = dialog.get_current_folder();

    // Copy the file to the BugzillaIcons directory
    std::string err_msg;
    if (!copy_to_bugzilla_icons_dir (icon_file, host, err_msg)) {
        gnote::utils::HIGMessageDialog err(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
                                           Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
                                           _("Error saving icon"),
                                           std::string(_("Could not save the icon file.")) +
                                           "  " + err_msg);
        err.run();
    }

    update_icon_store();
}
コード例 #6
0
MEShowNodesWindow::MEShowNodesWindow(MEMapArea* mapArea)
   : m_selectedRow( NULL ), m_mapArea(mapArea)
{
   set_title("Show nodes");
   set_size_request(300, 400);      

   // Create the main-box where the frames are added. 
   Gtk::Box* mainbox = manage(new Gtk::VBox());
   Gtk::Frame* frame = NULL;
   //Gtk::Adjustment* adj = NULL;
   Gtk::Label* label = NULL;
   Gtk::Button* btn = NULL;

   m_fileSelector = manage(new Gtk::FileSelection("Select turn desc. file"));
   m_fileSelector->get_ok_button()->signal_clicked().connect(
               sigc::mem_fun(*this, &MEShowNodesWindow::on_fileSelOK));

   m_fileSelector->get_cancel_button()->signal_clicked().connect(
                sigc::mem_fun(*this, &MEShowNodesWindow::on_fileSelCancel));              


   m_fileSelector->hide_fileop_buttons();

   // Frame where to load file
   frame = manage(new Gtk::Frame("File"));
   Gtk::Box* box = manage(new Gtk::HBox());
   m_fileNameEntry = manage(new Gtk::Entry());
   box->pack_start(*m_fileNameEntry);
   btn = manage(new Gtk::Button("..."));
   btn->signal_clicked().connect(
            sigc::mem_fun(*this, &MEShowNodesWindow::on_selectFile));            
   box->pack_start(*btn, false, false); 
   btn = manage(new Gtk::Button("Load"));
   btn->signal_clicked().connect(
            sigc::mem_fun(*this, &MEShowNodesWindow::on_loadFile));    
   box->pack_start(*btn, false, false); 
   frame->add(*box);
   mainbox->pack_start(*frame, false, false);

   // Create ListStore and add to TreeView
   m_listStore = Gtk::ListStore::create(m_columns);
   m_treeView.set_model(m_listStore);
 
   m_treeView.append_column("From", m_columns.m_from);
   m_treeView.append_column("To", m_columns.m_to);
   m_treeView.append_column("Old turn", m_columns.m_oldTurn);
   m_treeView.append_column("Old CK", m_columns.m_oldCK);

   // Create selection object to handle selections
   m_selection = m_treeView.get_selection();
   
   if( m_selection )
   {
      m_selection->signal_changed().connect(
        sigc::mem_fun(*this, &MEShowNodesWindow::on_showNode));
   } else {
      // If this doesn't work we're in trouble.
      mc2log << error << "No selection object created for corresponding "
             << "TreeView" << endl;
      MC2_ASSERT(false);
   }

   // Set column size- and resize properties.
   Gtk::TreeViewColumn* tmpCol;
   tmpCol = m_treeView.get_column( 0 );
   tmpCol->set_sizing( Gtk::TREE_VIEW_COLUMN_FIXED );
   tmpCol->set_fixed_width( 90 );   
   tmpCol->set_resizable( true );
 
   tmpCol = m_treeView.get_column( 1 );
   tmpCol->set_sizing( Gtk::TREE_VIEW_COLUMN_FIXED );
   tmpCol->set_fixed_width( 90 );
   tmpCol->set_resizable( true );

   tmpCol = m_treeView.get_column( 2 );
   tmpCol->set_sizing( Gtk::TREE_VIEW_COLUMN_FIXED );
   tmpCol->set_fixed_width( 70 );
   tmpCol->set_resizable( true ); 

   tmpCol = m_treeView.get_column( 3 );
   tmpCol->set_sizing( Gtk::TREE_VIEW_COLUMN_FIXED );
   tmpCol->set_fixed_width( 70 );
   tmpCol->set_resizable( true ); 

   Gtk::ScrolledWindow* scrolledWin = manage(new Gtk::ScrolledWindow());
   scrolledWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrolledWin->add(m_treeView);
   mainbox->pack_start( *scrolledWin, true, true ); 
   
   // Next and previous turn
   box = manage(new Gtk::HBox());
   btn = manage(new Gtk::Button("Prev"));
   btn->signal_clicked().connect(
            sigc::mem_fun(*this, &MEShowNodesWindow::on_clickPrev));    

   box->pack_start(*btn);
   btn = manage(new Gtk::Button("All"));
   btn->signal_clicked().connect(
            sigc::mem_fun(*this, &MEShowNodesWindow::on_clickShowAll));    
   box->pack_start(*btn);
   btn = manage(new Gtk::Button("Next"));
   btn->signal_clicked().connect(
            sigc::mem_fun(*this, &MEShowNodesWindow::on_clickNext));    
   box->pack_start(*btn);
   mainbox->pack_start(*box, false, false); 
   
   // Frame with information about the selected crossing/connection
   frame = manage(new Gtk::Frame("Selected crossing"));
   Gtk::HBox* hbox = manage(new Gtk::HBox());

   box = manage(new Gtk::VBox());
   label = manage(new Gtk::Label("Current values"));
   label->set_pattern(           "______________");
   box->pack_start(*label);
   m_curTurnDesc = manage(new Gtk::Label(""));
   box->pack_start(*m_curTurnDesc);
   m_curCrossingKind = manage(new Gtk::Label(""));
   box->pack_start(*m_curCrossingKind);
   hbox->pack_start(*box);
   
   box = manage(new Gtk::VBox());
   label = manage(new Gtk::Label("Old values"));
   label->set_pattern(           "__________");
   box->pack_start(*label);
   m_oldTurnDesc = manage(new Gtk::Label(""));
   box->pack_start(*m_oldTurnDesc);
   m_oldCrossingKind = manage(new Gtk::Label(""));
   box->pack_start(*m_oldCrossingKind);
   hbox->pack_start(*box);

   frame->add(*hbox);
   mainbox->pack_start(*frame, false, false); 

   add(*mainbox);
   show_all();
}
コード例 #7
0
Example_ScrolledViewport::Example_ScrolledViewport()
{
    Gtk::HBox* hbox;
    Gtk::VBox* vbox;

    set_title("ScrolledViewport Example");

    Papyrus::Gtk::Viewport& viewport = m_ScrolledViewport.viewport();

    m_Zoomer = Papyrus::Zoomer::create( );
    viewport.add_controller( m_Zoomer );

    viewport.set_size_request( 300, 200 );

    // Create some shapes to add to the group
    Papyrus::Group::pointer g = Papyrus::example_group( );

    viewport.canvas()->add( g );
    m_Zoomer->add( g );

    vbox = Gtk::manage( new Gtk::VBox() );
    vbox->pack_start( m_ScrolledViewport );
    vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) );

    Gtk::RadioButton* rb;
    Gtk::VBox* vbox2;
    Gtk::Frame* frame;
    Gtk::Label* label;

    label = Gtk::manage( new Gtk::Label("Use the mouse wheel to zoom in and out.\n\nThe scrollbars are set to automatic in this example so you will need to zoom in before they show up.") );
    label->set_use_markup();
    label->set_line_wrap();
    vbox->pack_start(*label, Gtk::PACK_SHRINK, 10);
    vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) );

    vbox2 = Gtk::manage( new Gtk::VBox() );
    frame = Gtk::manage( new Gtk::Frame("Viewport Scroll Placement") );
    frame->add(*vbox2);
    vbox->pack_start(*frame, Gtk::PACK_SHRINK, 10);
    label = Gtk::manage( new Gtk::Label("<i>Placement refers to the corner where the viewport will be placed</i>") );
    label->set_use_markup();
    label->set_line_wrap();
    vbox2->pack_start(*label, Gtk::PACK_SHRINK);
    Gtk::RadioButtonGroup scroll_placement_group;
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Top Left" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_TOP_LEFT) );
    vbox2->pack_start( *rb );
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Bottom Left" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_BOTTOM_LEFT) );
    vbox2->pack_start( *rb );
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Top Right" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_TOP_RIGHT) );
    vbox2->pack_start( *rb );
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Bottom Right" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_BOTTOM_RIGHT) );
    vbox2->pack_start( *rb );

    this->add( *vbox );

    show_all();
}
コード例 #8
0
Widget_Waypoint::Widget_Waypoint(etl::handle<synfig::Canvas> canvas):
	Gtk::Alignment(0, 0, 1, 1),
	waypoint(synfig::ValueBase(),0),
	adj_tension(Gtk::Adjustment::create(0.0,-20,20,0.1,1)),
	adj_continuity(Gtk::Adjustment::create(0.0,-20,20,0.1,1)),
	adj_bias(Gtk::Adjustment::create(0.0,-20,20,0.1,1)),
	adj_temporal_tension(Gtk::Adjustment::create(0.0,-20,20,0.1,1))
{
	value_widget=manage(new Widget_ValueBase());
	value_widget->set_canvas(canvas);
	value_widget->show();

	value_node_label=manage(new Gtk::Label(_("(Non-static value)")));


	time_widget=manage(new Widget_Time());
	time_widget->set_fps(canvas->rend_desc().get_frame_rate());

	before_options=manage(new class Widget_Enum());
	before_options->show();
	before_options->set_param_desc(
		ParamDesc("interpolation")
			.set_hint("enum")
			.add_enum_value(INTERPOLATION_CLAMPED,"clamped",_("Clamped"))
			.add_enum_value(INTERPOLATION_TCB,"auto",_("TCB"))
			.add_enum_value(INTERPOLATION_CONSTANT,"constant",_("Constant"))
			.add_enum_value(INTERPOLATION_HALT,"ease",_("Ease In/Out"))
			.add_enum_value(INTERPOLATION_LINEAR,"linear",_("Linear"))
	);
	before_options->set_icon(0, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_clamped"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(1, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_tcb"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(2, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_const"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(3, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_ease"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(4, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_linear"),Gtk::ICON_SIZE_MENU));

	after_options=manage(new class Widget_Enum());
	after_options->show();
	after_options->set_param_desc(
		ParamDesc("interpolation")
			.set_hint("enum")
			.add_enum_value(INTERPOLATION_CLAMPED,"clamped",_("Clamped"))
			.add_enum_value(INTERPOLATION_TCB,"auto",_("TCB"))
			.add_enum_value(INTERPOLATION_CONSTANT,"constant",_("Constant"))
			.add_enum_value(INTERPOLATION_HALT,"ease",_("Ease In/Out"))
			.add_enum_value(INTERPOLATION_LINEAR,"linear",_("Linear"))
	);
	after_options->set_icon(0, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_clamped"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(1, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_tcb"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(2, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_const"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(3, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_ease"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(4, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_linear"),Gtk::ICON_SIZE_MENU));

	spin_tension=manage(new class Gtk::SpinButton(adj_tension,0.1,3));
	spin_tension->show();
	spin_continuity=manage(new class Gtk::SpinButton(adj_continuity,0.1,3));
	spin_continuity->show();
	spin_bias=manage(new class Gtk::SpinButton(adj_bias,0.1,3));
	spin_bias->show();
	spin_temporal_tension=manage(new class Gtk::SpinButton(adj_temporal_tension,0.1,3));
	spin_temporal_tension->show();

	set_padding(12, 12, 12, 12);

	Gtk::VBox *widgetBox = manage(new Gtk::VBox(false, 12));
	add(*widgetBox);

	Gtk::Frame *waypointFrame = manage(new Gtk::Frame(_("Waypoint")));
	waypointFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) waypointFrame->get_label_widget())->set_markup(_("<b>Waypoint</b>"));
	widgetBox->pack_start(*waypointFrame, false, false, 0);

	Gtk::Alignment *waypointPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	waypointPadding->set_padding(6, 0, 24, 0);
	waypointFrame->add(*waypointPadding);

	Gtk::Table *waypointTable = manage(new Gtk::Table(2, 2, false));
	waypointTable->set_row_spacings(6);
	waypointTable->set_col_spacings(12);
	waypointPadding->add(*waypointTable);

	Gtk::Label *waypointValueLabel = manage(new Gtk::Label(_("_Value"), true));
	waypointValueLabel->set_alignment(0, 0.5);
	waypointValueLabel->set_mnemonic_widget(*value_widget);
	waypointTable->attach(*waypointValueLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	waypointTable->attach(*value_widget, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	waypointTable->attach(*value_node_label, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *waypointTimeLabel = manage(new Gtk::Label(_("_Time"), true));
	waypointTimeLabel->set_alignment(0, 0.5);
	waypointTimeLabel->set_mnemonic_widget(*time_widget);
	waypointTable->attach(*waypointTimeLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	waypointTable->attach(*time_widget, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Frame *interpolationFrame = manage(new Gtk::Frame(_("Interpolation")));
	interpolationFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) interpolationFrame->get_label_widget())->set_markup(_("<b>Interpolation</b>"));
	widgetBox->pack_start(*interpolationFrame, false, false, 0);

	Gtk::Alignment *interpolationPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	interpolationPadding->set_padding(6, 0, 24, 0);
	interpolationFrame->add(*interpolationPadding);

	Gtk::Table *interpolationTable = manage(new Gtk::Table(2, 2, false));
	interpolationTable->set_row_spacings(6);
	interpolationTable->set_col_spacings(12);
	interpolationPadding->add(*interpolationTable);

	Gtk::Label *interpolationInLabel = manage(new Gtk::Label(_("_In Interpolation"), true));
	interpolationInLabel->set_alignment(0, 0.5);
	interpolationInLabel->set_mnemonic_widget(*before_options);
	interpolationTable->attach(*interpolationInLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	interpolationTable->attach(*before_options, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *interpolationOutLabel = manage(new Gtk::Label(_("_Out Interpolation"), true));
	interpolationOutLabel->set_alignment(0, 0.5);
	interpolationOutLabel->set_mnemonic_widget(*after_options);
	interpolationTable->attach(*interpolationOutLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	interpolationTable->attach(*after_options, 1, 2, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Frame *tcbFrame = manage(new Gtk::Frame(_("TCB Parameters")));
	tcbFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) tcbFrame->get_label_widget())->set_markup(_("<b>TCB Parameter</b>"));
	widgetBox->pack_start(*tcbFrame, false, false, 0);

	Gtk::Alignment *tcbPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	tcbPadding->set_padding(6, 0, 24, 0);
	tcbFrame->add(*tcbPadding);

	Gtk::Table *tcbTable = manage(new Gtk::Table(4, 2, false));
	tcbTable->set_row_spacings(6);
	tcbTable->set_col_spacings(12);
	tcbPadding->add(*tcbTable);

	Gtk::Label *tensionLabel = manage(new Gtk::Label(_("T_ension"), true));
	tensionLabel->set_alignment(0, 0.5);
	tensionLabel->set_mnemonic_widget(*spin_tension);
	spin_tension->set_alignment(1);
	tcbTable->attach(*tensionLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_tension, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *continuityLabel = manage(new Gtk::Label(_("_Continuity"), true));
	continuityLabel->set_alignment(0, 0.5);
	continuityLabel->set_mnemonic_widget(*spin_continuity);
	spin_continuity->set_alignment(1);
	tcbTable->attach(*continuityLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_continuity, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *biasLabel = manage(new Gtk::Label(_("_Bias"), true));
	biasLabel->set_alignment(0, 0.5);
	biasLabel->set_mnemonic_widget(*spin_bias);
	spin_bias->set_alignment(1);
	tcbTable->attach(*biasLabel, 0, 1, 2, 3, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_bias, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *temporalTensionLabel = manage(new Gtk::Label(_("Te_mporal Tension"), true));
	temporalTensionLabel->set_alignment(0, 0.5);
	temporalTensionLabel->set_mnemonic_widget(*spin_temporal_tension);
	spin_temporal_tension->set_alignment(1);
	tcbTable->attach(*temporalTensionLabel, 0, 1, 3, 4, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_temporal_tension, 1, 2, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	show_all();
	hide();
	set_canvas(canvas);
}
コード例 #9
0
 void setValueText(Glib::ustring ValueText)
 {
   mp_Value->set_text(ValueText);
 }
コード例 #10
0
         limitDialog::limitDialog()
            : limit_interval(5),
              limit_selected(false),
              selected_upload_disable(false),
              selected_download_disable(false),
              selected_seed_percent_disable(false),
              selected_seed_timer_disable(false),
              uploadCombo(0),
              downloadCombo(0),
              seedPercentSpin(0),
              seedTimeSpin(0),
              selected_upload_limit(-1),
              selected_download_limit(-1)
         {
            Gtk::Label *uploadLabel   = Gtk::manage(new class Gtk::Label("Upload"));
            Gtk::Label *downloadLabel = Gtk::manage(new class Gtk::Label("Download"));
            uploadCombo               = Gtk::manage(new class Gtk::ComboBoxText());
            downloadCombo             = Gtk::manage(new class Gtk::ComboBoxText());

            Gtk::Label *seedPercentLabel = Gtk::manage(new class Gtk::Label("Seed %"));
            Gtk::Label *seedTimeLabel    = Gtk::manage(new class Gtk::Label("Seed Time"));

            Gtk::Adjustment *seedPercentAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10));
            seedPercentSpin = Gtk::manage(new class Gtk::SpinButton(*seedPercentAdjustment, 1, 0));

            Gtk::Adjustment *seedTimeAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10));
            seedTimeSpin    = Gtk::manage(new class Gtk::SpinButton(*seedTimeAdjustment, 1, 0));

            Gtk::Table *settingsTable = Gtk::manage(new class Gtk::Table(4, 2, false));
            Gtk::VBox *limitVbox      = Gtk::manage(new class Gtk::VBox(false, 10));

            uploadLabel->set_alignment(0,0.5);
            uploadLabel->set_padding(5,0);
            uploadLabel->set_justify(Gtk::JUSTIFY_LEFT);
            uploadLabel->set_line_wrap(false);
            uploadLabel->set_use_markup(false);
            uploadLabel->set_selectable(false);

            downloadLabel->set_alignment(0,0.5);
            downloadLabel->set_padding(5,0);
            downloadLabel->set_justify(Gtk::JUSTIFY_LEFT);
            downloadLabel->set_line_wrap(false);
            downloadLabel->set_use_markup(false);
            downloadLabel->set_selectable(false);

            seedPercentLabel->set_alignment(0,0.5);
            seedPercentLabel->set_padding(5,0);
            seedPercentLabel->set_justify(Gtk::JUSTIFY_LEFT);
            seedPercentLabel->set_line_wrap(false);
            seedPercentLabel->set_use_markup(false);
            seedPercentLabel->set_selectable(false);

            seedTimeLabel->set_alignment(0,0.5);
            seedTimeLabel->set_padding(5,0);
            seedTimeLabel->set_justify(Gtk::JUSTIFY_LEFT);
            seedTimeLabel->set_line_wrap(false);
            seedTimeLabel->set_use_markup(false);
            seedTimeLabel->set_selectable(false);

            seedPercentSpin->set_flags(Gtk::CAN_FOCUS);
            seedPercentSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
            seedPercentSpin->set_numeric(false);
            seedPercentSpin->set_digits(0);
            seedPercentSpin->set_wrap(false);
            seedPercentSpin->set_range(0, MaxSeedProcent);

            seedTimeSpin->set_flags(Gtk::CAN_FOCUS);
            seedTimeSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
            seedTimeSpin->set_numeric(false);
            seedTimeSpin->set_digits(0);
            seedTimeSpin->set_wrap(false);
            seedTimeSpin->set_range(0, MaxSeedTimeout);

            uploadCombo->append_text("disable");
            downloadCombo->append_text("disable");

            for (t_int i=limit_interval; i<=200; i=i+limit_interval)
               {
                  using namespace std;
                  using namespace btg::core;
                  string s = convertToString<int>(i) + " KiB/sec";
                  uploadCombo->append_text(s);
                  downloadCombo->append_text(s);
               }

            uploadCombo->set_active(0);
            downloadCombo->set_active(0);

            settingsTable->set_border_width(10);
            settingsTable->set_row_spacings(20);
            settingsTable->set_col_spacings(5);

            /* */
            settingsTable->attach(*uploadLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*downloadLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*seedPercentLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*seedTimeLabel, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            settingsTable->attach(*seedPercentSpin, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*seedTimeSpin,    1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            settingsTable->attach(*uploadCombo, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*downloadCombo, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            limitVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0);

            set_title( GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + " / Limit" );
            set_modal(true);
            property_window_position().set_value(Gtk::WIN_POS_CENTER);
            set_resizable(true);
            property_destroy_with_parent().set_value(false);
            set_has_separator(true);

            get_vbox()->pack_start(*limitVbox);

            set_default_size(300, 200);

            uploadLabel->show();
            downloadLabel->show();

            seedPercentLabel->show();
            seedTimeLabel->show();

            uploadCombo->show();
            downloadCombo ->show();

            seedPercentSpin->show();
            seedTimeSpin->show();

            settingsTable->show();
            limitVbox->show();

            // Create buttons and connect their signals.
            add_button("Set", 1);
            add_button("Cancel", 2);
            signal_response().connect(sigc::mem_fun(*this, &limitDialog::on_button_pressed));

            get_vbox()->show();
            show();
         }
コード例 #11
0
ファイル: statusbar.cpp プロジェクト: Kaligule/gobby
Gobby::StatusBar::MessageHandle
Gobby::StatusBar::add_message(Gobby::StatusBar::MessageType type,
                              const Glib::ustring& message,
                              const Glib::ustring& dialog_message,
                              unsigned int timeout)
{
	if(m_visible_messages >= 12)
	{
		for(MessageHandle iter = m_list.begin();
		    iter != m_list.end();
		    ++iter)
		{
			if(*iter)
			{
				if((*iter)->is_error())
					remove_message(iter);
				else
					// only hide message because whoever
					// installed it is expecting to be
					// able to call remove_message on it
					hide_message(iter);
				break;
			}
		}
	}

	Gtk::Grid* grid = Gtk::manage(new Gtk::Grid());
	grid->set_column_spacing(6);
	grid->set_margin_start(2);
	grid->set_margin_end(2);

	Gtk::Image* image = Gtk::manage(new Gtk::Image);
	image->set_from_icon_name(message_type_to_icon_name(type),
	                          Gtk::ICON_SIZE_MENU);
	grid->attach(*image, 0, 0, 1, 1);
	image->show();

	Gtk::Label* label = Gtk::manage(
		new Gtk::Label(message, Gtk::ALIGN_START));
	label->set_ellipsize(Pango::ELLIPSIZE_END);

	// If we set halign instead, the label will not behave correctly
	// when ellipsized, because then it has always all space around it
	// allocated, and the alignment "jumps" around whin resizing the
	// window due to new characters appearing or disappearing as a result
	// of the ellipsization.
#if GTK_CHECK_VERSION(3, 16, 0)
	gtk_label_set_xalign(label->gobj(), 0.0);
#else
	label->set_alignment(0.0, 0.0);
#endif
	label->show();
	grid->attach(*label, 1, 0, 1, 1);

	Gtk::Frame* frame = Gtk::manage(new Gtk::Frame);

	m_list.push_back(0);
	Gobby::StatusBar::MessageHandle iter(--m_list.end());
	sigc::connection timeout_conn;
	if(timeout)
	{
		timeout_conn = Glib::signal_timeout().connect_seconds(
			sigc::bind(
				sigc::bind_return(
					sigc::mem_fun(
						*this,
						&StatusBar::remove_message),
					false),
				iter),
			timeout);
	}
	*iter = new Message(frame, message, dialog_message, timeout_conn);
	++m_visible_messages;

	if(dialog_message.empty())
	{
		frame->add(*grid);
	}
	else
	{
		Gtk::EventBox *eventbox = Gtk::manage(new Gtk::EventBox);
		frame->add(*eventbox);
		eventbox->add(*grid);
		eventbox->signal_button_press_event().connect(
			sigc::bind_return(sigc::bind(
				sigc::mem_fun(
					*this,
					&StatusBar::on_message_clicked),
				iter), false));

		eventbox->show();
	}

	grid->show();

	// Insert at front
	gtk_grid_attach_next_to(
		gobj(), GTK_WIDGET(frame->gobj()),
		NULL, GTK_POS_LEFT, 1, 1);

	frame->set_halign(Gtk::ALIGN_START);
	frame->set_hexpand(false);
	frame->set_shadow_type(Gtk::SHADOW_NONE);
	frame->show();

	return iter;
}
コード例 #12
0
ファイル: radiobutton.cpp プロジェクト: wdmchaft/DoonSketch
/**
    \brief  Creates a combobox widget for an enumeration parameter
*/
Gtk::Widget *
ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
    if (_gui_hidden) return NULL;

    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
    Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0));

    Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP));
    label->show();
    hbox->pack_start(*label, false, false);

    Gtk::ComboBoxText* cbt = 0;
    bool comboSet = false;
    if (_mode == MINIMAL) {
        cbt = Gtk::manage(new ComboWdg(this, doc, node));
        cbt->show();
        vbox->pack_start(*cbt, false, false);
    }

    // add choice strings as radiobuttons
    // and select last selected option (_value)
    Gtk::RadioButtonGroup group;
    for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
        optionentry * entr = reinterpret_cast<optionentry *>(list->data);
        Glib::ustring * text = entr->guitext;
        switch ( _mode ) {
        case MINIMAL:
        {
            cbt->append_text(*text);
            if (!entr->value->compare(_value)) {
                cbt->set_active_text(*text);
                comboSet = true;
            }
        }
        break;
        case COMPACT:
        case FULL:
        {
            ParamRadioButtonWdg * radio = Gtk::manage(new ParamRadioButtonWdg(group, *text, this, doc, node, changeSignal));
            radio->show();
            vbox->pack_start(*radio, true, true);
            if (!entr->value->compare(_value)) {
                radio->set_active();
            }
        }
        break;
        }
    }

    if ( (_mode == MINIMAL) && !comboSet) {
        cbt->set_active(0);
    }

    vbox->show();
    hbox->pack_end(*vbox, false, false);
    hbox->show();


    return dynamic_cast<Gtk::Widget *>(hbox);
}
コード例 #13
0
ファイル: utils.cpp プロジェクト: haobug/gnote
    HIGMessageDialog::HIGMessageDialog(Gtk::Window *parent,
                                       GtkDialogFlags flags, Gtk::MessageType msg_type, 
                                       Gtk::ButtonsType btn_type, const Glib::ustring & header,
                                       const Glib::ustring & msg)
      : Gtk::Dialog()
      , m_extra_widget(NULL)
    {
      set_border_width(5);
      set_resizable(false);
      set_title("");

      get_vbox()->set_spacing(12);
      get_action_area()->set_layout(Gtk::BUTTONBOX_END);

      m_accel_group = Glib::RefPtr<Gtk::AccelGroup>(Gtk::AccelGroup::create());
      add_accel_group(m_accel_group);

      Gtk::HBox *hbox = manage(new Gtk::HBox (false, 12));
      hbox->set_border_width(5);
      hbox->show();
      get_vbox()->pack_start(*hbox, false, false, 0);

      switch (msg_type) {
      case Gtk::MESSAGE_ERROR:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_ERROR,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_QUESTION:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_QUESTION,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_INFO:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_INFO,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_WARNING:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_WARNING,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      default:
        m_image = new Gtk::Image ();
        break;
      }

      if (m_image) {
        Gtk::manage(m_image);
        m_image->show();
        m_image->property_yalign().set_value(0);
        hbox->pack_start(*m_image, false, false, 0);
      }

      Gtk::VBox *label_vbox = manage(new Gtk::VBox (false, 0));
      label_vbox->show();
      hbox->pack_start(*label_vbox, true, true, 0);

      std::string title = str(boost::format("<span weight='bold' size='larger'>%1%"
                                            "</span>\n") % header.c_str());

      Gtk::Label *label;

      label = manage(new Gtk::Label (title));
      label->set_use_markup(true);
      label->set_justify(Gtk::JUSTIFY_LEFT);
      label->set_line_wrap(true);
      label->set_alignment (0.0f, 0.5f);
      label->show();
      label_vbox->pack_start(*label, false, false, 0);

      label = manage(new Gtk::Label(msg));
      label->set_use_markup(true);
      label->set_justify(Gtk::JUSTIFY_LEFT);
      label->set_line_wrap(true);
      label->set_alignment (0.0f, 0.5f);
      label->show();
      label_vbox->pack_start(*label, false, false, 0);
      
      m_extra_widget_vbox = manage(new Gtk::VBox (false, 0));
      m_extra_widget_vbox->show();
      label_vbox->pack_start(*m_extra_widget_vbox, true, true, 12);

      switch (btn_type) {
      case Gtk::BUTTONS_NONE:
        break;
      case Gtk::BUTTONS_OK:
        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
        break;
      case Gtk::BUTTONS_CLOSE:
        add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE, true);
        break;
      case Gtk::BUTTONS_CANCEL:
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, true);
        break;
      case Gtk::BUTTONS_YES_NO:
        add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO, false);
        add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES, true);
        break;
      case Gtk::BUTTONS_OK_CANCEL:
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, false);
        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
        break;
      }

      if (parent){
        set_transient_for(*parent);
      }

      if ((flags & GTK_DIALOG_MODAL) != 0) {
        set_modal(true);
      }

      if ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) != 0) {
        property_destroy_with_parent().set_value(true);
      }
    }
コード例 #14
0
         limitDialog::limitDialog(const char * _szUploadLabel, 
                                  const char * _szDownloadLabel, 
                                  const char * _szParam3Label, 
                                  const char * _szParam4Label)
            : Gtk::Dialog(btg::core::projectDefaults::sGUI_CLIENT() + " " + btg::core::projectDefaults::sFULLVERSION() + " / Limit", 
                          true /* modal */, 
                          true /* use_separator aka set_has_separator() */ ),
              limit_selected(false),
              selected_upload_disable(false),
              selected_download_disable(false),
              selected_param3_disable(false),
              selected_param4_disable(false),
              uploadCombo(0),
              downloadCombo(0),
              param3Spin(0),
              param4Spin(0),
              selected_upload_limit(-1),
              selected_download_limit(-1),
              limits()
         {
            Gtk::Label* uploadLabel   = Gtk::manage(new class Gtk::Label( _szUploadLabel ? _szUploadLabel : "Upload" ));
            Gtk::Label* downloadLabel = Gtk::manage(new class Gtk::Label( _szDownloadLabel ? _szDownloadLabel : "Download" ));
            uploadCombo               = Gtk::manage(new class Gtk::ComboBoxText());
            downloadCombo             = Gtk::manage(new class Gtk::ComboBoxText());

            Gtk::Label* seedPercentLabel = Gtk::manage(new class Gtk::Label( _szParam3Label ? _szParam3Label : "Seed %" ));
            Gtk::Label* seedTimeLabel    = Gtk::manage(new class Gtk::Label( _szParam4Label ? _szParam4Label : "Seed Time" ));

            Gtk::Adjustment* seedPercentAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10));
            param3Spin = Gtk::manage(new class Gtk::SpinButton(*seedPercentAdjustment, 1, 0));

            Gtk::Adjustment *seedTimeAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10));
            param4Spin    = Gtk::manage(new class Gtk::SpinButton(*seedTimeAdjustment, 1, 0));

            Gtk::Table* settingsTable = Gtk::manage(new class Gtk::Table(4, 2, false));
            Gtk::VBox* limitVbox      = Gtk::manage(new class Gtk::VBox(false, 10));

            uploadLabel->set_alignment(0,0.5);
            uploadLabel->set_padding(5,0);
            uploadLabel->set_justify(Gtk::JUSTIFY_LEFT);
            uploadLabel->set_line_wrap(false);
            uploadLabel->set_use_markup(false);
            uploadLabel->set_selectable(false);

            downloadLabel->set_alignment(0,0.5);
            downloadLabel->set_padding(5,0);
            downloadLabel->set_justify(Gtk::JUSTIFY_LEFT);
            downloadLabel->set_line_wrap(false);
            downloadLabel->set_use_markup(false);
            downloadLabel->set_selectable(false);

            seedPercentLabel->set_alignment(0,0.5);
            seedPercentLabel->set_padding(5,0);
            seedPercentLabel->set_justify(Gtk::JUSTIFY_LEFT);
            seedPercentLabel->set_line_wrap(false);
            seedPercentLabel->set_use_markup(false);
            seedPercentLabel->set_selectable(false);

            seedTimeLabel->set_alignment(0,0.5);
            seedTimeLabel->set_padding(5,0);
            seedTimeLabel->set_justify(Gtk::JUSTIFY_LEFT);
            seedTimeLabel->set_line_wrap(false);
            seedTimeLabel->set_use_markup(false);
            seedTimeLabel->set_selectable(false);

            param3Spin->set_flags(Gtk::CAN_FOCUS);
            param3Spin->set_update_policy(Gtk::UPDATE_ALWAYS);
            param3Spin->set_numeric(false);
            param3Spin->set_digits(0);
            param3Spin->set_wrap(false);
            param3Spin->set_range(0, MaxParam3Value);

            param4Spin->set_flags(Gtk::CAN_FOCUS);
            param4Spin->set_update_policy(Gtk::UPDATE_ALWAYS);
            param4Spin->set_numeric(false);
            param4Spin->set_digits(0);
            param4Spin->set_wrap(false);
            param4Spin->set_range(0, MaxParam4Value);

            uploadCombo->append_text("disable");
            downloadCombo->append_text("disable");

            for (t_uint i=1024; i<=maxRateInBytes; i*=2)
               {
                  using namespace btg::core;

                  humanReadableRate h = humanReadableRate::convert(i);

                  std::string s = h.toString();
                  uploadCombo->append_text(s);
                  downloadCombo->append_text(s);

                  limits.push_back(i);
               }

            uploadCombo->set_active(0);
            downloadCombo->set_active(0);

            settingsTable->set_border_width(10);
            settingsTable->set_row_spacings(20);
            settingsTable->set_col_spacings(5);

            /* */
            settingsTable->attach(*uploadLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*downloadLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*seedPercentLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*seedTimeLabel, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            settingsTable->attach(*param3Spin, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*param4Spin,    1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            settingsTable->attach(*uploadCombo, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*downloadCombo, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            limitVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0);

            property_window_position().set_value(Gtk::WIN_POS_CENTER);
            set_resizable(true);
            property_destroy_with_parent().set_value(false);

            get_vbox()->pack_start(*limitVbox);

            set_default_size(300, 200);

            // Create buttons and connect their signals.
            add_button("Set", 1);
            add_button("Cancel", 2);
            signal_response().connect(sigc::mem_fun(*this, &limitDialog::on_button_pressed));
            
            show_all(); // flag all inner elements as visible
            hide(); // hide toplevel window
         }
コード例 #15
0
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_text(mforms::ToolBarItem *item, const std::string &label) {
  const mforms::ToolBarItemType type = item->get_type();

  switch (type) {
    case mforms::TextActionItem:
    case mforms::ActionItem:
    case mforms::SegmentedToggleItem:
    case mforms::ToggleItem:
    case mforms::SwitcherItem: {
      Gtk::Button *btn = cast<Gtk::Button *>(item->get_data_ptr());
      if (type == mforms::SwitcherItem) {
        btn->set_label(label);
        btn->get_style_context()->add_class("SwitcherItem");
      } else
        btn->add_label(label);
      btn->set_name(label);
      break;
    }
    case mforms::TitleItem:
    case mforms::LabelItem: {
      Gtk::Label *lbl = cast<Gtk::Label *>(item->get_data_ptr());
      if (lbl) {
        lbl->set_markup("<small>" + label + "</small>");
        lbl->set_name(label);
      }
      break;
    }
    case mforms::FlatSelectorItem:
    case mforms::SelectorItem: {
      Gtk::ComboBoxText *ct = cast<Gtk::ComboBoxText *>(item->get_data_ptr());
      if (ct)
        ct->set_active_text(label);
      break;
    }
    case mforms::ColorSelectorItem: {
      Gtk::ComboBox *combo = cast<Gtk::ComboBox *>(item->get_data_ptr());
      if (combo) {
        Glib::RefPtr<Gtk::TreeModel> model = combo->get_model();
        if (model) {
          const Gtk::TreeModel::Children children = model->children();
          const Gtk::TreeIter last = children.end();
          Gtk::TreeRow row;

          for (Gtk::TreeIter it = children.begin(); it != last; ++it) {
            row = *it;
            if (row.get_value(color_combo_columns->color) == label) {
              combo->set_active(it);
              break;
            }
          }
        }
      }
      break;
    }
    case mforms::SearchFieldItem:
    case mforms::TextEntryItem: {
      Gtk::Entry *e = cast<Gtk::Entry *>(item->get_data_ptr());
      if (e)
        e->set_text(label);
      break;
    }
    case mforms::SeparatorItem:
    case mforms::ExpanderItem:
    case mforms::ImageBoxItem:
      break;
  }
}
コード例 #16
0
 Glib::ustring getValueText()
 {
   return mp_Value->get_text();
 }
コード例 #17
0
ファイル: FindShader.cpp プロジェクト: DerSaidin/DarkRadiant
void FindAndReplaceShader::populateWindow()
{
	Gtk::VBox* dialogVBox = Gtk::manage(new Gtk::VBox(false, 6));
	add(*dialogVBox);

	Gtk::HBox* findHBox = Gtk::manage(new Gtk::HBox(false, 0));
    Gtk::HBox* replaceHBox = Gtk::manage(new Gtk::HBox(false, 0));

    // Pack these hboxes into an alignment so that they are indented
	Gtk::Alignment* alignment = Gtk::manage(new gtkutil::LeftAlignment(*findHBox, 18, 1.0f));
	Gtk::Alignment* alignment2 = Gtk::manage(new gtkutil::LeftAlignment(*replaceHBox, 18, 1.0f));

	dialogVBox->pack_start(*alignment, true, true, 0);
	dialogVBox->pack_start(*alignment2, true, true, 0);

	// Create the labels and pack them in the hbox
	Gtk::Label* findLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_(LABEL_FIND)));
	Gtk::Label* replaceLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_(LABEL_REPLACE)));

	findLabel->set_size_request(60, -1);
	replaceLabel->set_size_request(60, -1);

	findHBox->pack_start(*findLabel, false, false, 0);
	replaceHBox->pack_start(*replaceLabel, false, false, 0);

	_findEntry = Gtk::manage(new Gtk::Entry);
	_replaceEntry = Gtk::manage(new Gtk::Entry);

	_findEntry->signal_changed().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onFindChanged));
	_replaceEntry->signal_changed().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onReplaceChanged));

	findHBox->pack_start(*_findEntry, true, true, 6);
	replaceHBox->pack_start(*_replaceEntry, true, true, 6);

	// Create the icon buttons to open the ShaderChooser and override the size request
	_findSelectButton = Gtk::manage(
		new gtkutil::IconTextButton("", GlobalUIManager().getLocalPixbuf(FOLDER_ICON))
	);
	_findSelectButton->set_size_request(-1, -1);
	_findSelectButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onChooseFind));

	_replaceSelectButton = Gtk::manage(
		new gtkutil::IconTextButton("", GlobalUIManager().getLocalPixbuf(FOLDER_ICON))
	);
	_replaceSelectButton->set_size_request(-1, -1);
	_replaceSelectButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onChooseReplace));

	findHBox->pack_start(*_findSelectButton, false, false, 0);
	replaceHBox->pack_start(*_replaceSelectButton, false, false, 0);

	Gtk::Alignment* spacer = Gtk::manage(new Gtk::Alignment(0,0,0,0));
	spacer->set_size_request(10, 2);
	dialogVBox->pack_start(*spacer, false, false, 0);

	// The checkbox for "search selected only"
	_selectedOnly = Gtk::manage(new Gtk::CheckButton(_(LABEL_SELECTED_ONLY), true));

	Gtk::Alignment* alignment3 = Gtk::manage(new gtkutil::LeftAlignment(*_selectedOnly, 18, 1.0f));
	dialogVBox->pack_start(*alignment3, false, false, 0);

	// Finally, add the buttons
	dialogVBox->pack_start(createButtons(), false, false, 0);
}
コード例 #18
0
void DocumentProperties::setupFields (Glib::ustring const &docType)
{
	Gtk::VBox *metadataBox;
  xml_->get_widget ("MetadataBox", metadataBox);
	if (metadataBox->children().size()) {
		metadataBox->children().erase(metadataBox->children().begin());
	}

	DocumentType type = typeManager_.getType (docType);

	int const nRows = type.requiredFields_.size() + type.optionalFields_.size();
	Gtk::Table *metadataTable = new Gtk::Table (nRows, 4, false);
	metadataTable->set_col_spacings (6);
	metadataTable->set_row_spacings (6);

	fieldEntries_.clear ();

	Gtk::Label *typeLabel = Gtk::manage (new Gtk::Label (_("_Type:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true));
	
	if (typecombochanged_)
		typecombochanged_.disconnect();

	typeCombo_ = Gtk::manage (new Gtk::ComboBox);
	typeCombo_->set_model(typecombostore_);
	typeCombo_->pack_start(typelabelcol_, true);
	typeCombo_->pack_start(typebibtexnamecol_, false);

	typeLabel->set_mnemonic_widget (*typeCombo_);
	metadataTable->attach (*typeLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
	metadataTable->attach (*typeCombo_, 1, 4, 0, 1, Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);

	typecombostore_->clear();
	for (DocumentTypeManager::TypesMap::iterator it = typeManager_.getTypes().begin();
			it != typeManager_.getTypes().end();
			++it) {

		Gtk::TreeModel::Row row = *(typecombostore_->append());
		row[typelabelcol_] = (*it).second.displayName_;
		row[typebibtexnamecol_] = (*it).second.bibtexName_;
	}

	typecombochanged_ = typeCombo_->signal_changed().connect (
			sigc::mem_fun (*this, &DocumentProperties::onTypeChanged));

	int row = 1;
	for (
	     std::vector<DocumentField>::iterator it = type.requiredFields_.begin();
	     it != type.requiredFields_.end();
	     ++it) {

		if (it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		/* [bert] Minor change to actually implement and register
		 * a callback for changes to the DOI field. This is a bit
		 * ugly here since it assumes we know whether DOI is 
		 * required or not.
		 */
		if (it->internalName_ == "doi") {
		  entry->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::onDoiEntryChanged));
		}

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0, 1, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1, 4, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++row;
	}
	for (
	     std::vector<DocumentField>::iterator it = type.optionalFields_.begin();
	     it != type.optionalFields_.end();
	     ++it) {

		if (it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0, 1, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1, 4, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++row;
	}

	int col = 0;
	for (
	     std::vector<DocumentField>::iterator it = type.requiredFields_.begin();
	     it != type.requiredFields_.end();
	     ++it) {

		if (!it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0 + col * 2, 1 + col * 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1 + col * 2, 2 + col * 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++col;
		if (col > 1) {
			++row;
			col = 0;
		}
	}
	for (
	     std::vector<DocumentField>::iterator it = type.optionalFields_.begin();
	     it != type.optionalFields_.end();
	     ++it) {

		if (!it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0 + col * 2, 1 + col * 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1 + col * 2, 2 + col * 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++col;
		if (col > 1) {
			++row;
			col = 0;
		}
	}

	metadataBox->pack_start (*metadataTable);
	metadataBox->show_all ();
}
コード例 #19
0
ファイル: ladspalist.cpp プロジェクト: dafx/guitarix
PluginDisplay::PluginDisplay(gx_engine::GxMachineBase& machine_, Glib::RefPtr<Gdk::Pixbuf> icon, sigc::slot<void, bool, bool> finished_callback_)
    : machine(machine_), pluginlist(), current_plugin(0), old_state(0), bld(), change_count(0),
      actiongroup(Gtk::ActionGroup::create("ladspa_window")), uimanager(),
      enum_liststore(new EnumListStore), port_liststore(new PortListStore),
      plugin_liststore(new PluginListStore), masteridx_liststore(new MasterIdxListStore),
      on_reordered_conn(), display_type_list(), display_type_list_sr(), output_type_list(),
      finished_callback(finished_callback_)
{
    std::vector<std::string> old_not_found;
    machine.load_ladspalist(old_not_found, pluginlist);
    bld = gx_gui::GxBuilder::create_from_file(machine.get_options().get_builder_filepath("ladspaliste.glade"));
    bld->get_toplevel("window1", window);
    bld->find_widget("treeview1", treeview1);
    bld->find_widget("treeview2", treeview2);
    bld->find_widget("treeview3", treeview3);
    bld->find_widget("ladspa_category", ladspa_category);
    bld->find_widget("ladspa_maker", ladspa_maker);
    bld->find_widget("ladspa_uniqueid", ladspa_uniqueid);
    bld->find_widget("search_entry", search_entry);
    bld->find_widget("combobox_mono_stereo", combobox_mono_stereo);
    bld->find_widget("selected_only", selected_only);
    bld->find_widget("changed_only", changed_only);
    bld->find_widget("ladspa_only", ladspa_only);
    bld->find_widget("lv2_only", lv2_only);
    bld->find_widget("show_all", show_all);
    bld->find_widget("details_box", details_box);
    bld->find_widget("plugin_name", plugin_name);
    bld->find_widget("plugin_category", plugin_category);
    bld->find_widget("plugin_quirks", plugin_quirks);
    bld->find_widget("master_slider_idx", master_slider_idx);
    bld->find_widget("master_slider_name", master_slider_name);
    bld->find_widget("cellrenderer_master", cellrenderer_master);
    bld->find_widget("cellrenderer_newrow", cellrenderer_newrow);
    bld->find_widget("cellrenderer_caption", cellrenderer_caption);
    bld->find_widget("cellrenderer_active", cellrenderer_active);
    bld->find_widget("cellrenderer_category", cellrenderer_category);
    bld->find_widget("cellrenderer_quirks", cellrenderer_quirks);

    set_title();
    actiongroup->add(Gtk::Action::create("FileMenuAction",_("_File")));
    save_action = Gtk::Action::create("SaveAction", _("_Ok"));
    actiongroup->add(save_action, sigc::mem_fun(this, &PluginDisplay::on_save));
    apply_action = Gtk::Action::create("ApplyAction", _("_Apply"));
    actiongroup->add(apply_action, sigc::mem_fun(this, &PluginDisplay::on_apply));
    quit_action = Gtk::Action::create("QuitAction", _("_Quit"));
    actiongroup->add(quit_action, sigc::mem_fun(this, &PluginDisplay::on_quit));
    select_all_action = Gtk::Action::create("SelectAllAction", _("_Select All"));
    actiongroup->add(select_all_action, sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_select_all), true));
    select_none_action = Gtk::Action::create("SelectNoneAction", _("Select _None"));
    actiongroup->add(select_none_action, sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_select_all), false));
    actiongroup->add(Gtk::Action::create("ViewMenuAction", _("_View")));
    Glib::RefPtr<Gtk::Action> act = Gtk::Action::create("FindAction", _("_Find"));
    actiongroup->add(act, sigc::mem_fun(this, &PluginDisplay::on_find));

    uimanager = Gtk::UIManager::create();
    uimanager->insert_action_group(actiongroup, 0);
    uimanager->add_ui_from_string(menudef);
    //uimanager->get_widget("/ladspalist");
    //Gtk::HBox *ww; bld->find_widget("menubox", ww); ww->pack_start(*uimanager->get_widget("/ladspalist"));
    window->add_accel_group(uimanager->get_accel_group());

    window->signal_delete_event().connect(sigc::mem_fun(this, &PluginDisplay::on_delete_event));
    bld->find_widget("show_details", show_details);
    show_details->signal_clicked().connect(sigc::mem_fun(this, &PluginDisplay::on_show_details));
    treeview3->get_selection()->set_mode(Gtk::SELECTION_BROWSE);
    treeview3->set_model(enum_liststore);
    Gtk::CellRendererText *r;
    bld->find_widget("cellrenderer_label", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_label_edited));
    Gtk::TreeViewColumn *c;
    bld->find_widget("treeviewcolumn_label", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_label));
    
    bld->find_widget("dry_wet_button", dry_wet_button);
    dry_wet_button->signal_clicked().connect(sigc::mem_fun(this, &PluginDisplay::on_add_dry_wet_controller));
   // dry_wet_button->set_active(current_plugin->add_wet_dry);

    Glib::RefPtr<Gtk::TreeSelection> sel = treeview2->get_selection();
    sel->set_mode(Gtk::SELECTION_BROWSE);
    sel->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::on_parameter_selection_changed));
    on_reordered_conn = port_liststore->signal_row_deleted().connect(sigc::mem_fun(this, &PluginDisplay::on_reordered));
    treeview2->set_model(port_liststore);

    CellRendererComboDerived *rd;
    bld->find_widget_derived("cellrenderer_type", rd, sigc::ptr_fun(CellRendererComboDerived::create_from_builder));
    rd->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_type_edited));
    bld->find_widget("treeviewcolumn_type", c);
    c->set_cell_data_func(*rd, sigc::mem_fun(this, &PluginDisplay::display_type));

    bld->find_widget_derived("cellrenderer_step", rd, sigc::ptr_fun(CellRendererComboDerived::create_from_builder));
    rd->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_step_edited));
    bld->find_widget("treeviewcolumn_step", c);
    c->set_cell_data_func(*rd, sigc::mem_fun(this, &PluginDisplay::display_step));

    cellrenderer_newrow->signal_toggled().connect(sigc::mem_fun(this, &PluginDisplay::on_newrow_toggled));
    Gtk::Label *label = new Gtk::Label("N");
    label->set_tooltip_text(_("start a new row of controls in the rackbox unit"));
    label->show();
    bld->find_widget("treeviewcolumn_newrow", c);
    c->set_widget(*manage(label));
    c->set_cell_data_func(*cellrenderer_newrow, sigc::mem_fun(this, &PluginDisplay::display_newrow));
    cellrenderer_caption->signal_toggled().connect(sigc::mem_fun(this, &PluginDisplay::on_caption_toggled));
    label = new Gtk::Label("C");
    label->set_tooltip_text(_("display the name as caption above the control"));
    label->show();
    bld->find_widget("treeviewcolumn_caption", c);
    c->set_widget(*manage(label));
    c->set_cell_data_func(*cellrenderer_caption, sigc::mem_fun(this, &PluginDisplay::display_caption));

    bld->find_widget("cellrenderer_name", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_name_edited));
    bld->find_widget("treeviewcolumn_name", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_name));
    bld->find_widget("cellrenderer_dflt", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_dflt_edited));
    bld->find_widget("treeviewcolumn_dflt", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_default));
    bld->find_widget("cellrenderer_low", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_low_edited));
    bld->find_widget("treeviewcolumn_low", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_lower));
    bld->find_widget("cellrenderer_up", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_up_edited));
    bld->find_widget("treeviewcolumn_up", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_upper));
    bld->find_widget("cellrenderer_idx", r);
    bld->find_widget("treeviewcolumn_idx", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_idx));

    bld->find_widget("treeviewcolumn_SR", c);
    label = new Gtk::Label("SR");
    label->set_tooltip_text(_("marked rows: range depends on samplerate; using 44100 as fixed value"));
    label->show();
    c->set_widget(*manage(label));
    Gtk::CellRendererToggle *t;
    bld->find_widget("cellrenderer_SR", t);
    c->set_cell_data_func(*t, sigc::mem_fun(this, &PluginDisplay::display_SR));

    Gtk::TreeModelColumnRecord recdef;
    Gtk::TreeModelColumn<Glib::ustring> strcol;
    Gtk::TreeModelColumn<DisplayType> intcol;
    recdef.add(strcol);
    recdef.add(intcol);
    display_type_list = Gtk::ListStore::create(recdef);
    append_displaytype(display_type_list, tp_scale);
    append_displaytype(display_type_list, tp_scale_log);
    append_displaytype(display_type_list, tp_toggle);
    append_displaytype(display_type_list, tp_int);
    append_displaytype(display_type_list, tp_enum);
    append_displaytype(display_type_list, tp_none);
    display_type_list_sr = Gtk::ListStore::create(recdef);
    append_displaytype(display_type_list_sr, tp_scale);
    append_displaytype(display_type_list_sr, tp_scale_log);
    append_displaytype(display_type_list_sr, tp_none);
    output_type_list = Gtk::ListStore::create(recdef);
    append_displaytype(output_type_list, tp_display);
    append_displaytype(output_type_list, tp_display_toggle);
    append_displaytype(output_type_list, tp_none);

    treeview1->signal_row_activated().connect(sigc::mem_fun(this, &PluginDisplay::on_row_activated));
    treeview1->set_search_equal_func(sigc::mem_fun(this,&PluginDisplay::search_equal));
    Gtk::Entry *e;
    bld->find_widget("search_entry", e);
    e->signal_activate().connect(sigc::mem_fun(this, &PluginDisplay::on_search_entry_activate));
    treeview1->set_search_entry(*e);
    sel = treeview1->get_selection();
    sel->set_mode(Gtk::SELECTION_BROWSE);
    sel->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::selection_changed));
    treeview1->set_model(plugin_liststore);
    cellrenderer_active->signal_toggled().connect(sigc::mem_fun(this, &PluginDisplay::on_active_toggled));
    bld->find_widget("cellrenderer_ladspa", r);
    bld->find_widget("treeviewcolumn_ladspa", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_ladspa));

    Gtk::ComboBox *cb;
    bld->find_widget("plugin_category", cb);
    cb->set_cell_data_func(*cellrenderer_category, sigc::mem_fun(this, &PluginDisplay::display_category));
    bld->find_widget("plugin_quirks", cb);
    cb->set_cell_data_func(*cellrenderer_quirks, sigc::mem_fun(this, &PluginDisplay::display_quirks));

    master_slider_idx->set_cell_data_func(*cellrenderer_master, sigc::mem_fun(this, &PluginDisplay::display_master_idx));
    master_slider_idx->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::set_master_text));

    selected_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), selected_only));
    changed_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), changed_only));
    ladspa_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), ladspa_only));
    lv2_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), lv2_only));
    show_all->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), show_all));

    bld->find_widget("combobox_mono_stereo", cb);
    cb->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::on_mono_stereo_changed));
    cb->set_active(0);
    Gtk::Button *b;
    bld->find_widget("reset_changes", b);
    b->signal_clicked().connect(sigc::mem_fun(this, &PluginDisplay::on_delete_changes));

    bld->find_widget("master_slider_idx", cb);
    cb->set_model(masteridx_liststore);

    bld->find_widget("button_cancel", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("QuitAction")->gobj());
    bld->find_widget("button_apply", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("ApplyAction")->gobj());
    bld->find_widget("button_save", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("SaveAction")->gobj());
    bld->find_widget("select_all", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("SelectAllAction")->gobj());
    bld->find_widget("select_none", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("SelectNoneAction")->gobj());

    window->set_icon(icon);
    window->show();
}
コード例 #20
0
         sessionSelectionDialog::sessionSelectionDialog(std::string const& _title,
                                                        t_longList const& _sessionIDs, 
                                                        t_strList const& _sessionsNames,
                                                        bool const _disableSelection)
            : disableSelection_(_disableSelection),
              selected(false),
              session(Command::INVALID_SESSION),
              cbt(0)
         {
            Gtk::Button* cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel")));
            Gtk::Button* okbutton     = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok")));
            Gtk::Label* label = Gtk::manage(new class Gtk::Label(_title));

            cbt                   = Gtk::manage(new class Gtk::ComboBoxText());
            Gtk::VBox* vbox       = Gtk::manage(new class Gtk::VBox(false, 0));

            cancelbutton->set_flags(Gtk::CAN_FOCUS);
            cancelbutton->set_relief(Gtk::RELIEF_NORMAL);
            okbutton->set_flags(Gtk::CAN_FOCUS);
            okbutton->set_relief(Gtk::RELIEF_NORMAL);
            get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END);
            label->set_alignment(0.5,0.5);
            label->set_padding(0,0);
            label->set_justify(Gtk::JUSTIFY_LEFT);
            label->set_line_wrap(false);
            label->set_use_markup(false);
            label->set_selectable(false);

            vbox->pack_start(*label, Gtk::PACK_SHRINK, 0);
            vbox->pack_start(*cbt);
            get_vbox()->set_homogeneous(false);
            get_vbox()->set_spacing(0);
            get_vbox()->pack_start(*vbox);

            set_title(_title);
            set_modal(true);
            property_window_position().set_value(Gtk::WIN_POS_NONE);
            set_resizable(true);
            property_destroy_with_parent().set_value(false);
            set_has_separator(true);
            add_action_widget(*cancelbutton, -6);
            add_action_widget(*okbutton, -5);

            /// Fill the combobox with session ids.
            t_strListCI sessionNameIter = _sessionsNames.begin();
            for (t_longListCI sessionIter = _sessionIDs.begin();
                 sessionIter != _sessionIDs.end();
                 sessionIter++)
               {
                  std::string session_descr = convertToString<t_long>(*sessionIter);
                  session_descr += " (";
                  session_descr += *sessionNameIter;
                  session_descr += ")";

                  cbt->append_text(session_descr);
                  sessionNameIter++;
               }

            // Select the first session id.
            cbt->set_active(0);

            if (!disableSelection_)
               {
                  cancelbutton->show();
               }

            okbutton->show();
            label->show();
            cbt->show();
            vbox->show();
            show();

            // Connect buttons to handlers.
            okbutton->signal_clicked().connect(sigc::mem_fun(*this, &sessionSelectionDialog::on_ok_clicked));
            if (!disableSelection_)
               {
                  cancelbutton->signal_clicked().connect(sigc::mem_fun(*this, &sessionSelectionDialog::on_cancel_clicked));
               }
         }
コード例 #21
0
ファイル: profile_selection.cpp プロジェクト: KoKuToru/gTox
void profile_selection::set_accounts(const std::vector<std::string>& accounts) {
    utils::debug::scope_log log(DBG_LVL_1("gtox"), {});
    m_accounts = accounts;

    Glib::ustring tox_name;
    Glib::ustring tox_status;
    toxmm::contactAddrPublic tox_addr;

    for (auto acc : accounts) {
        int tox_error = 0;
        bool can_write = false;

        //TRY TO LOAD TOX DATA
        try {
            toxmm::core::try_load(acc, tox_name, tox_status, tox_addr, can_write);
            if (tox_name.empty()) {
                tox_name = tox_addr;
            }
        } catch (toxmm::exception exception) {
            if (exception.type() == typeid(TOX_ERR_NEW)) {
                switch (exception.what_id()) {
                    case TOX_ERR_NEW_LOAD_BAD_FORMAT:
                        tox_error = 1;
                        break;
                    case TOX_ERR_NEW_LOAD_ENCRYPTED:
                        tox_error = 2;
                        break;
                    default:
                        tox_error = 3;
                        break;
                }
            } else {
                tox_error = 3;
            }
        } catch (std::exception exp) {
            std::cerr << "Couldn't load profile \"" + acc + "\"" << std::endl;
            std::cerr << exp.what() << std::endl;
            tox_error = 3;
        } catch (...) {
            std::cerr << "Couldn't load profile \"" + acc + "\"" << std::endl;
            std::cerr << "Unexpected error" << std::endl;
            tox_error = 3;
        }

        utils::debug::scope_log log(DBG_LVL_2("gtox"), {});
        utils::builder builder = Gtk::Builder::create_from_resource("/org/gtox/ui/list_item_profile.ui");
        Gtk::ListBoxRow* row = nullptr;
        builder->get_widget("pofile_list_item", row);
        if (row) {
            Gtk::Label* name = nullptr;
            Gtk::Label* status = nullptr;
            Gtk::Label* path = nullptr;
            builder.get_widget("name", name);
            builder.get_widget("status", status);
            builder.get_widget("path", path);
            builder.get_widget_derived<widget::avatar>("avatar", tox_addr);

            path->set_text(acc);
            row->set_sensitive(false);
            switch (tox_error) {
                case 0:
                    name->set_text(tox_name);
                    status->set_text(tox_status);
                    if (can_write) {
                        row->set_sensitive(true);
                    }
                    break;
                case 1:
                    name->set_text(_("Corrupted profile"));
                    status->set_text(_("Profile couldn't be loaded"));
                    break;
                case 2:
                    name->set_text(_("Encrypted profile"));
                    status->set_text(_("Profile couldn't be loaded"));
                    break;
                default:
                    name->set_text(_("Profile not loaded for an unknown reason"));
                    status->set_text(_("Profile couldn't be loaded"));
                    break;
            }

            //reveale profil
            Gtk::Revealer* revealer;
            builder.get_widget("revealer", revealer);
            revealer->set_reveal_child(true);

            row->show();
            m_profile_list->add(*row);
        }
    }

    m_revealer->set_reveal_child(false);
}
コード例 #22
0
 void setLabelText(std::string TextLabel)
 {
     m_Label->set_markup(Glib::ustring::compose("<b>%1</b>", TextLabel));
 }
コード例 #23
0
ファイル: View.cpp プロジェクト: kimyousee/straights_game
// Creates buttons with labels. Sets butBox elements to have the same size, 
// with 10 pixels between widgets
View::View(Controller *c, Model *m) : model_(m), controller_(c), hand_(true,10), table_(true,10), gameBox_(false,10) {
	nullCardPixbuf_ = deck_.getNullCardImage();
	
	// Sets some properties of the window.
	set_title( "Straights UI" );
	//Gtk::JUSTIFY_CENTER
	set_default_size( 750, 500 );

	add ( gameBox_ );

	Gtk::HBox* menu = Gtk::manage( new Gtk::HBox() );

	// Make the start button
	startButton_.signal_clicked().connect( sigc::mem_fun( *this, &View::on_start_game_clicked_) );
	startButton_.add_label("Start New Game");

	endButton_.signal_clicked().connect( sigc::mem_fun( *this, &View::on_end_game_clicked_) );
	endButton_.add_label("End Current Game");

	menu->pack_start( startButton_);
	menu->pack_start( endButton_);

	gameBox_.pack_start( *menu, Gtk::PACK_SHRINK );

	Gtk::VBox* cardArea = Gtk::manage( new Gtk::VBox() );
	Gtk::Label *cardLabel = new Gtk::Label( "Cards on the table:" );
	cardLabel->set_alignment( Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP );
	cardArea->pack_start( *cardLabel);
	gameBox_.pack_start( *cardArea, Gtk::PACK_SHRINK );
	cardLabel->show();

	for (int j = 0; j < 4; j++) {
		for (int i = 0; i < 13; i++ ) {
			cards_[j][i] = new Gtk::Image( nullCardPixbuf_ );
			suit_[j].pack_start( *cards_[j][i] );
		}
		table_.pack_start( suit_[j], Gtk::PACK_SHRINK, true, 0 );
	}
	gameBox_.pack_start( table_, Gtk::PACK_SHRINK, true, 0 );

	/*
	for (int i = 0; i < 4; i++ ) {
		pScore_.push_back(0);
		pDiscards_.push_back(0);
	}
	*/

	for ( int i = 0; i < 4; i++ ) {
		Gtk::VBox* playerArea = Gtk::manage( new Gtk::VBox(true, 0 ) );

		playerRagequit_[i].set_label( "Rage!" );
		playerRagequit_[i].signal_clicked().connect( sigc::bind(sigc::mem_fun( *this, &View::on_rage_clicked_ ), i) );
		stringstream temp_i; temp_i << (i+1);
		Gtk::Label *playerLabel = new Gtk::Label( "Player " + temp_i.str() );
		playerRagequit_[i].set_sensitive(false);
		playerLabel->set_alignment( Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP );
		//stringstream temp_score; temp_score << pScore_[i];
		pScore_.push_back(0);
		playerScore_[i] = new Gtk::Label( "0 points" );
		//stringstream temp_disc; temp_disc << pDiscards_[i];
		pDiscards_.push_back(0);
		playerDiscards_[i] = new Gtk::Label( " 0 discards" );

		playerArea->pack_start( *playerLabel );
		playerArea->pack_start( playerRagequit_[i] );
		playerArea->pack_start( *playerScore_[i] );
		playerArea->pack_start( *playerDiscards_[i] );

		playerFrame_[i].add( *playerArea );
		player_.pack_start( playerFrame_[i]);
	}

	gameBox_.pack_start( player_, Gtk::PACK_SHRINK, true, 0 );


	Gtk::VBox* handArea = Gtk::manage( new Gtk::VBox() );
	Gtk::Label *handLabel = new Gtk::Label( "Your Hand:" );
	handLabel->set_alignment( Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP );
	handArea->pack_start( *handLabel);
	gameBox_.pack_start( *handArea, Gtk::PACK_SHRINK );
	handLabel->show();

	//Display empty 13 cards
	for (int i = 0; i < 13; i++) { 
		Gtk::Image *image = Gtk::manage( new Gtk::Image ( nullCardPixbuf_ ) );
		currentHand_[i].set_image( *image );
		currentHand_[i].set_sensitive(false);
		currentHand_[i].signal_clicked().connect( sigc::bind(sigc::mem_fun( *this, &View::on_card_clicked_ ), i) );
		hand_.pack_start( currentHand_[i], Gtk::PACK_SHRINK, true, 0 );
	}

	gameBox_.pack_start( hand_, Gtk::PACK_SHRINK);

	Gtk::VBox* playerLegalCardsArea = Gtk::manage( new Gtk::VBox() );
	playerLegalCards_ = new Gtk::Label( "" );
	playerLegalCards_->set_padding ( 10, 10 );
	playerLegalCardsArea->pack_start( *playerLegalCards_ );
	gameBox_.pack_start( *playerLegalCardsArea );

	Gtk::VBox* playerTurnArea = Gtk::manage( new Gtk::VBox() );
	playerTurn_ = new Gtk::Label( "" );
	// playerTurn_->override_color(Gdk::RGBA("red"));
	playerTurn_->set_padding ( 15, 15 );
	playerTurnArea->pack_start( *playerTurn_ );
	gameBox_.pack_start( *playerTurnArea );

	// Register view as observer of model
	model_->subscribe(this);

	// The final step is to display the buttons (they display themselves)
	show_all();
}
コード例 #24
0
MarketBuildOptionsDialog::MarketBuildOptionsDialog(const std::string& CommonBuildOptions, const std::string& BuildOptions, const std::string FuncID)
: Gtk::Dialog(), m_CommonBuildOptions(CommonBuildOptions),m_BuildOptions(BuildOptions),m_FuncID(FuncID)
{

  set_size_request(450,-1);
  set_border_width(6);

  Gtk::Label* InfoLabel = Gtk::manage(new Gtk::Label());
  InfoLabel->set_markup(std::string("<i>")+_("These options control the builds of source packages.\nChanging this is at your own risk.")+std::string("</i>"));
  InfoLabel->set_justify(Gtk::JUSTIFY_CENTER);

  get_vbox()->pack_start(*InfoLabel);

  Gtk::Label* CommonOptsLabel = Gtk::manage(new Gtk::Label());

  if (!FuncID.empty())
    CommonOptsLabel->set_markup(_("<u>Common source build options:</u>\n")
                                +openfluid::tools::ReplaceEmptyString(CommonBuildOptions,_("<i>none</i>")));
  else
    CommonOptsLabel->set_label("");

  CommonOptsLabel->set_alignment(0,0.5);
  get_vbox()->pack_start(*CommonOptsLabel,Gtk::PACK_SHRINK,12);


  Gtk::Label* EditLabel = Gtk::manage(new Gtk::Label());
  if (!FuncID.empty())
  {
    EditLabel->set_label(_("Specific build options for ")+FuncID+_(":"));
  }
  else
  {
    EditLabel->set_label(_("Common source build options:"));
  }
  EditLabel->set_alignment(0,0.5);
  get_vbox()->pack_start(*EditLabel);

  if (FuncID.empty()) m_OptionsEntry.set_text(CommonBuildOptions);
  else m_OptionsEntry.set_text(BuildOptions);
  get_vbox()->pack_start(m_OptionsEntry);

  add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

  if(m_FuncID.empty())
    set_title(_("Common build options for all source packages"));
  else
    set_title(_("Build options for ") + m_FuncID);


  show_all_children();
}
コード例 #25
0
ファイル: bugzillapreferences.cpp プロジェクト: haobug/gnote
BugzillaPreferences::BugzillaPreferences()
    : Gtk::VBox(false, 12)
{
    _init_static();
    last_opened_dir = Glib::get_home_dir();

    Gtk::Label *l = manage(new Gtk::Label (_("You can use any bugzilla just by dragging links "
                                           "into notes.  If you want a special icon for "
                                           "certain hosts, add them here.")));
    l->property_wrap() = true;
    l->property_xalign() = 0;

    pack_start(*l, false, false, 0);

    icon_store = Gtk::ListStore::create(m_columns);
    icon_store->set_sort_column(m_columns.host, Gtk::SORT_ASCENDING);

    icon_tree = manage(new Gtk::TreeView (icon_store));
    icon_tree->set_headers_visible(true);
    icon_tree->get_selection()->set_mode(Gtk::SELECTION_SINGLE);
    icon_tree->get_selection()->signal_changed().connect(
        sigc::mem_fun(*this, &BugzillaPreferences::selection_changed));

    Gtk::TreeViewColumn *host_col = manage(new Gtk::TreeViewColumn(_("Host Name"), m_columns.host));
    host_col->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
    host_col->set_resizable(true);
    host_col->set_expand(true);
    host_col->set_min_width(200);

    host_col->set_sort_column(m_columns.host);
    host_col->set_sort_indicator(false);
    host_col->set_reorderable(false);
    host_col->set_sort_order(Gtk::SORT_ASCENDING);

    icon_tree->append_column (*host_col);

    Gtk::TreeViewColumn *icon_col = manage(new Gtk::TreeViewColumn(_("Icon"), m_columns.icon));
    icon_col->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED);
    icon_col->set_max_width(50);
    icon_col->set_min_width(50);
    icon_col->set_resizable(false);

    icon_tree->append_column (*icon_col);

    Gtk::ScrolledWindow *sw = manage(new Gtk::ScrolledWindow ());
    sw->set_shadow_type(Gtk::SHADOW_IN);
    sw->property_height_request() = 200;
    sw->property_width_request() = 300;
    sw->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    sw->add (*icon_tree);

    pack_start(*sw, true, true, 0);

    add_button = manage(new Gtk::Button (Gtk::Stock::ADD));
    add_button->signal_clicked().connect(
        sigc::mem_fun(*this, &BugzillaPreferences::add_clicked));

    remove_button = manage(new Gtk::Button (Gtk::Stock::REMOVE));
    remove_button->set_sensitive(false);
    remove_button->signal_clicked().connect(
        sigc::mem_fun(*this,  &BugzillaPreferences::remove_clicked));

    Gtk::HButtonBox *hbutton_box = manage(new Gtk::HButtonBox ());
    hbutton_box->set_layout(Gtk::BUTTONBOX_START);
    hbutton_box->set_spacing(6);

    hbutton_box->pack_start(*add_button);
    hbutton_box->pack_start(*remove_button);
    pack_start(*hbutton_box, false, false, 0);

    show_all ();
}
コード例 #26
0
ファイル: Light.cpp プロジェクト: pviswanathan/DynamO
  void
  RLight::initGTK()
  {
    _optList.reset(new Gtk::VBox);

    { //Intensity
      Gtk::HBox* box = manage(new Gtk::HBox);
      box->show();
      
      {
	Gtk::Label* label = manage(new Gtk::Label("Intensity and Color", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _intensityEntry.reset(new Gtk::Entry);
      box->pack_start(*_intensityEntry, false, false);
      _intensityEntry->show(); _intensityEntry->set_width_chars(7);
      _intensityEntry->set_text(boost::lexical_cast<std::string>(_intensity));

      _intensityEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_intensityEntry));
      _intensityEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      {
	_lightColor.reset(new Gtk::ColorButton);
	_lightColor->set_use_alpha(false);
	Gdk::Color color;
	color.set_rgb(_color[0] * G_MAXUSHORT, _color[1] * G_MAXUSHORT, _color[2] * G_MAXUSHORT);
	_lightColor->set_color(color);
	box->pack_start(*_lightColor, false, false);
	_lightColor->show();

	_lightColor->signal_color_set().connect(sigc::mem_fun(*this, &RLight::guiUpdate));
      }

      {
	Gtk::Label* label = manage(new Gtk::Label("Attenuation", 0.95, 0.5));
	box->pack_start(*label, true, true);
	label->show();
      }

      _attenuationEntry.reset(new Gtk::Entry);
      box->pack_start(*_attenuationEntry, false, false);
      _attenuationEntry->show(); _attenuationEntry->set_width_chars(7);
      _attenuationEntry->set_text(boost::lexical_cast<std::string>(_attenuation));

      _attenuationEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_attenuationEntry));
      _attenuationEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _optList->pack_start(*box, false, false); 
    }

    { //Specular
      Gtk::HBox* box = manage(new Gtk::HBox);
      box->show();

      {
	Gtk::Label* label = manage(new Gtk::Label("Specular Exponent", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _specularExponentEntry.reset(new Gtk::Entry);
      box->pack_start(*_specularExponentEntry, false, false);
      _specularExponentEntry->show(); _specularExponentEntry->set_width_chars(7);
      _specularExponentEntry->set_text(boost::lexical_cast<std::string>(_specularExponent));

      _specularExponentEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularExponentEntry));
      _specularExponentEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      {
	Gtk::Label* label = manage(new Gtk::Label("Specular Strength", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _specularFactorEntry.reset(new Gtk::Entry);
      box->pack_start(*_specularFactorEntry, false, false);
      _specularFactorEntry->show(); _specularFactorEntry->set_width_chars(7);
      _specularFactorEntry->set_text(boost::lexical_cast<std::string>(_specularFactor));

      _specularFactorEntry->signal_changed()
	.connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _specularFactorEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _optList->pack_start(*box, false, false);
    }

    { //Specular
      Gtk::HBox* box = manage(new Gtk::HBox);
      box->show();

      {
	Gtk::Label* label = manage(new Gtk::Label("Position", 0.95, 0.5));
	box->pack_start(*label, true, true); 
	label->show();
      }

      _positionXEntry.reset(new Gtk::Entry);
      box->pack_start(*_positionXEntry, false, false);
      _positionXEntry->show();
      _positionXEntry->set_width_chars(7);
      _positionXEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[0]));
      _positionXEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _positionXEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _positionYEntry.reset(new Gtk::Entry);
      box->pack_start(*_positionYEntry, false, false);
      _positionYEntry->show();
      _positionYEntry->set_width_chars(7);
      _positionYEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[1]));
      _positionYEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _positionYEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _positionZEntry.reset(new Gtk::Entry);
      box->pack_start(*_positionZEntry, false, false);
      _positionZEntry->show();
      _positionZEntry->set_width_chars(7);
      _positionZEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[2]));
      _positionZEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry));
      _positionZEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate));

      _optList->pack_start(*box, false, false);
    }

    _optList->show();

    guiUpdate();
  }
コード例 #27
0
ファイル: canvasproperties.cpp プロジェクト: d-j-a-y/synfig
CanvasProperties::CanvasProperties(Gtk::Window& parent,etl::handle<synfigapp::CanvasInterface> canvas_interface):
	Gtk::Dialog(_("Canvas Properties"),parent),
	canvas_interface_(canvas_interface)
{
	widget_rend_desc.show();
	widget_rend_desc.signal_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::on_rend_desc_changed));

	Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	dialogPadding->set_padding(12, 12, 12, 12);
	get_vbox()->pack_start(*dialogPadding, false, false, 0);

	Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
	dialogPadding->add(*dialogBox);

	Gtk::Frame *info_frame=manage(new Gtk::Frame(_("Canvas Info")));
	info_frame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) info_frame->get_label_widget())->set_markup(_("<b>Canvas Info</b>"));
	dialogBox->pack_start(*info_frame, false, false, 0);

	Gtk::Alignment *infoPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	infoPadding->set_padding(6, 0, 24, 0);
	info_frame->add(*infoPadding);

	Gtk::Table *info_table=manage(new Gtk::Table(2,2,false));
	info_table->set_row_spacings(6);
	info_table->set_col_spacings(12);
	infoPadding->add(*info_table);

	// The root canvas doesn't have an ID, so don't
	// display it if this is a root canvas.
	if(!canvas_interface_->get_canvas()->is_root())
	{
		Gtk::Label *idLabel = manage(new Gtk::Label(_("_ID"), true));
		idLabel->set_alignment(0, 0.5);
		idLabel->set_mnemonic_widget(entry_id);
		info_table->attach(*idLabel, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
		info_table->attach(entry_id, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	}
	Gtk::Label *nameLabel = manage(new Gtk::Label(_("_Name"), true));
	nameLabel->set_alignment(0, 0.5);
	nameLabel->set_mnemonic_widget(entry_name);
	Gtk::Label *descriptionLabel = manage(new Gtk::Label(_("_Description"), true));
	descriptionLabel->set_alignment(0, 0.5);
	descriptionLabel->set_mnemonic_widget(entry_description);
	info_table->attach(*nameLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	info_table->attach(*descriptionLabel, 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	info_table->attach(entry_name, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	info_table->attach(entry_description, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);

	dialogBox->pack_start(widget_rend_desc, false, false, 0);

	canvas_interface_->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh));
	canvas_interface_->signal_id_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh));

	Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
	ok_button->show();
	add_action_widget(*ok_button,2);
	ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_ok_pressed));

	Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
	apply_button->show();
	add_action_widget(*apply_button,1);
	apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_apply_pressed));

	Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
	cancel_button->show();
	add_action_widget(*cancel_button,0);
	cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_cancel_pressed));

	//set_default_response(1);

	get_vbox()->show_all();
	refresh();

	update_title();
}
コード例 #28
0
//------------------------------------------------------------------------------
void DbMySQLTableEditorFKPage::update_fk_details()
{
  ::bec::FKConstraintListBE        *fk_be         = _be->get_fks();
  fk_be->refresh();

  ::bec::FKConstraintColumnsListBE *fk_columns_be = fk_be->get_columns();
  fk_columns_be->refresh();
  
  std::string text;
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::OnUpdate, text);
  set_selected_combo_item(_fk_update_combo, text);

  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::OnDelete, text);
  set_selected_combo_item(_fk_delete_combo, text);
  
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::Comment, text);
  Gtk::TextView *fk_comment(0);
  _xml->get_widget("fk_comment", fk_comment);
  fk_comment->get_buffer()->set_text(text);

  Gtk::Label *label;
  _xml->get_widget("fk_index_name", label);
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::Index, text);
  else
    text = "";
  label->set_text(text);

  ssize_t model_only= 0;
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::ModelOnly, model_only);
  _fk_model_only->set_active(model_only!=0);

  // Update columns
  _fk_columns_tv->unset_model();
  if ( fk_columns_be->count() >= 1 && _fk_node.is_valid() && _fk_node.back() < _be->get_fks()->real_count())
  {
    _fk_columns_tv->remove_all_columns();
  
    _fk_columns_model = ListModelWrapper::create(fk_columns_be, _fk_columns_tv, "FKColumnsModel");
    
    _fk_columns_model->model().append_check_column(bec::FKConstraintColumnsListBE::Enabled, "", EDITABLE);
    _fk_columns_model->model().append_string_column(bec::FKConstraintColumnsListBE::Column, "Column", RO, NO_ICON);
    const std::vector<std::string> list;
    _fk_columns_model->model().append_combo_column(::bec::FKConstraintColumnsListBE::RefColumn
                                                   ,"Referenced Column"
                                                   ,model_from_string_list(list)
                                                   ,EDITABLE
                                                   ,true);

    _fk_columns_tv->set_model(_fk_columns_model);
    
    // Connect signal so we can fill referenced columns combobox cell with correct values
    _fkcol_cell_edit_conn.disconnect();
    Gtk::CellRendererCombo* rend = static_cast<Gtk::CellRendererCombo*>(_fk_columns_tv->get_column_cell_renderer(2));
    if ( rend )
    {
    _fkcol_cell_edit_conn = rend->signal_editing_started().
                             connect(sigc::mem_fun(this, &DbMySQLTableEditorFKPage::fkcol_cell_editing_started)
                            );
    }
    else
        g_message("REND is 0!");

    _fk_update_combo->set_sensitive(true);
    _fk_delete_combo->set_sensitive(true);
    fk_comment->set_sensitive(true);
    _fk_model_only->set_sensitive(true);
  }
  else
  {
    _fk_update_combo->set_sensitive(false);
    _fk_delete_combo->set_sensitive(false);
    fk_comment->set_sensitive(false);
    _fk_model_only->set_sensitive(false);
  }
}
コード例 #29
0
MESignPostInfoDialog::MESignPostInfoDialog(
      OldConnection* conn, uint32 toNodeID, MEMapArea* mapArea)
{

   m_connection = conn;
   m_toNodeID = toNodeID;
   m_mapArea = mapArea;
   m_editSpDialog = NULL;

   char tmpStr[256];
   sprintf( tmpStr, "%s, 0x%x",
            "Sign post info", m_mapArea->getMap()->getMapID() );
   set_title(tmpStr);
   
   // list with all sign posts for this connection
   Gtk::Frame* frame = manage(new Gtk::Frame("Signposts:"));

   // Create ListStore and add to TreeView
   m_listStore = Gtk::ListStore::create(m_columns);
   m_treeView.set_model(m_listStore);

   // Add visible columns to TreeView
   m_treeView.append_column("REMOVE ME", m_columns.m_info);
   m_treeView.set_headers_visible(false);

   // Create selection object to handle selections
   m_selection = m_treeView.get_selection();
   if(!m_selection)
   { 
      // If this doesn't work we're in trouble.
      mc2log << error << "No selection object created for corresponding "
             << "TreeView" << endl;
      MC2_ASSERT(false);
   }


   Gtk::ScrolledWindow* scrolledWin = manage(new Gtk::ScrolledWindow());
   scrolledWin->set_size_request(200, 150);
   scrolledWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrolledWin->add(m_treeView);
   frame->add(*scrolledWin);
   get_vbox()->pack_start(*frame, true, true, 5);

   // buttons for Edit and Close in the action area
   Gtk::HBox* actionBox = manage(new Gtk::HBox());
   if (m_mapArea != NULL) {
      Gtk::Button* editButton = manage(new Gtk::Button("Edit"));
      editButton->set_size_request(75, 25);
      editButton->signal_clicked().connect(
            sigc::mem_fun(*this, &MESignPostInfoDialog::editSpPressed));
      actionBox->pack_start(*editButton);
   } else {
      // empty label..
      Gtk::Label* editLabel = manage(new Gtk::Label(""));
      editLabel->set_size_request(75, 25);
      actionBox->pack_start(*editLabel);
   }
   Gtk::Button* closeButton = manage(new Gtk::Button("Close"));
   closeButton->signal_clicked().connect(
                  sigc::mem_fun(*this, &MESignPostInfoDialog::closePressed));
   closeButton->set_size_request(75, 25);
   actionBox->pack_start(*closeButton);
   get_action_area()->pack_start(*actionBox);

   // Don't show the dialog now, wait for show()-command.
}
コード例 #30
0
ファイル: view.cpp プロジェクト: davidbuzz/repsnapper
 void update_temp (double value)
 {
   gchar *tmp = g_strdup_printf ("%3g", value);
   m_temp->set_text(tmp);
 }