예제 #1
0
ProjectSettingsDialog :: ProjectSettingsDialog(_ProjectManager* project)
   : _projectFrame("Project"), _compilerFrame("Compiler"),
     _linkerFrame("Linker"), _debuggerFrame("Debugger"),
     _typeLabel("Type"), _namespaceLabel("Namespace"),
     _warningLabel("Warn about unresolved references"), _optionsLabel("Additional options"),
     _targetLabel("Target file name"), _outputLabel("Output path"),
     _modeLabel("Debug mode"), _argumentsLabel("Command arguments")
{
   _project = project;

   Gtk::Box *box = get_vbox();

   box->pack_start(_projectFrame, Gtk::PACK_SHRINK);

   _projectFrame.add(_projectGrid);
   _projectGrid.set_row_homogeneous(true);
   _projectGrid.set_column_homogeneous(true);
   _projectGrid.attach(_typeLabel, 0, 0, 1, 1);
   _projectGrid.attach(_typeCombobox, 1, 0, 1, 1);
   _projectGrid.attach(_namespaceLabel, 0, 1, 1, 1);
   _projectGrid.attach(_namespaceText, 1, 1, 1, 1);

   box->pack_start(_compilerFrame);

   _compilerFrame.add(_compilerGrid);
   _compilerGrid.set_row_homogeneous(true);
   _compilerGrid.set_column_homogeneous(true);
   _compilerGrid.attach(_warningCheckbox, 0, 0, 1, 1);
   _compilerGrid.attach(_warningLabel, 1, 0, 1, 1);
   _compilerGrid.attach(_optionsLabel, 0, 1, 1, 1);
   _compilerGrid.attach(_optionsText, 1, 1, 1, 1);

   box->pack_start(_linkerFrame);

   _linkerFrame.add(_linkerrGrid);
   _linkerrGrid.set_row_homogeneous(true);
   _linkerrGrid.set_column_homogeneous(true);
   _linkerrGrid.attach(_targetLabel, 0, 0, 1, 1);
   _linkerrGrid.attach(_targetText, 1, 0, 1, 1);
   _linkerrGrid.attach(_outputLabel, 0, 1, 1, 1);
   _linkerrGrid.attach(_outputText, 1, 1, 1, 1);

   box->pack_start(_debuggerFrame);

   _debuggerFrame.add(_debuggerGrid);
   _debuggerGrid.set_row_homogeneous(true);
   _debuggerGrid.set_column_homogeneous(true);
   _debuggerGrid.attach(_modeLabel, 0, 0, 1, 1);
   _debuggerGrid.attach(_modeCombobox, 1, 0, 1, 1);
   _debuggerGrid.attach(_argumentsLabel, 0, 1, 1, 1);
   _debuggerGrid.attach(_argumentsText, 1, 1, 1, 1);

   add_button("OK", Gtk::RESPONSE_OK);
   add_button("Cancel", Gtk::RESPONSE_CANCEL);

   populate();

   show_all_children();
}
void
FontSubstitution::show(Glib::ustring out, GSList *l)
{
   Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."),
                       false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true);
   warning.set_resizable(true);
   warning.set_title(_("Font substitution"));

   GtkWidget *dlg = GTK_WIDGET(warning.gobj());
   sp_transientize(dlg);

   Gtk::TextView * textview = new Gtk::TextView();
   textview->set_editable(false);
   textview->set_wrap_mode(Gtk::WRAP_WORD);
   textview->show();
   textview->get_buffer()->set_text(_(out.c_str()));

   Gtk::ScrolledWindow * scrollwindow = new Gtk::ScrolledWindow();
   scrollwindow->add(*textview);
   scrollwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrollwindow->set_shadow_type(Gtk::SHADOW_IN);
   scrollwindow->set_size_request(0, 100);
   scrollwindow->show();

   Gtk::CheckButton *cbSelect = new Gtk::CheckButton();
   cbSelect->set_label(_("Select all the affected items"));
   cbSelect->set_active(true);
   cbSelect->show();

   Gtk::CheckButton *cbWarning = new Gtk::CheckButton();
   cbWarning->set_label(_("Don't show this warning again"));
   cbWarning->show();

#if GTK_CHECK_VERSION(3,0,0)
   Gtk::Box * box = warning.get_content_area();
#else
   Gtk::Box * box = warning.get_vbox();
#endif
   box->set_spacing(2);
   box->pack_start(*scrollwindow, true, true, 4);
   box->pack_start(*cbSelect, false, false, 0);
   box->pack_start(*cbWarning, false, false, 0);

   warning.run();

   if (cbWarning->get_active()) {
       Inkscape::Preferences *prefs = Inkscape::Preferences::get();
       prefs->setInt("/options/font/substitutedlg", 0);
   }

   if (cbSelect->get_active()) {

       SPDesktop *desktop = SP_ACTIVE_DESKTOP;
       Inkscape::Selection *selection = sp_desktop_selection (desktop);
       selection->clear();
       selection->setList(l);
   }

}
예제 #3
0
Gtk::Widget *
Widget_RendDesc::create_other_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 *lockFrame = manage(new Gtk::Frame(_("Locks and Links")));
	lockFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) lockFrame->get_label_widget())->set_markup(_("<b>Locks and Links</b>"));
	panelBox->pack_start(*lockFrame, Gtk::PACK_SHRINK);

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

	Gtk::Grid *lockGrid = manage(new Gtk::Grid());
	lockGrid->set_row_spacing(6);
	lockGrid->set_column_spacing(12);
	lockPadding->add(*lockGrid);

	lockGrid->attach(*toggle_im_width,		0, 0, 1, 1);
	toggle_im_width->set_hexpand(true);
	lockGrid->attach(*toggle_im_height,		1, 0, 1, 1);
	toggle_im_height->set_hexpand(true);
	lockGrid->attach(*toggle_im_aspect,		2, 0, 1, 1);
	toggle_im_aspect->set_hexpand(true);
	lockGrid->attach(*toggle_im_span,		3, 0, 1, 1);
	toggle_im_span->set_hexpand(true);

	lockGrid->attach(*toggle_px_width,		0, 1, 1, 1);
	lockGrid->attach(*toggle_px_height,		1, 1, 1, 1);
	lockGrid->attach(*toggle_px_aspect,		2, 1, 1, 1);

	Gtk::Frame *focusFrame = manage(new Gtk::Frame(_("Focus Point")));
	focusFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) focusFrame->get_label_widget())->set_markup(_("<b>Focus Point</b>"));
	panelBox->pack_start(*focusFrame, Gtk::PACK_SHRINK);

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

	Gtk::Box *focusBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 12));
	focusPadding->add(*focusBox);

	Gtk::Label *focusLabel = manage(new Gtk::Label(_("_Focus Point"), 0, 0.5, true));
	focusLabel->set_mnemonic_widget(*entry_focus);
	focusBox->pack_start(*focusLabel, Gtk::PACK_SHRINK);
	focusBox->pack_start(*entry_focus, Gtk::PACK_EXPAND_WIDGET);

	paddedPanel->show_all();
	return paddedPanel;
}
예제 #4
0
/**
 * Constructor
 */
