Beispiel #1
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);
}
Beispiel #2
0
  TranslationSpinRow(View *view, Gtk::TreeView *rfo_tree,
	  const char *box_name) :
    m_inhibit_update(false), m_view(view)
  {
    view->m_builder->get_widget (box_name, m_box);

    for (uint i = 0; i < 3; i++) {
        m_box->add (*new Gtk::Label (axis_names[i]));
        m_xyz[i] = new Gtk::SpinButton();
        m_xyz[i]->set_numeric();
        m_xyz[i]->set_digits (1);
        m_xyz[i]->set_increments (0.5, 10);
        m_xyz[i]->set_range(-500.0, +500.0);
        m_box->add (*m_xyz[i]);
        m_xyz[i]->signal_value_changed().connect
            (sigc::bind(sigc::mem_fun(*this, &TranslationSpinRow::spin_value_changed), (int)i));

        /* Add statusbar message */
        stringstream oss;
        oss << "Move object in " << axis_names[i] << "-direction (mm)";
        m_view->add_statusbar_msg(m_xyz[i], oss.str().c_str());
    }
    selection_changed();
    m_box->show_all();

    rfo_tree->get_selection()->signal_changed().connect
      (sigc::mem_fun(*this, &TranslationSpinRow::selection_changed));
  }
Beispiel #3
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();
}
void dialog::operate4(Image imag,std::string filename)
{
    set_default_size(300, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

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

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

    Gtk::Label *label = Gtk::manage(new Gtk::Label("File Name :"));
    grid->attach(*label,0,0,1,1);
    Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
    grid->attach(*bvalue, 1, 0, 1, 1);
    Gtk::Label *label2 = Gtk::manage(new Gtk::Label(".bmp"));
    grid->attach(*label2,2,0,1,1);

    set_title("Save As");
    bvalue->set_text("Untitled");
    bvalue->set_max_length(50);

    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok4_click), bvalue,imag,filename));
    grid->attach(*bok, 2, 2, 1, 1);
    show_all_children();
}
Beispiel #5
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);
   }

}
Beispiel #7
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;

}
Beispiel #8
0
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);
}
Beispiel #9
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);
}
Beispiel #10
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();
}
Beispiel #11
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;
}
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);
  }
}
Beispiel #13
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;
}
Beispiel #14
0
    Gtk::Widget *SmartChessWindow::createNotificationBar() {
        Gtk::Box* statusbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
        statusbox->set_vexpand(false);
        statusbox->set_hexpand();

        mStatusBar = Gtk::manage(new Gtk::Statusbar());
        mStatusBar->set_vexpand(false);
        mStatusBar->set_hexpand();
        statusbox->add(*mStatusBar);

        Gtk::ProgressBar* progressbar = Gtk::manage(new Gtk::ProgressBar());
        progressbar->set_hexpand(false);
        progressbar->set_vexpand(false);
        statusbox->add(*progressbar);

        return statusbox;
    }
Beispiel #15
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();
}
Beispiel #16
0
    Gtk::Box *SmartChessWindow::createLogArea() {
        Gtk::Box * box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
        box->set_vexpand();
        box->set_hexpand(false);

        Gtk::TextView* pTextView = Gtk::manage(new Gtk::TextView(Gtk::TextBuffer::create()));
        pTextView->set_vexpand();
        pTextView->set_hexpand(false);

        Gtk::ScrolledWindow* scrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
        scrolledWindow->set_vexpand();
        scrolledWindow->set_hexpand(false);
        scrolledWindow->add(*pTextView);

        box->pack_end(*scrolledWindow);

        return box;
    }