Messages::Messages()
    : UI::Widget::Panel("", "/dialogs/messages", SP_VERB_DIALOG_DEBUG),
      buttonClear(_("_Clear"), _("Clear log messages")),
      checkCapture(_("Capture log messages"), _("Capture log messages"))
{
    Gtk::Box *contents = _getContents();

    /*
     * Menu replaced with buttons
     *
    menuBar.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_File"), fileMenu) );
    fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Clear"),
           sigc::mem_fun(*this, &Messages::clear) ) );
    fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("Capture log messages"),
           sigc::mem_fun(*this, &Messages::captureLogMessages) ) );
    fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("Release log messages"),
           sigc::mem_fun(*this, &Messages::releaseLogMessages) ) );
    contents->pack_start(menuBar, Gtk::PACK_SHRINK);
    */

    //### Set up the text widget
    messageText.set_editable(false);
    textScroll.add(messageText);
    textScroll.set_policy(Gtk::POLICY_ALWAYS, Gtk::POLICY_ALWAYS);
    contents->pack_start(textScroll);

    buttonBox.set_spacing(6);
    buttonBox.pack_start(checkCapture, true, true, 6);
    buttonBox.pack_end(buttonClear, false, false, 10);
    contents->pack_start(buttonBox, Gtk::PACK_SHRINK);

    // sick of this thing shrinking too much
    set_size_request(400, 300);
    
    show_all_children();

    message(_("Ready."));

    buttonClear.signal_clicked().connect(sigc::mem_fun(*this, &Messages::clear));
    checkCapture.signal_clicked().connect(sigc::mem_fun(*this, &Messages::toggleCapture));

    /*
     * TODO - Setting this preference doesn't capture messages that the user can see.
     * Inkscape creates an instance of a dialog on startup and sends messages there, but when the user
     * opens the dialog View > Messages the DialogManager creates a new instance of this class that is not capturing messages.
     *
     * message(_("Enable log display by setting dialogs.debug 'redirect' attribute to 1 in preferences.xml"));
    */

    handlerDefault = 0;
    handlerGlibmm  = 0;
    handlerAtkmm   = 0;
    handlerPangomm = 0;
    handlerGdkmm   = 0;
    handlerGtkmm   = 0;

}
예제 #5
0
DebugDialogImpl::DebugDialogImpl()
{
    set_title(_("Messages"));
    set_size_request(300, 400);

#if WITH_GTKMM_3_0
    Gtk::Box *mainVBox = get_content_area();
#else
    Gtk::Box *mainVBox = get_vbox();
#endif

    //## Add a menu for clear()
    Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem(_("_File"), true));
    item->set_submenu(fileMenu);
    menuBar.append(*item);

    item = Gtk::manage(new Gtk::MenuItem(_("_Clear"), true));
    item->signal_activate().connect(sigc::mem_fun(*this, &DebugDialogImpl::clear));
    fileMenu.append(*item);

    item = Gtk::manage(new Gtk::MenuItem(_("Capture log messages")));
    item->signal_activate().connect(sigc::mem_fun(*this, &DebugDialogImpl::captureLogMessages));
    fileMenu.append(*item);
    
    item = Gtk::manage(new Gtk::MenuItem(_("Release log messages")));
    item->signal_activate().connect(sigc::mem_fun(*this, &DebugDialogImpl::releaseLogMessages));
    fileMenu.append(*item);

    mainVBox->pack_start(menuBar, Gtk::PACK_SHRINK);
    

    //### Set up the text widget
    messageText.set_editable(false);
    textScroll.add(messageText);
    textScroll.set_policy(Gtk::POLICY_ALWAYS, Gtk::POLICY_ALWAYS);
    mainVBox->pack_start(textScroll);

    show_all_children();

    message("ready.");
    message("enable log display by setting ");
    message("dialogs.debug 'redirect' attribute to 1 in preferences.xml");

    handlerDefault = 0;
    handlerGlibmm  = 0;
    handlerAtkmm   = 0;
    handlerPangomm = 0;
    handlerGdkmm   = 0;
    handlerGtkmm   = 0;
}
예제 #6
0
bool GstPropertiesModule::update_property(const std::shared_ptr<GValueBase>& value_base, const std::string prop_name)
{
	for (auto internal_box : properties_box->get_children())
	{
		Gtk::Box *hb = dynamic_cast<Gtk::Box*>(internal_box);
		if (hb == nullptr)
		{
			continue;
		}

		if (reinterpret_cast<gchar*>(hb->get_data("property-name")) != prop_name)
			continue;

		for (auto widget : hb->get_children())
		{
			if (widget->get_data("is-gvalue-widget") == GINT_TO_POINTER(1))
			{
				bool sensitive = widget->get_sensitive();
				hb->remove(*widget);
				widget = value_base->get_widget();
				widget->set_sensitive(sensitive);
				widget->show();
				hb->pack_start(*widget, true, 10);
				hb->reorder_child(*widget, 1);
				return true;
			}
		}
	}

	return false;
}
예제 #7
0
ParamsDialog::ParamsDialog(MainWindow *_mw) : Gtk::Dialog("Parameters", *_mw, true),
	mw(_mw)
{
	add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::ResponseType::RESPONSE_OK);

	Gtk::Box* box = get_vbox();
	Gtk::Table *tbl = Gtk::manage(new Gtk::Table(3,2));

	f_c_re = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_re->set_activates_default(true);
	f_c_im = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_im->set_activates_default(true);

	zc = Gtk::manage(new ZoomControl(mw));

	Gtk::Label* label;

	label = Gtk::manage(new Gtk::Label("Centre Real (x) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 0, 1);
	tbl->attach(*f_c_re, 1, 2, 0, 1);

	label = Gtk::manage(new Gtk::Label("Centre Imaginary (y) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 1, 2);
	tbl->attach(*f_c_im, 1, 2, 1, 2);

	tbl->attach(*zc, 0, 2, 2, 3);

	box->pack_start(*tbl);
	set_default_response(Gtk::ResponseType::RESPONSE_OK);
}
예제 #8
0
SelectDialog::SelectDialog
(
   ButtonID    buttons,
   const char* title,
   const char* message,
   bool        needSelection

)
 : DialogBox(buttons, title)
 , sw_(0)
 , list_(0)
 , selectBtn_(0)
 , deselectBtn_(0)
 , needSelection_(needSelection)
{
    get_vbox()->set_border_width(2);
    if (message)
    {
       Gtk::Box* hbox = manage(new Gtk::HBox);
       get_vbox()->pack_start(*hbox, false, false);

       Gtk::Frame* frame = manage(new Gtk::Frame);
       hbox->pack_start(*frame);
       hbox->set_border_width(3);

       Gtk::Label* label = manage(new Gtk::Label(message, .0));
       frame->add(*label);

       label->set_padding(3, 5);
       Gtk_set_size(label, 570, -1);
       label->set_justify(Gtk_FLAG(JUSTIFY_LEFT));
       label->set_line_wrap(true);
    }
    sw_ = manage(new Gtk::ScrolledWindow);
    get_vbox()->pack_start(*sw_);

    sw_->set_policy(Gtk_FLAG(POLICY_AUTOMATIC), Gtk_FLAG(POLICY_AUTOMATIC));
    Gtk_set_size(sw_, 580, 300);

    list_ = manage(new Gtk::List);
    Gtk_add_with_viewport(sw_, *list_);
    list_->set_selection_mode(Gtk_FLAG(SELECTION_MULTIPLE));

    add_select_button("Select _All", true);
    add_select_button("_Deselect All", false);

    Gtk_set_resizable(this, true);

    if (needSelection)
    {
       if (Gtk::Button* btn = get_ok_button())
       {
           btn->set_sensitive(false);
       }
    }
    selConn_ = Gtk_CONNECT_0(list_, selection_changed,
      this, &SelectDialog::on_selection_changed);

    get_vbox()->show_all();
}
예제 #9
0
Tree_active::Tree_active(Dir_preview* dp, Gtk::Box& box)
	: Tree{dp, box}
{
	box.pack_start(get_widget(), Gtk::PACK_EXPAND_WIDGET);
	m_tree_view->set_sensitive();
	m_tree_view->grab_focus();

	m_separator->set_margin_left(2);
	m_separator->set_margin_right(2);
	box.pack_start(*m_separator, Gtk::PACK_SHRINK);

	// register the signals
	// Note that we're registering on_cursor_change signal AFTER setting the
	// cursor on purpose - we don't need to check the cursor for preview as
	// this was already done by libhawk when we created this tab.

	register_signals();
}
예제 #10
0
파일: dialog.cpp 프로젝트: GNOME/niepce
void Dialog::add_header(const std::string & label)
{
    Gtk::Box * vbox;

    builder()->get_widget("dialog-vbox1", vbox);
    auto markup = str(boost::format("<span size=\"x-large\">%1%</span>") % label);
    auto header = manage(new view::Header(markup));
    header->show();
    vbox->pack_start(*header, false, true);
}
예제 #11
0
DeviceSelector::DeviceSelector()
{
  //domyślny rozmiar okna
  set_default_size(600, 300);
  //przyciski
  ok.set_label("OK");
  ok.set_sensitive(false);
  cancel.set_label("Anuluj");
  start_search.set_label("Szukaj urządzeń");

  //umieszczenie prezycisków
  hbox.pack_start(ok);
  hbox.pack_start(cancel);
  hbox.pack_start(start_search);

  //łączenie przycisków z akcjami
  start_search.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::start_search_clicked));
  ok.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::ok_clicked));
  cancel.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::cancel_clicked));


  //widok listy
  scrolled_window.add(view);
  ref_tree_model = Gtk::ListStore::create(dtn);
  view.set_model(ref_tree_model);
  scrolled_window.set_size_request(400, 300);

  //kolumny
  view.append_column("Nazwa", dtn.col_name);
  view.append_column("MAC", dtn.col_MAC);

  //umieszczenie pionowe
  //vbox.pack_start(scrolled_window, Gtk::PACK_EXPAND_PADDING);
  //vbox.pack_end(hbox, Gtk::PACK_SHRINK);

  //umieszczenie vboxa w oknie
  Gtk::Box *tmp = get_content_area();
  tmp->pack_start(scrolled_window, Gtk::PACK_EXPAND_PADDING);
  tmp->pack_end(hbox, Gtk::PACK_SHRINK);
  //tmp->pack_start(vbox, Gtk::PACK_EXPAND_WIDGET);

  //wyświetlenie
  tmp->show_all_children(true);

  //wyświetlanie urządzeń
  this->signal_devices_ready().connect(sigc::mem_fun(*this, &DeviceSelector::on_devices_ready));

  exiting = exited = false;

  //szukanie urządzeń
  search();
}
예제 #12
0
int main(int argc, char *argv[])
{

    // make window
    Glib::RefPtr<Gtk::Application> app =
        Gtk::Application::create(argc, argv,
                                 "tutorial2");

    Gtk::Window window;

    window.set_default_size(400,200);
    window.set_title("Tutorial 2");

    // This creates a vertical box container with 0 padding
    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    window.add(*vbox);

    // creates menu bar
    Gtk::MenuBar *menubar = Gtk::manage(new Gtk::MenuBar());
    vbox->pack_start(*menubar, Gtk::PACK_SHRINK, 0);

    // create menu items
    Gtk::MenuItem *menuitem_file = Gtk::manage(new Gtk::MenuItem("_File", true));
    menubar->append(*menuitem_file);
    Gtk::Menu *filemenu = Gtk::manage(new Gtk::Menu());
    menuitem_file->set_submenu(*filemenu);
    Gtk::MenuItem *menuitem_quit = Gtk::manage(new Gtk::MenuItem("_Quit", true));
    filemenu->append(*menuitem_quit);

    // create grid container with border width 10
    // and add it to the new cell of the vertical box
    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    grid->set_border_width(10);
    vbox->add(*grid);

    // create button
    Gtk::Button *b1 = Gtk::manage(new Gtk::Button("Button 1"));
    b1->set_hexpand(true);		//  take up all unused space horizontally
    b1->set_vexpand(true);		//  take up all unused space vertically
    // possition 0(x), 0(y), span 1 cell wide and 2 cells down
    grid->attach(*b1, 0, 0, 1, 2);

    Gtk::Button *b2 = Gtk::manage(new Gtk::Button("Button 2"));
    grid->attach(*b2, 1, 0, 1, 1);

    Gtk::Button *b3 = Gtk::manage(new Gtk::Button("Button 3"));
    grid->attach(*b3, 1, 1, 1, 1);

    vbox->show_all();

    return app->run(window);
}
예제 #13
0
void GstPropertiesModule::append_property(const std::shared_ptr<GValueBase>& value_base, const std::string &prop_name)
{
	auto e = std::dynamic_pointer_cast<ElementModel>(controller->get_selected_object());
	if (!e) return;
	auto klass = controller->get_klass(e->get_type_name());
	if (!klass) return;
	auto prop = klass.get().get_property(prop_name);
	if (!prop) return;

	Gtk::Box *hbox = new Gtk::Box (Gtk::ORIENTATION_HORIZONTAL, 0);
	hbox->set_data("property-name", g_strdup (prop_name.c_str()), g_free);
	Gtk::Label *lbl = Gtk::manage(new Gtk::Label(prop_name));
	lbl->set_tooltip_text(prop->get_blurb());
	Gtk::Button *btn = Gtk::manage(new Gtk::Button("Refresh"));
	btn->signal_clicked().connect([this, prop_name] {request_selected_element_property(prop_name);});
	hbox->pack_start(*lbl, false, false);
	auto value_widget = value_base->get_widget();
	value_base->set_sensitive(prop.get().get_flags() & G_PARAM_WRITABLE);
	hbox->pack_start(*value_widget, true, true);
	hbox->pack_start(*btn, false, false);
	properties_box->pack_start(*hbox);
	hbox->show_all();
}
예제 #14
0
void FormImpl::set_menubar(mforms::Form *self, mforms::MenuBar *menu)
{
  FormImpl* form = self->get_data<FormImpl>();
  Gtk::MenuBar *mbar = widget_for_menubar(menu);
  if (form && mbar)
  {
    Gtk::Box *box = dynamic_cast<Gtk::Box*>(self->get_content()->get_data<ViewImpl>()->get_inner());
    if (!box)
      throw std::logic_error("set_menubar called on a window without a Box as toplevel content");
    box->pack_start(*mbar, false, true);
    box->reorder_child(*mbar, 0);

    on_add_menubar_to_window(menu, form->_window);
  }
}
예제 #15
0
Gtk::Widget *
Widget_RendDesc::create_time_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));  // for future widgets
	panelBox->set_homogeneous(false);
	paddedPanel->add(*panelBox);

	time_frame = manage(new Gtk::Frame(_("Time Settings")));
	time_frame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) time_frame->get_label_widget())->set_markup(_("<b>Time Settings</b>"));
	panelBox->pack_start(*time_frame, Gtk::PACK_SHRINK);

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

	Gtk::Grid *timeFrameGrid = manage(new Gtk::Grid());
	timeFramePadding->add(*timeFrameGrid);
	timeFrameGrid->set_row_spacing(6);
	timeFrameGrid->set_column_spacing(250);

	Gtk::Label *timeFPSLabel = manage(new Gtk::Label(_("_Frames per second"), 0, 0.5, true));
	timeFPSLabel->set_mnemonic_widget(*entry_fps);
	timeFrameGrid->attach(*timeFPSLabel, 0, 0, 1, 1);
	entry_fps->set_hexpand(true);
	timeFrameGrid->attach(*entry_fps, 1, 0, 1, 1);

	Gtk::Label *timeStartLabel = manage(new Gtk::Label(_("_Start Time"), 0, 0.5, true));
	timeStartLabel->set_mnemonic_widget(*entry_start_time);
	timeFrameGrid->attach(*timeStartLabel, 0, 1, 1, 1);
	timeFrameGrid->attach(*entry_start_time, 1, 1, 1, 1);

	Gtk::Label *timeEndLabel = manage(new Gtk::Label(_("_End Time"), 0, 0.5, true));
	timeEndLabel->set_mnemonic_widget(*entry_end_time);
	timeFrameGrid->attach(*timeEndLabel, 0, 2, 1, 1);
	timeFrameGrid->attach(*entry_end_time, 1, 2, 1, 1);

	Gtk::Label *timeDurationLabel = manage(new Gtk::Label(_("_Duration"), 0, 0.5, true));
	timeDurationLabel->set_mnemonic_widget(*entry_duration);
	timeFrameGrid->attach(*timeDurationLabel, 0, 3, 1, 1);
	timeFrameGrid->attach(*entry_duration, 1, 3, 1, 1);

	paddedPanel->show_all();
	return paddedPanel;
}
예제 #16
0
myWindow::myWindow()
{
	set_default_size(400, 200);
	set_title("Tutorial 3");

	Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
	add(*vbox);

	Gtk::MenuBar *menubar = Gtk::manage(new Gtk::MenuBar());
	vbox->pack_start(*menubar, Gtk::PACK_SHRINK, 0);

	Gtk::MenuItem *menuitem_file = Gtk::manage(new Gtk::MenuItem("_File", true));
	menubar->append(*menuitem_file);
	Gtk::Menu *filemenu = Gtk::manage(new Gtk::Menu());
	menuitem_file->set_submenu(*filemenu);
	Gtk::MenuItem *menuitem_quit = Gtk::manage(new Gtk::MenuItem("_Quit", true));
	menuitem_quit->signal_activate().connect(sigc::mem_fun(*this, &myWindow::on_quit_click));
	filemenu->append(*menuitem_quit);

	Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
	grid->set_border_width(10);
	vbox->add(*grid);

	Gtk::Button *b1 = Gtk::manage(new Gtk::Button("Big Button 1"));
    b1->set_hexpand(true);
    b1->set_vexpand(true);
    b1->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_big_button1_click));
    grid->attach(*b1, 0, 0, 1, 2);

    Gtk::Button *b2 = Gtk::manage(new Gtk::Button("Button 2"));
    b2->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_button2_click));
    grid->attach(*b2, 1, 0, 1, 1);

    Gtk::Button *b3 = Gtk::manage(new Gtk::Button("Button 3"));
    b3->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_button3_click));
    grid->attach(*b3, 1, 1, 1, 1);

    vbox->show_all();
}
IdleExample::IdleExample() :
    m_Box(Gtk::ORIENTATION_VERTICAL, 5),
    m_ButtonQuit(Gtk::Stock::QUIT)
{
    set_border_width(5);

    // Put buttons into container

    // Adding a few widgets:
    add(m_Box);
    m_Box.pack_start( *Gtk::manage(new Gtk::Label("Formatting Windows drive C:")));
    m_Box.pack_start( *Gtk::manage(new Gtk::Label("100 MB")) );
    m_Box.pack_start(m_ProgressBar_c);

    m_Box.pack_start( *Gtk::manage(new Gtk::Label("")) );

    m_Box.pack_start( *Gtk::manage(new Gtk::Label("Formatting Windows drive D:")));
    m_Box.pack_start( *Gtk::manage(new Gtk::Label("5000 MB")) );
    m_Box.pack_start(m_ProgressBar_d);

    Gtk::Box* hbox = Gtk::manage( new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,10));
    m_Box.pack_start(*hbox);
    hbox->pack_start(m_ButtonQuit, Gtk::PACK_EXPAND_PADDING);

    // Connect the signal handlers:
    m_ButtonQuit.signal_clicked().connect( sigc::mem_fun(*this,
                                           &IdleExample::on_button_clicked) );

    // formatting drive c in timeout signal handler - called once every 50ms
    Glib::signal_timeout().connect( sigc::mem_fun(*this, &IdleExample::on_timer),
                                    50 );

    // formatting drive d in idle signal handler - called as quickly as possible
    Glib::signal_idle().connect( sigc::mem_fun(*this, &IdleExample::on_idle) );

    show_all_children();
}
MEStreetSegmentItemInfoWidget::MEStreetSegmentItemInfoWidget()
    : MEAbstractItemInfoWidget("SSI")
{
    // Table with 3 rows and 2 columns
    Gtk::Table* table = manage(new Gtk::Table(3, 2));

    Gtk::Label* label = NULL;
    Gtk::Box* box = NULL;
    Gtk::Adjustment* adj = NULL;

    // Road class + road condition
    box = manage(new Gtk::HBox());
    label = manage(new Gtk::Label("Road class"));
    label->set_alignment(XALIGN, YALIGN);
    box->pack_start(*label, true, true);
    m_roadClassVal = manage(new Gtk::Entry());
    m_roadClassVal->set_size_request(100, 18);
    box->pack_start(*m_roadClassVal, true, true);
    label = manage(new Gtk::Label("Road cond"));
    label->set_alignment(XALIGN, YALIGN);
    box->pack_start(*label, true, true);
    m_roadConditionVal = manage(new Gtk::Entry());
    m_roadConditionVal->set_size_request(100, 18);
    box->pack_start(*m_roadConditionVal, true, true);
    table->attach(*box, 0, 2, 0, 1,
                  Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    // House numbers
    label = manage(new Gtk::Label("Nbr L/R: type"));
    label->set_alignment(XALIGN, YALIGN);
    // Not sure if parameters correspond to old AttachOptions.
    //table->attach(*label, 0, 1, 1, 2, FIXED_OPT, FIXED_OPT);
    table->attach(*label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
    box = manage(new Gtk::HBox());

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValLS = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValLS->set_numeric(true);
    m_houseNumberValLS->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValLS, true, true);

    label = manage(new Gtk::Label("-"));
    box->pack_start(*label, false, false);

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValLE = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValLE->set_numeric(true);
    m_houseNumberValLE->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValLE);

    label = manage(new Gtk::Label(" / "));
    box->pack_start(*label, false, false);

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValRS = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValRS->set_numeric(true);
    m_houseNumberValRS->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValRS);

    label = manage(new Gtk::Label("-"));
    box->pack_start(*label, false, false);

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValRE = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValRE->set_numeric(true);
    m_houseNumberValRE->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValRE);

    label = manage(new Gtk::Label(":"));
    box->pack_start(*label, true, true);
    // Housenumber-type
    Gtk::Combo* tmpCombo = manage(new Gtk::Combo());
    m_houseNumberTypeVal = tmpCombo->get_entry();
    list<string> houseNbrTypeList;
    for (unsigned int i=0; i<5; i++) {  // Please change to < "invalidStreetNumberType"
        char tmpStr[8];
        sprintf(tmpStr, "%u", i);
        houseNbrTypeList.push_back(tmpStr);
    }
    tmpCombo->set_popdown_strings(houseNbrTypeList);
    tmpCombo->set_size_request(40,18);
    box->pack_start(*tmpCombo);

    table->attach(*box, 1, 2, 1, 2, Gtk::EXPAND, Gtk::FILL);

    // Street segment item attributes
    box = manage(new Gtk::HBox());
    // Ramp?
    m_rampVal = manage(new Gtk::CheckButton("ramp"));
    label = dynamic_cast<Gtk::Label*>(m_rampVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_rampVal);
    // Roundabout
    m_roundaboutVal = manage(new Gtk::CheckButton("roundabout"));
    label = dynamic_cast<Gtk::Label*>(m_roundaboutVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_roundaboutVal);
    // Roundaboutish
    m_roundaboutishVal = manage(new Gtk::CheckButton("rb_ish"));
    label = dynamic_cast<Gtk::Label*>(m_roundaboutishVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_roundaboutishVal);
    // Multi dig
    m_multidigVal = manage(new Gtk::CheckButton("multi dig"));
    label = dynamic_cast<Gtk::Label*>(m_multidigVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_multidigVal);
    // Controlled access
    m_controlledAccessVal = manage(new Gtk::CheckButton("ctrl acc"));
    label = dynamic_cast<Gtk::Label*>(m_controlledAccessVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_controlledAccessVal);
    table->attach(*box, 0, 2, 2, 3,
                  Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    // Set editable
    m_roadClassVal->set_state(Gtk::STATE_INSENSITIVE);
    m_roadConditionVal->set_state(Gtk::STATE_INSENSITIVE);
#ifdef MAP_EDITABLE
    m_houseNumberValLS->set_state(Gtk::STATE_NORMAL);
    m_houseNumberValLE->set_state(Gtk::STATE_NORMAL);
    m_houseNumberValRS->set_state(Gtk::STATE_NORMAL);
    m_houseNumberValRE->set_state(Gtk::STATE_NORMAL);
    m_houseNumberTypeVal->set_state(Gtk::STATE_NORMAL);
    m_rampVal->set_state(Gtk::STATE_NORMAL);
    m_roundaboutVal->set_state(Gtk::STATE_NORMAL);
    m_roundaboutishVal->set_state(Gtk::STATE_NORMAL);
    m_multidigVal->set_state(Gtk::STATE_NORMAL);
#else
    m_houseNumberValLS->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberValLE->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberValRS->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberValRE->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberTypeVal->set_state(Gtk::STATE_INSENSITIVE);
    m_rampVal->set_state(Gtk::STATE_INSENSITIVE);
    m_roundaboutVal->set_state(Gtk::STATE_INSENSITIVE);
    m_roundaboutishVal->set_state(Gtk::STATE_INSENSITIVE);
    m_multidigVal->set_state(Gtk::STATE_INSENSITIVE);
    m_controlledAccessVal->set_state(Gtk::STATE_INSENSITIVE);
#endif

    // Add the table to this frame
    add(*table);
}
예제 #19
0
//------------------------------------------------------------------------------
bool mforms::gtk::ToolBarImpl::create_tool_item(mforms::ToolBarItem *item, ToolBarItemType type) {
  Gtk::Widget *w = 0;
  switch (type) {
    case mforms::TextActionItem:
    case mforms::ActionItem:
    case mforms::SwitcherItem: {
      Gtk::Button *btn = Gtk::manage(new Gtk::Button());
      btn->set_focus_on_click(false);
      btn->set_border_width(0);
      btn->set_relief(Gtk::RELIEF_NONE);
      btn->signal_clicked().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item));
      if (type == mforms::SwitcherItem)
        btn->set_always_show_image(true);
      w = btn;
      break;
    }
    case mforms::SegmentedToggleItem:
    case mforms::ToggleItem: {
      Gtk::ToggleButton *btn = Gtk::manage(new Gtk::ToggleButton());
      btn->set_focus_on_click(false);
      btn->set_relief(Gtk::RELIEF_NONE);
      btn->signal_toggled().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item));
      btn->set_inconsistent(false);

      w = btn;
      break;
    }
    case mforms::SeparatorItem: {
      Gtk::Separator *sep = new Gtk::Separator(Gtk::ORIENTATION_VERTICAL);
      w = sep;
      break;
    }
    case mforms::SearchFieldItem: {
#if GTK_VERSION_GE(2, 16)
      Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());
      w = entry;
      entry->set_icon_from_stock(Gtk::Stock::FIND);
#else
      Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
      w = hbox;
      Gtk::Image *image = Gtk::manage(new Gtk::Image(Gtk::Stock::FIND, Gtk::ICON_SIZE_MENU));
      Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());

      hbox->pack_start(*image, false, true);
      hbox->pack_start(*entry, true, true);
      hbox->set_data("entry", entry);
      hbox->show_all();
#endif
      entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item));
      break;
    }
    case mforms::TextEntryItem: {
      Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
      w = hbox;
      Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());
      hbox->pack_start(*entry, true, true);
      hbox->set_data("entry", entry);
      hbox->show_all();
      entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item));
      break;
    }
    case mforms::FlatSelectorItem:
    case mforms::SelectorItem: {
      Gtk::ComboBoxText *ct = Gtk::manage(new Gtk::ComboBoxText());
      ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item));

      w = ct;
      break;
    }
    case mforms::ColorSelectorItem: {
      if (!color_combo_columns) {
        color_combo_columns = new ColorComboColumns();
      }
      Gtk::ComboBox *ct = Gtk::manage(new Gtk::ComboBox());

      ct->pack_start(color_combo_columns->image);
      ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item));

      w = ct;

      break;
    }
    case mforms::ExpanderItem:
    case mforms::LabelItem: {
      Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5));
      w = label;
      break;
    }
    case mforms::ImageBoxItem: {
      Gtk::Image *image = Gtk::manage(new Gtk::Image());
      w = image;
      break;
    }
    case mforms::TitleItem: {
      Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5));
      w = label;
      auto provider = Gtk::CssProvider::create();
      provider->load_from_data("* { color: #333; font-weight: bold; }");
      w->get_style_context()->add_provider(provider, GTK_STYLE_PROVIDER_PRIORITY_USER);
      break;
    }
  }

  if (w) {
    w->show();
  } else
    logError("create_tool_item, widget is 0 for passed type %i\n", type);

  item->set_data(w);

  return w != 0;
}
MEGroupItemInfoWidget::MEGroupItemInfoWidget()
   : MEAbstractItemInfoWidget("Group")
{
   Gtk::Box* mainBox = manage(new Gtk::VBox());
   
   // Create the groups ListStore and add to groups TreeView  
   m_listStore = Gtk::ListStore::create(m_columns);
   m_treeView.set_model(m_listStore);
   m_treeView.append_column("Pos", m_columns.m_pos);
   m_treeView.append_column("Tpe", m_columns.m_tpe);
   m_treeView.append_column("ID", m_columns.m_ID);
   m_treeView.append_column("Name", m_columns.m_name);

   // 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(40);
   tmpCol->set_resizable(true);

   tmpCol = m_treeView.get_column(1);
   tmpCol->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED);
   tmpCol->set_fixed_width(40);
   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);

   // Create selection object to handle chosen rows
   m_selection = m_treeView.get_selection();
   if (!m_selection) {
      mc2log << error << "No selection object created for corresponding "
             << "TreeView" << endl;
      MC2_ASSERT(false);
   }

   // Create a scrolled window to pack the TreeView widget into */
   Gtk::ScrolledWindow *scrolledWindow = manage(new Gtk::ScrolledWindow());
   scrolledWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
   scrolledWindow->add(m_treeView);
   mainBox->pack_start(*scrolledWindow);

   // Add highlight + select buttons
   Gtk::Box* buttonBox = manage(new Gtk::HBox());
   Gtk::Button* button = manage(new Gtk::Button("Highlight items in group"));
   button->signal_clicked().connect(
      sigc::mem_fun(*this, &MEGroupItemInfoWidget::highlightPressed));
   buttonBox->pack_start(*button);
   
   button = manage(new Gtk::Button("Recursive"));
   button->signal_clicked().connect(
      sigc::mem_fun(*this, &MEGroupItemInfoWidget::highlightRecursivePressed));
   buttonBox->pack_start(*button);

   button = manage(new Gtk::Button("Select"));
   button->signal_clicked().connect(
            sigc::mem_fun(*this, &MEGroupItemInfoWidget::selectItemInGroup));
   buttonBox->pack_start(*button);
   
   mainBox->pack_start(*buttonBox, false, false);
   
   // Add to this frame
   add(*mainBox);
}
CalligraphicProfileRename::CalligraphicProfileRename() :
#if WITH_GTKMM_3_0
    _layout_table(Gtk::manage(new Gtk::Grid())),