Beispiel #17
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;
}
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;
}
Beispiel #19
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();
}
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();
}
Beispiel #22
0
View::View(BaseObjectType* cobject,
	   const Glib::RefPtr<Gtk::Builder>& builder)
  : Gtk::Window(cobject), m_builder(builder)
{
  // Menus
  connect_action ("OpenStl",         sigc::mem_fun(*this, &View::load_stl) );
  connect_action ("OpenGCode",       sigc::mem_fun(*this, &View::load_gcode) );
  connect_action ("Quit",            sigc::ptr_fun(&Gtk::Main::quit));
  connect_action ("About",           sigc::mem_fun(*this, &View::about_dialog) );

  connect_action ("PreferencesDialog", sigc::bind(sigc::mem_fun(*this, &View::show_dialog),
						  "preferences_dlg"));
  connect_action ("LoadSettings",    sigc::mem_fun(*this, &View::load_settings));
  connect_action ("SaveSettings",    sigc::mem_fun(*this, &View::save_settings));
  connect_action ("SaveSettingsAs",  sigc::mem_fun(*this, &View::save_settings_as));

#if 0
  // Simple tab
  connect_button ("s_load_stl",      sigc::mem_fun(*this, &View::load_stl) );
  connect_button ("s_convert_gcode", sigc::mem_fun(*this, &View::ConvertToGCode) );
  connect_button ("s_load_gcode",    sigc::mem_fun(*this, &View::load_gcode) );
  connect_button ("s_print",         sigc::mem_fun(*this, &View::SimplePrint) );
#endif

  // View tab
  connect_button ("m_load_stl",      sigc::mem_fun(*this, &View::load_stl) );
  connect_button ("m_save_stl",      sigc::mem_fun(*this, &View::save_stl) );
  connect_button ("m_delete",        sigc::mem_fun(*this, &View::delete_selected_stl) );
  connect_button ("m_duplicate",     sigc::mem_fun(*this, &View::duplicate_selected_stl) );
  connect_button ("m_auto_rotate",   sigc::mem_fun(*this, &View::auto_rotate) );
  connect_button ("m_rot_x",         sigc::bind(sigc::mem_fun(*this, &View::rotate_selection), Vector4f(1,0,0, M_PI/2)));
  connect_button ("m_rot_y",         sigc::bind(sigc::mem_fun(*this, &View::rotate_selection), Vector4f(0,1,0, M_PI/2)));
  connect_button ("m_rot_z",         sigc::bind(sigc::mem_fun(*this, &View::rotate_selection), Vector4f(0,0,1, M_PI/2)));
  m_builder->get_widget ("m_rfo_tree", m_rfo_tree);

  m_translation_row = new TranslationSpinRow (this, m_rfo_tree, "m_box_translate");

  Gtk::HScale *scale_slider;
  m_builder->get_widget("m_scale_slider", scale_slider);
  scale_slider->set_range(0.01, 5.0);
  scale_slider->set_value(1.0);
  m_rfo_tree->get_selection()->signal_changed().connect
      (sigc::mem_fun(*this, &View::update_scale_slider));
  scale_slider->signal_value_changed().connect
      (sigc::mem_fun(*this, &View::scale_object));

  add_statusbar_msg("m_scale_event_box", "Scale the selected object");

  // GCode tab
  m_builder->get_widget ("g_gcode", m_gcode_entry);
  m_gcode_entry->set_activates_default();
  m_gcode_entry->signal_activate().connect (sigc::mem_fun(*this, &View::send_gcode));;

  connect_button ("g_load_gcode",    sigc::mem_fun(*this, &View::load_gcode) );
  connect_button ("g_convert_gcode", sigc::mem_fun(*this, &View::convert_to_gcode) );
  connect_button ("g_save_gcode",    sigc::mem_fun(*this, &View::save_gcode) );
  connect_button ("g_send_gcode",    sigc::mem_fun(*this, &View::send_gcode) );

  // Print tab
  connect_button ("p_kick",          sigc::mem_fun(*this, &View::kick_clicked) );
  m_builder->get_widget ("p_power", m_power_button);
  m_power_button->signal_toggled().connect    (sigc::mem_fun(*this, &View::power_toggled));
  m_builder->get_widget ("p_print", m_print_button);
  m_print_button->signal_clicked().connect    (sigc::mem_fun(*this, &View::print_clicked) );
  m_builder->get_widget ("p_pause", m_continue_button);
  m_continue_button->signal_clicked().connect (sigc::mem_fun(*this, &View::continue_clicked));

  // Interactive tab
  connect_button ("i_home_all",        sigc::mem_fun(*this, &View::home_all));
  connect_toggled ("Misc.FileLoggingEnabled", sigc::mem_fun(*this, &View::enable_logging_toggled));
  connect_button ("i_clear_logs",      sigc::mem_fun(*this, &View::clear_logs) );
  m_builder->get_widget ("i_reverse", m_extruder_reverse);
  m_builder->get_widget ("i_ex_speed", m_extruder_speed);
  m_extruder_speed->set_range(100.0, 10000.0);
  m_extruder_speed->set_increments (100, 500);
  m_extruder_speed->set_value (3000.0);
  m_builder->get_widget ("i_ex_length", m_extruder_length);
  m_extruder_length->set_range(0.0, 1000.0);
  m_extruder_length->set_increments (5, 20);
  m_extruder_length->set_value (150.0);
  // FIXME: connect i_update_interval (etc.)
  connect_toggled ("i_fan_enabled", sigc::mem_fun(*this, &View::fan_enabled_toggled));
  m_builder->get_widget ("i_fan_voltage", m_fan_voltage);
  m_fan_voltage->set_range(0.0, 25.0);
  m_fan_voltage->set_increments (1, 2);
  m_fan_voltage->set_value (5.0);

  connect_button ("i_extrude_length", sigc::mem_fun(*this, &View::run_extruder) );

  // 3D preview of the bed
  Gtk::Box *pBox = NULL;
  m_builder->get_widget("viewarea", pBox);
  if (!pBox)
    std::cerr << "missing box!";
  else {
    m_renderer = new Render (this, m_rfo_tree->get_selection());
    pBox->add (*m_renderer);
  }
  showAllWidgets();
}
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();
}
Beispiel #25
0
void BoolFilterParam::add_to(Gtk::Box& box)
{
    box.pack_start(*btn_, false, false);
}
Beispiel #26
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;
}
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);
}
Beispiel #28
0
 ~Helper() {
   if (mBox != NULL) {
     mBox->get_parent()->remove(*mBox);
   }
 }
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);
}
Beispiel #30
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;
  }