#else
    _layout_table(Gtk::manage(new Gtk::Table(1, 2))),
#endif
    _applied(false)
{
    set_title(_("Edit profile"));

#if WITH_GTKMM_3_0
    Gtk::Box *mainVBox = get_content_area();
    _layout_table->set_column_spacing(4);
    _layout_table->set_row_spacing(4);
#else
    Gtk::Box *mainVBox = get_vbox();
    _layout_table->set_spacings(4);
#endif

    _profile_name_entry.set_activates_default(true);

    _profile_name_label.set_label(_("Profile name:"));
    _profile_name_label.set_alignment(1.0, 0.5);

#if WITH_GTKMM_3_0
    _layout_table->attach(_profile_name_label, 0, 0, 1, 1);

    _profile_name_entry.set_hexpand();
    _layout_table->attach(_profile_name_entry, 1, 0, 1, 1);
#else
    _layout_table->attach(_profile_name_label,
	           0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
    _layout_table->attach(_profile_name_entry,
	           1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
#endif

    mainVBox->pack_start(*_layout_table, false, false, 4);
    // Buttons
    _close_button.set_use_stock(true);
    _close_button.set_label(Gtk::Stock::CANCEL.id);
    _close_button.set_can_default();

    _delete_button.set_use_underline(true);
    _delete_button.set_label(_("Delete"));
    _delete_button.set_can_default();
    _delete_button.set_visible(false);

    _apply_button.set_use_underline(true);
    _apply_button.set_label(_("Save"));
    _apply_button.set_can_default();

    _close_button.signal_clicked()
            .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_close));
    _delete_button.signal_clicked()
            .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_delete));
    _apply_button.signal_clicked()
            .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_apply));

    signal_delete_event().connect( sigc::bind_return(
        sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)), true ) );

    add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
    add_action_widget(_delete_button, Gtk::RESPONSE_DELETE_EVENT);
    add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);

    _apply_button.grab_default();

    show_all_children();
}
예제 #22
0
dialog_localsettings::dialog_localsettings()
{
    this->set_size_request(350, -1);
    this->set_title("Local Settings");

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

    Gtk::Frame *frame = Gtk::manage(new Gtk::Frame);
    frame->set_margin_top(5);
    frame->set_margin_left(5);
    frame->set_margin_right(5);
    frame->set_margin_bottom(5);
    frame->set_hexpand(true);
    frame->set_vexpand(true);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    grid->set_margin_top(15);
    grid->set_margin_left(15);
    grid->set_margin_right(15);
    grid->set_margin_bottom(15);
    grid->set_hexpand(true);
    grid->set_vexpand(true);
    grid->set_row_spacing(15);
    frame->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label("Host: "));
    label->set_halign(Gtk::ALIGN_END);
    grid->attach(*label, 0, 0, 1, 1);

    eHost = Gtk::manage(new Gtk::Entry);
    eHost->set_hexpand(true);
    grid->attach(*eHost, 1, 0, 1, 1);

    label = Gtk::manage(new Gtk::Label("Username: "******"Password: "******"Update Interval: "));
    label->set_halign(Gtk::ALIGN_END);
    grid->attach(*label, 0, 3, 1, 1);

    Gtk::Box *box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
    grid->attach(*box, 1, 3, 1, 1);

    sUpdateInterval = Gtk::manage(new Gtk::SpinButton(Gtk::Adjustment::create(5.0, 1.0, 60.0, 1.0, 10.0, 0.0), 0.0, 0));
    sUpdateInterval->set_hexpand(false);
    box->pack_start(*sUpdateInterval, Gtk::PACK_EXPAND_WIDGET, 2);

    label = Gtk::manage(new Gtk::Label("(seconds)"));
    label->set_halign(Gtk::ALIGN_END);
    box->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 2);

    frame->show_all();

    this->get_content_area()->add(*frame);
}
// class constructor
genericFilechooserInputOutput::genericFilechooserInputOutput
(
	Gtk::Window& parent, 
	const Glib::ustring& title,
	const Glib::ustring& inputLabel,
	const Glib::ustring& outputLabel,
	const Glib::ustring& inputButtonLabel,
	const Glib::ustring& outputButtonLabel,
	const Glib::ustring& inputPlaceHolderLabel,
	const Glib::ustring& outputPlaceHolderLabel,
	bool setModal
)
: 
	Gtk::Dialog(title, parent, setModal),
	dialogOptionBox(get_vbox ())
{
	// dialog configuration
	set_resizable(true);
	set_position(Gtk::WIN_POS_CENTER);
	set_decorated(true);
	// define labels
	Gtk::Label * inputPathLabel = Gtk::manage(new Gtk::Label(inputLabel));
	Gtk::Label * outputPathLabel = Gtk::manage(new Gtk::Label(outputLabel));
	// define box
	Gtk::Box * pathInputBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 2));
	Gtk::Box * pathOutputBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 2));
	// define buttons
	pathInputButton = Gtk::manage(new Gtk::Button(inputButtonLabel));
	pathOutputButton = Gtk::manage(new Gtk::Button(outputButtonLabel));
	// define entry
	pathInputEntry = Gtk::manage(new Gtk::Entry());
	pathInputEntry->set_editable(true);
	pathInputEntry->set_placeholder_text(inputPlaceHolderLabel);
	pathOutputEntry = Gtk::manage(new Gtk::Entry());
	pathOutputEntry->set_editable(true);
	pathOutputEntry->set_placeholder_text(outputPlaceHolderLabel);
	// pack the entry and its button
	pathInputBox->pack_start(*pathInputEntry);
	pathInputBox->pack_start(*pathInputButton);
	pathOutputBox->pack_start(*pathOutputEntry);
	pathOutputBox->pack_start(*pathOutputButton);
    // pack elements into the dialog box
    dialogOptionBox->pack_start(*inputPathLabel);
    dialogOptionBox->pack_start(*pathInputBox);
    dialogOptionBox->pack_start(*outputPathLabel);
    dialogOptionBox->pack_start(*pathOutputBox);
	// append filechooser buttons and linked events
	add_button
	(
		Gtk::Stock::CANCEL, 
		Gtk::RESPONSE_CANCEL
	);
	add_button
	(
		Gtk::Stock::OK, 
		Gtk::RESPONSE_OK
	);
	connectSignalClicked();
	show_all_children();
//	
	// run the filechooser and grab the result
	response = run();
}
예제 #24
0
void BoolFilterParam::add_to(Gtk::Box& box)
{
    box.pack_start(*btn_, false, false);
}
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();
}
예제 #26
0
AlignAndDistribute::AlignAndDistribute()
    : UI::Widget::Panel ("", "/dialogs/align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE),
      randomize_bbox(),
      _alignFrame(_("Align")),
      _distributeFrame(_("Distribute")),
      _rearrangeFrame(_("Rearrange")),
      _removeOverlapFrame(_("Remove overlaps")),
      _nodesFrame(_("Nodes")),
#if WITH_GTKMM_3_0
      _alignTable(),
      _distributeTable(),
      _rearrangeTable(),
      _removeOverlapTable(),
      _nodesTable(),
#else
      _alignTable(2, 6, true),
      _distributeTable(2, 6, true),
      _rearrangeTable(1, 5, false),
      _removeOverlapTable(1, 5, false),
      _nodesTable(1, 4, true),
#endif
      _anchorLabel(_("Relative to: ")),
      _selgrpLabel(_("_Treat selection as group: "), 1)
{
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();

    //Instanciate the align buttons
    addAlignButton(INKSCAPE_ICON("align-horizontal-right-to-anchor"),
                   _("Align right edges of objects to the left edge of the anchor"),
                   0, 0);
    addAlignButton(INKSCAPE_ICON("align-horizontal-left"),
                   _("Align left edges"),
                   0, 1);
    addAlignButton(INKSCAPE_ICON("align-horizontal-center"),
                   _("Center on vertical axis"),
                   0, 2);
    addAlignButton(INKSCAPE_ICON("align-horizontal-right"),
                   _("Align right sides"),
                   0, 3);
    addAlignButton(INKSCAPE_ICON("align-horizontal-left-to-anchor"),
                   _("Align left edges of objects to the right edge of the anchor"),
                   0, 4);
    addAlignButton(INKSCAPE_ICON("align-vertical-bottom-to-anchor"),
                   _("Align bottom edges of objects to the top edge of the anchor"),
                   1, 0);
    addAlignButton(INKSCAPE_ICON("align-vertical-top"),
                   _("Align top edges"),
                   1, 1);
    addAlignButton(INKSCAPE_ICON("align-vertical-center"),
                   _("Center on horizontal axis"),
                   1, 2);
    addAlignButton(INKSCAPE_ICON("align-vertical-bottom"),
                   _("Align bottom edges"),
                   1, 3);
    addAlignButton(INKSCAPE_ICON("align-vertical-top-to-anchor"),
                   _("Align top edges of objects to the bottom edge of the anchor"),
                   1, 4);

    //Baseline aligns
    addBaselineButton(INKSCAPE_ICON("align-horizontal-baseline"),
                   _("Align baseline anchors of texts horizontally"),
                      0, 5, this->align_table(), Geom::X, false);
    addBaselineButton(INKSCAPE_ICON("align-vertical-baseline"),
                   _("Align baselines of texts"),
                     1, 5, this->align_table(), Geom::Y, false);

    //The distribute buttons
    addDistributeButton(INKSCAPE_ICON("distribute-horizontal-gaps"),
                        _("Make horizontal gaps between objects equal"),
                        0, 4, true, Geom::X, .5, .5);

    addDistributeButton(INKSCAPE_ICON("distribute-horizontal-left"),
                        _("Distribute left edges equidistantly"),
                        0, 1, false, Geom::X, 1., 0.);
    addDistributeButton(INKSCAPE_ICON("distribute-horizontal-center"),
                        _("Distribute centers equidistantly horizontally"),
                        0, 2, false, Geom::X, .5, .5);
    addDistributeButton(INKSCAPE_ICON("distribute-horizontal-right"),
                        _("Distribute right edges equidistantly"),
                        0, 3, false, Geom::X, 0., 1.);

    addDistributeButton(INKSCAPE_ICON("distribute-vertical-gaps"),
                        _("Make vertical gaps between objects equal"),
                        1, 4, true, Geom::Y, .5, .5);

    addDistributeButton(INKSCAPE_ICON("distribute-vertical-top"),
                        _("Distribute top edges equidistantly"),
                        1, 1, false, Geom::Y, 0, 1);
    addDistributeButton(INKSCAPE_ICON("distribute-vertical-center"),
                        _("Distribute centers equidistantly vertically"),
                        1, 2, false, Geom::Y, .5, .5);
    addDistributeButton(INKSCAPE_ICON("distribute-vertical-bottom"),
                        _("Distribute bottom edges equidistantly"),
                        1, 3, false, Geom::Y, 1., 0.);

    //Baseline distribs
    addBaselineButton(INKSCAPE_ICON("distribute-horizontal-baseline"),
                   _("Distribute baseline anchors of texts horizontally"),
                      0, 5, this->distribute_table(), Geom::X, true);
    addBaselineButton(INKSCAPE_ICON("distribute-vertical-baseline"),
                   _("Distribute baselines of texts vertically"),
                     1, 5, this->distribute_table(), Geom::Y, true);

    // Rearrange
    //Graph Layout
    addGraphLayoutButton(INKSCAPE_ICON("distribute-graph"),
                            _("Nicely arrange selected connector network"),
                            0, 0);
    addExchangePositionsButton(INKSCAPE_ICON("exchange-positions"),
                            _("Exchange positions of selected objects - selection order"),
                            0, 1);
    addExchangePositionsByZOrderButton(INKSCAPE_ICON("exchange-positions-zorder"),
                            _("Exchange positions of selected objects - stacking order"),
                            0, 2);
    addExchangePositionsClockwiseButton(INKSCAPE_ICON("exchange-positions-clockwise"),
                            _("Exchange positions of selected objects - clockwise rotate"),
                            0, 3);

    //Randomize & Unclump
    addRandomizeButton(INKSCAPE_ICON("distribute-randomize"),
                        _("Randomize centers in both dimensions"),
                        0, 4);
    addUnclumpButton(INKSCAPE_ICON("distribute-unclump"),
                        _("Unclump objects: try to equalize edge-to-edge distances"),
                        0, 5);

    //Remove overlaps
    addRemoveOverlapsButton(INKSCAPE_ICON("distribute-remove-overlaps"),
                            _("Move objects as little as possible so that their bounding boxes do not overlap"),
                            0, 0);

    //Node Mode buttons
    // NOTE: "align nodes vertically" means "move nodes vertically until they align on a common
    // _horizontal_ line". This is analogous to what the "align-vertical-center" icon means.
    // There is no doubt some ambiguity. For this reason the descriptions are different.
    addNodeButton(INKSCAPE_ICON("align-vertical-node"),
                  _("Align selected nodes to a common horizontal line"),
                  0, Geom::X, false);
    addNodeButton(INKSCAPE_ICON("align-horizontal-node"),
                  _("Align selected nodes to a common vertical line"),
                  1, Geom::Y, false);
    addNodeButton(INKSCAPE_ICON("distribute-horizontal-node"),
                  _("Distribute selected nodes horizontally"),
                  2, Geom::X, true);
    addNodeButton(INKSCAPE_ICON("distribute-vertical-node"),
                  _("Distribute selected nodes vertically"),
                  3, Geom::Y, true);

    //Rest of the widgetry

    _combo.append(_("Last selected"));
    _combo.append(_("First selected"));
    _combo.append(_("Biggest object"));
    _combo.append(_("Smallest object"));
    _combo.append(_("Page"));
    _combo.append(_("Drawing"));
    _combo.append(_("Selection"));
    _combo.set_active(prefs->getInt("/dialogs/align/align-to", 6));
    _combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change));

    _anchorBox.pack_end(_combo, false, false);
    _anchorBox.pack_end(_anchorLabel, false, false);

    _selgrpLabel.set_mnemonic_widget(_selgrp);
    _selgrpBox.pack_end(_selgrp, false, false);
    _selgrpBox.pack_end(_selgrpLabel, false, false);
    _selgrp.set_active(prefs->getBool("/dialogs/align/sel-as-groups"));
    _selgrp.signal_toggled().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_selgrp_toggled));

    // Right align the buttons
    _alignTableBox.pack_end(_alignTable, false, false);
    _distributeTableBox.pack_end(_distributeTable, false, false);
    _rearrangeTableBox.pack_end(_rearrangeTable, false, false);
    _removeOverlapTableBox.pack_end(_removeOverlapTable, false, false);
    _nodesTableBox.pack_end(_nodesTable, false, false);

    _alignBox.pack_start(_anchorBox);
    _alignBox.pack_start(_selgrpBox);
    _alignBox.pack_start(_alignTableBox);

    _alignFrame.add(_alignBox);
    _distributeFrame.add(_distributeTableBox);
    _rearrangeFrame.add(_rearrangeTableBox);
    _removeOverlapFrame.add(_removeOverlapTableBox);
    _nodesFrame.add(_nodesTableBox);

    Gtk::Box *contents = _getContents();
    contents->set_spacing(4);

    // Notebook for individual transformations

    contents->pack_start(_alignFrame, true, true);
    contents->pack_start(_distributeFrame, true, true);
    contents->pack_start(_rearrangeFrame, true, true);
    contents->pack_start(_removeOverlapFrame, true, true);
    contents->pack_start(_nodesFrame, true, true);

    //Connect to the global tool change signal
    g_signal_connect (G_OBJECT (INKSCAPE), "set_eventcontext", G_CALLBACK (on_tool_changed), this);

    // Connect to the global selection change, to invalidate cached randomize_bbox
    g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
    randomize_bbox = Geom::OptRect();

    _desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &AlignAndDistribute::setDesktop) );
    _deskTrack.connect(GTK_WIDGET(gobj()));

    show_all_children();

    on_tool_changed (NULL, NULL, this); // set current mode
}
예제 #27
0
LivePathEffectEditor::LivePathEffectEditor()
    : UI::Widget::Panel("", "/dialogs/livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT),
      lpe_list_locked(false),
      combo_effecttype(Inkscape::LivePathEffect::LPETypeConverter),
      effectwidget(NULL),
      explain_label("", Gtk::ALIGN_CENTER),
      // TRANSLATORS: this dialog is accessible via menu Path - Path Effect Editor...
      effectapplication_frame(_("Apply new effect")),
      effectcontrol_frame(_("Current effect")),
      effectlist_frame(_("Effect list")),
      button_up(Gtk::Stock::GO_UP),
      button_down(Gtk::Stock::GO_DOWN),
      button_apply(Gtk::Stock::ADD),
      button_remove(Gtk::Stock::REMOVE),
      current_desktop(NULL),
      current_lpeitem(NULL)
{
    Gtk::Box *contents = _getContents();
    contents->set_spacing(4);

    //Add the TreeView, inside a ScrolledWindow, with the button underneath:
    scrolled_window.add(effectlist_view);
    //Only show the scrollbars when they are necessary:
    scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    scrolled_window.set_size_request(0, 50);

    effectapplication_hbox.set_spacing(4);
    effectcontrol_vbox.set_spacing(4);
    effectlist_vbox.set_spacing(4);

    effectapplication_hbox.pack_start(combo_effecttype, true, true);
    effectapplication_hbox.pack_start(button_apply, true, true);
    effectapplication_frame.add(effectapplication_hbox);

    effectlist_vbox.pack_start(scrolled_window, Gtk::PACK_EXPAND_WIDGET);
    effectlist_vbox.pack_end(toolbar, Gtk::PACK_SHRINK);
   // effectlist_vbox.pack_end(button_hbox, Gtk::PACK_SHRINK);
    effectlist_frame.add(effectlist_vbox);

    effectcontrol_vbox.pack_start(explain_label, true, true);
    effectcontrol_frame.add(effectcontrol_vbox);

 //   button_hbox.pack_start(button_up, true, true);
 //   button_hbox.pack_start(button_down, true, true);
 //   button_hbox.pack_end(button_remove, true, true);
    toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS);
 // Add toolbar items to toolbar
    toolbar.append(button_up);
    toolbar.append(button_down);
    toolbar.append(button_remove);


    // Add toolbar
    //add_toolbar(toolbar);
    toolbar.show_all(); //Show the toolbar and all its child widgets.


    //Create the Tree model:
    effectlist_store = Gtk::ListStore::create(columns);
    effectlist_view.set_model(effectlist_store);

    effectlist_view.set_headers_visible(false);

    // Handle tree selections
    effectlist_selection = effectlist_view.get_selection();
    effectlist_selection->signal_changed().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_effect_selection_changed) );

    //Add the visibility icon column:
    Inkscape::UI::Widget::ImageToggler *eyeRenderer = manage( new Inkscape::UI::Widget::ImageToggler(
        INKSCAPE_ICON_OBJECT_VISIBLE, INKSCAPE_ICON_OBJECT_HIDDEN) );
    int visibleColNum = effectlist_view.append_column("is_visible", *eyeRenderer) - 1;
    eyeRenderer->signal_toggled().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_visibility_toggled) );
    eyeRenderer->property_activatable() = true;
    Gtk::TreeViewColumn* col = effectlist_view.get_column(visibleColNum);
    if ( col ) {
        col->add_attribute( eyeRenderer->property_active(), columns.col_visible );
    }

    //Add the effect name column:
    effectlist_view.append_column("Effect", columns.col_name);

    contents->pack_start(effectapplication_frame, false, false);
    contents->pack_start(effectlist_frame, true, true);
    contents->pack_start(effectcontrol_frame, false, false);

    // connect callback functions to buttons
    button_apply.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onApply));
    button_remove.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onRemove));

    button_up.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onUp));
    button_down.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onDown));

    show_all_children();

    //button_remove.hide();
}
예제 #28
0
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;
}
예제 #29
0
  bool addWidgets(Gtk::Box* iBox) {
    if (mBox != NULL) return false;

    mBox = Gtk::manage(new Gtk::VBox());

    Gtk::Box* box = Gtk::manage(new Gtk::HBox());

    mToggleButton = Gtk::manage(new Gtk::ToggleButton("                    "));
    Gdk::Color color;
    color.set_rgb_p(mAttributes.mColor[0], mAttributes.mColor[1],
                    mAttributes.mColor[2]);
    mToggleButton->modify_bg(Gtk::STATE_ACTIVE, color);
    color.set_rgb_p((mAttributes.mColor[0]+1)/2, (mAttributes.mColor[1]+1)/2,
                    (mAttributes.mColor[2]+1)/2);
    mToggleButton->modify_bg(Gtk::STATE_PRELIGHT, color); 
    color.set_rgb_p(0.8, 0.8, 0.8);
    mToggleButton->modify_bg(Gtk::STATE_NORMAL, color);
    mToggleButton->signal_toggled().connect
      (sigc::mem_fun(*this, &Helper::onToggleButton));
    mToggleButton->set_active(true);
    box->pack_start(*(mToggleButton), false, false);
    Gtk::Label* label = Gtk::manage(new Gtk::Label(mAttributes.mLabel));
    box->pack_start(*label, false, false);
    if (mViewId != 1) {
      Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button("X"));
      box->pack_start(*cancelButton, false, false);
      cancelButton->signal_clicked().connect
        (sigc::mem_fun(*this, &Helper::onRemoveButton));
    }
    Gtk::Button* button = Gtk::manage(new Gtk::Button("save"));
    button->signal_clicked().connect
      (sigc::mem_fun(*this, &Helper::onSaveButton));
    box->pack_start(*button, false, false);

    mBox->pack_start(*box, false, false);

    box = Gtk::manage(new Gtk::HBox());
    std::vector<int> ids;
    std::vector<std::string> labels;
    ids = { MeshRenderer::ColorModeFlat, MeshRenderer::ColorModeHeight,
            MeshRenderer::ColorModeRange, MeshRenderer::ColorModeNormal,
            MeshRenderer::ColorModeCamera };
    labels = { "Flat", "Height", "Range", "Normal", "Camera" };
    Gtk::ComboBox* combo = 
      gtkmm::RendererBase::createCombo(mAttributes.mColorMode, labels, ids);
    combo->signal_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*combo, false, false);

    ids = { MeshRenderer::MeshModePoints, MeshRenderer::MeshModeWireframe,
            MeshRenderer::MeshModeFilled };
    labels = { "Points", "Wireframe", "Filled" };
    combo =
      gtkmm::RendererBase::createCombo(mAttributes.mMeshMode, labels, ids);
    combo->signal_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*combo, false, false);
    
    Gtk::HScale* slider =
      gtkmm::RendererBase::createSlider(mAttributes.mPointSize, 0.1, 10, 0.1);
    slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*slider, true, true);

    mBox->pack_start(*box, false, false);

    box = Gtk::manage(new Gtk::HBox());
    label = Gtk::manage(new Gtk::Label("Z Rng"));
    box->pack_start(*label,false,false);
    slider = gtkmm::RendererBase::createSlider(mAttributes.mMinZ, -1, 2, 0.01);
    slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*slider, true, true);
    slider = gtkmm::RendererBase::createSlider(mAttributes.mMaxZ, -1, 2, 0.01);
    slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*slider, true, true);

    mBox->pack_start(*box, false, false);

    mBox->pack_start(*Gtk::manage(new Gtk::HSeparator()));

    mBox->show_all();
    iBox->pack_start(*mBox, false, false);
    return true;
  }
예제 #30
0
KnotPropertiesDialog::KnotPropertiesDialog()
: _desktop(NULL), _knotpoint(NULL), _position_visible(false)
{
    Gtk::Box *mainVBox = get_vbox();

    _layout_table.set_spacings(4);
    _layout_table.resize (2, 2);
    _unit_name = "";
    // Layer name widgets
    _knot_x_entry.set_activates_default(true);
    _knot_x_entry.set_digits(4);
    _knot_x_entry.set_increments(1,1);
    _knot_x_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE);
    _knot_x_label.set_label(_("Position X:"));
    _knot_x_label.set_alignment(1.0, 0.5);

    _knot_y_entry.set_activates_default(true);
    _knot_y_entry.set_digits(4);
    _knot_y_entry.set_increments(1,1);
    _knot_y_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE);
     _knot_y_label.set_label(_("Position Y:"));
    _knot_y_label.set_alignment(1.0, 0.5);

    _layout_table.attach(_knot_x_label,
                         0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_knot_x_entry,
                         1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    _layout_table.attach(_knot_y_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
    _layout_table.attach(_knot_y_entry, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    mainVBox->pack_start(_layout_table, true, true, 4);

    // Buttons
    _close_button.set_use_stock(true);
    _close_button.set_label(Gtk::Stock::CANCEL.id);
    _close_button.set_can_default();

    _apply_button.set_use_underline(true);
    _apply_button.set_can_default();

    _close_button.signal_clicked()
        .connect(sigc::mem_fun(*this, &KnotPropertiesDialog::_close));
    _apply_button.signal_clicked()
        .connect(sigc::mem_fun(*this, &KnotPropertiesDialog::_apply));

    signal_delete_event().connect(
        sigc::bind_return(
            sigc::hide(sigc::mem_fun(*this, &KnotPropertiesDialog::_close)),
            true
        )
    );
    add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
    add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);

    _apply_button.grab_default();

    show_all_children();

    set_focus(_knot_y_entry);
}