/** \brief Creates a combobox widget for an enumeration parameter */ Gtk::Widget * ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_gui_hidden) return NULL; Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0)); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP)); label->show(); hbox->pack_start(*label, false, false); Gtk::ComboBoxText* cbt = 0; bool comboSet = false; if (_mode == MINIMAL) { cbt = Gtk::manage(new ComboWdg(this, doc, node)); cbt->show(); vbox->pack_start(*cbt, false, false); } // add choice strings as radiobuttons // and select last selected option (_value) Gtk::RadioButtonGroup group; for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { optionentry * entr = reinterpret_cast<optionentry *>(list->data); Glib::ustring * text = entr->guitext; switch ( _mode ) { case MINIMAL: { cbt->append_text(*text); if (!entr->value->compare(_value)) { cbt->set_active_text(*text); comboSet = true; } } break; case COMPACT: case FULL: { ParamRadioButtonWdg * radio = Gtk::manage(new ParamRadioButtonWdg(group, *text, this, doc, node, changeSignal)); radio->show(); vbox->pack_start(*radio, true, true); if (!entr->value->compare(_value)) { radio->set_active(); } } break; } } if ( (_mode == MINIMAL) && !comboSet) { cbt->set_active(0); } vbox->show(); hbox->pack_end(*vbox, false, false); hbox->show(); return dynamic_cast<Gtk::Widget *>(hbox); }
void ResViewerViewImpl::setFileContentsByName(std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> > FileContents) { Glib::ustring ExistingTabSelection = ""; if (mp_Notebook->get_current()) ExistingTabSelection = mp_Notebook->get_current()->get_tab_label_text(); int TabToSelect = 0; while (mp_Notebook->get_n_pages() > 1) mp_Notebook->remove_page(1); for (std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> >::iterator it = FileContents.begin(); it != FileContents.end(); ++it) { Gtk::TextView* TextView = Gtk::manage(new Gtk::TextView(it->second)); TextView->set_editable(false); TextView->set_visible(true); Gtk::ScrolledWindow* Win = Gtk::manage(new Gtk::ScrolledWindow()); Win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); Win->set_visible(true); Win->set_shadow_type(Gtk::SHADOW_ETCHED_IN); Win->add(*TextView); Gtk::Label* TabLabel = Gtk::manage(new Gtk::Label(it->first)); Gtk::Label* MenuLabel = Gtk::manage(new Gtk::Label(it->first, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER)); Gtk::Button* SingleGNUplotButton = Gtk::manage(new Gtk::Button( _("Plot file with GNUplot\n(All-in-one window)"))); Gtk::Button* MultiGNUplotButton = Gtk::manage(new Gtk::Button( _("Plot file with GNUplot\n(Multiple windows)"))); Gtk::VBox* RightButtonsBox = Gtk::manage(new Gtk::VBox()); RightButtonsBox->pack_start(*SingleGNUplotButton, Gtk::PACK_SHRINK); RightButtonsBox->pack_start(*MultiGNUplotButton, Gtk::PACK_SHRINK, 5); RightButtonsBox->show_all_children(true); RightButtonsBox->set_visible(true); #if WIN32 SingleGNUplotButton->set_sensitive(false); MultiGNUplotButton->set_sensitive(false); #else if (ViewWithGNUplot::IsGNUplotAvailable()) { SingleGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr< Gtk::TextBuffer>, std::string, std::string, std::string, bool>( sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked), (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep, m_CommentChar, true)); SingleGNUplotButton->set_sensitive(true); MultiGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr< Gtk::TextBuffer>, std::string, std::string, std::string, bool>( sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked), (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep, m_CommentChar, false)); MultiGNUplotButton->set_sensitive(true); } else { SingleGNUplotButton->set_sensitive(false); MultiGNUplotButton->set_sensitive(false); } #endif Gtk::HBox* MainHBox = Gtk::manage(new Gtk::HBox()); MainHBox->pack_start(*Win, Gtk::PACK_EXPAND_WIDGET, 5); MainHBox->pack_start(*RightButtonsBox, Gtk::PACK_SHRINK, 5); MainHBox->set_border_width(8); MainHBox->set_visible(true); int PageNum = mp_Notebook->append_page(*MainHBox, *TabLabel, *MenuLabel); if (it->first == ExistingTabSelection) TabToSelect = PageNum; mp_Notebook->set_tab_reorderable(*Win, true); } mp_Notebook->set_current_page(TabToSelect); }
void DataSet::initGtk() { _gtkOptList.reset(new Gtk::VBox); {//The heading of the data set window Gtk::Frame* frame = Gtk::manage(new Gtk::Frame("Data Set Information")); frame->show(); _gtkOptList->pack_start(*frame, false, true, 5); Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox); vbox->show(); frame->add(*vbox); _infolabel.reset(new Gtk::Label("Points: " + boost::lexical_cast<std::string>(_N))); _infolabel->show(); vbox->pack_start(*_infolabel, false, true, 5); } //Glyph adding mechanism { Gtk::HBox* box = Gtk::manage(new Gtk::HBox); box->show(); _gtkOptList->pack_start(*box, false, false, 5); _comboPointSet.reset(new Gtk::ComboBoxText); _comboPointSet->show(); box->pack_start(*_comboPointSet, false, false, 5); //Check the combo box is correct _comboPointSet->get_model().clear(); for (const auto& pointset: _pointSets) _comboPointSet->insert(-1, pointset.first); _comboPointSet->set_active(0); Gtk::Button* btn = Gtk::manage(new Gtk::Button("Add Glyphs")); btn->signal_clicked().connect(sigc::mem_fun(*this, &DataSet::addGlyphs)); btn->show(); box->pack_start(*btn, false, false, 5); _comboLinkSet.reset(new Gtk::ComboBoxText); _comboLinkSet->show(); box->pack_start(*_comboLinkSet, false, false, 5); //Check the combo box is correct _comboLinkSet->get_model().clear(); for (const auto& linkset: _linkSets) _comboLinkSet->insert(-1, linkset.first); _comboLinkSet->set_active(0); btn = Gtk::manage(new Gtk::Button("Add Links")); btn->signal_clicked().connect(sigc::mem_fun(*this, &DataSet::addLinkGlyphs)); btn->show(); box->pack_start(*btn, false, false, 5); } { _attrcolumns.reset(new ModelColumns); _attrtreestore = Gtk::TreeStore::create(*_attrcolumns); _attrtreestore->set_sort_column(_attrcolumns->components, Gtk::SORT_DESCENDING); _attrview.reset(new Gtk::TreeView); _attrview->set_model(_attrtreestore); _attrview->append_column("Name", _attrcolumns->name); _attrview->append_column("Components", _attrcolumns->components); _attrview->append_column("Min Values", _attrcolumns->min); _attrview->append_column("Max Values", _attrcolumns->max); _attrview->show(); Gtk::ScrolledWindow* win = Gtk::manage(new Gtk::ScrolledWindow); win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); win->add(*_attrview); Gtk::Frame* frame = Gtk::manage(new Gtk::Frame("Available Attributes")); frame->show(); frame->add(*win); _gtkOptList->pack_start(*frame, true, true, 5); win->show(); } { _positionSel.reset(new AttributeSelector(false)); _gtkOptList->pack_start(*_positionSel, false, false); } _gtkOptList->show(); rebuildGui(); }
WidgetExpanderBase::WidgetExpanderBase() : WidgetExpander() { mp_ColorButton = Gtk::manage(new Gtk::ColorButton(getARandColor())); mp_WidthSpinButton = Gtk::manage(new Gtk::SpinButton()); mp_WidthSpinButton->set_range(1, 100); mp_WidthSpinButton->set_increments(1, 10); mp_WidthSpinButton->set_numeric(true); mp_WidthSpinButton->set_value(1); mp_OpacityHScale = Gtk::manage(new Gtk::HScale(0, 101, 1)); mp_OpacityHScale->set_value_pos(Gtk::POS_LEFT); mp_OpacityHScale->set_value(100); mp_OpacityHScale->set_update_policy(Gtk::UPDATE_DELAYED); mp_ShowIDCheckBox = Gtk::manage(new Gtk::CheckButton(_("Show units IDs"))); // mp_CheckButtonGraph = Gtk::manage(new Gtk::CheckButton(_("show graph"))); Gtk::HBox* ColorButtonBox = Gtk::manage(new Gtk::HBox()); ColorButtonBox->pack_start(*mp_ColorButton, Gtk::PACK_SHRINK); Gtk::HBox* WidthSpinButtonBox = Gtk::manage(new Gtk::HBox()); WidthSpinButtonBox->pack_start(*mp_WidthSpinButton, Gtk::PACK_SHRINK); Gtk::Table* mp_MainTable = Gtk::manage(new Gtk::Table()); mp_MainTable->set_col_spacings(5); mp_MainTable->attach(*Gtk::manage(new Gtk::Label(_("Color:"), 0, 0.5)), 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK); mp_MainTable->attach(*Gtk::manage(new Gtk::Label(_("Width:"), 0, 0.5)), 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK); mp_MainTable->attach(*Gtk::manage(new Gtk::Label(_("Opacity:"), 0, 0.5)), 0, 1, 2, 3, Gtk::FILL, Gtk::SHRINK); mp_MainTable->attach(*ColorButtonBox, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); mp_MainTable->attach(*WidthSpinButtonBox, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); mp_MainTable->attach(*mp_OpacityHScale, 1, 2, 2, 3, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); mp_MainTable->attach(*mp_ShowIDCheckBox, 0, 2, 3, 4, Gtk::FILL, Gtk::SHRINK); // mp_MainTable->attach(*mp_CheckButtonGraph, 0, 2, 4, 5, Gtk::FILL, Gtk::SHRINK); Gtk::Alignment* MainTableAlign = Gtk::manage(new Gtk::Alignment()); MainTableAlign->set_padding(10, 20, 20, 0); MainTableAlign->add(*mp_MainTable); mp_MainExpander->set_label(_("Style")); mp_MainExpander->add(*MainTableAlign); mp_MainExpander->show_all_children(); //******************Signal connexion********************* mp_ColorButton->signal_color_set().connect(sigc::mem_fun(*this, &WidgetExpanderBase::onWidgetExpanderBaseChanged)); mp_WidthSpinButton->signal_value_changed().connect(sigc::mem_fun(*this, &WidgetExpanderBase::onWidgetExpanderBaseChanged)); mp_OpacityHScale->signal_value_changed().connect(sigc::mem_fun(*this, &WidgetExpanderBase::onWidgetExpanderBaseChanged)); mp_ShowIDCheckBox->signal_toggled().connect(sigc::mem_fun(*this, &WidgetExpanderBase::onWidgetExpanderBaseChanged)); // mp_CheckButtonGraph->signal_toggled().connect( // sigc::mem_fun(*this, &WidgetExpanderBase::onWidgetExpanderBaseChanged)); }
HistorySubMenu::HistorySubMenu( const std::string& url_history ) : Gtk::Menu(), m_url_history( url_history ) { Gtk::MenuItem* item; // メニュー項目作成 // 履歴クリア Gtk::Menu* menu = Gtk::manage( new Gtk::Menu() ); item = Gtk::manage( new Gtk::MenuItem( "クリアする(_C)", true ) ); menu->append( *item ); item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_clear ) ); item = Gtk::manage( new Gtk::MenuItem( "履歴クリア(_C)", true ) ); item->set_submenu( *menu ); append( *item ); item = Gtk::manage( new Gtk::MenuItem( "サイドバーに全て表示(_S)", true ) ); append( *item ); item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_switch_sideber ) ); // セパレータ item = Gtk::manage( new Gtk::SeparatorMenuItem() ); append( *item ); // 履歴項目 for( int i = 0; i < CONFIG::get_history_size(); ++i ){ Gtk::Image* image = Gtk::manage( new Gtk::Image() ); m_vec_images.push_back( image ); Gtk::Label* label = Gtk::manage( new Gtk::Label( HIST_NONAME ) ); m_vec_label.push_back( label ); Gtk::Label *label_motion = Gtk::manage( new Gtk::Label() ); if( i == 0 ) label_motion->set_text( CONTROL::get_str_motions( CONTROL::RestoreLastTab ) ); Gtk::HBox* hbox = Gtk::manage( new Gtk::HBox() ); hbox->set_spacing( SPACING_MENU ); hbox->pack_start( *image, Gtk::PACK_SHRINK ); hbox->pack_start( *label, Gtk::PACK_SHRINK ); hbox->pack_end( *label_motion, Gtk::PACK_SHRINK ); Gtk::MenuItem* item = Gtk::manage( new Gtk::MenuItem( *hbox ) ); append( *item ); item->signal_activate().connect( sigc::bind< int >( sigc::mem_fun( *this, &HistorySubMenu::slot_active ), i ) ); item->signal_button_press_event().connect( sigc::bind< int >( sigc::mem_fun( *this, &HistorySubMenu::slot_button_press ), i ) ); } // ポップアップメニュー作成 m_popupmenu.signal_deactivate().connect( sigc::mem_fun( *this, &HistorySubMenu::deactivate ) ); item = Gtk::manage( new Gtk::MenuItem( "タブで開く" ) ); item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_open_history ) ); m_popupmenu.append( *item ); item = Gtk::manage( new Gtk::SeparatorMenuItem() ); m_popupmenu.append( *item ); item = Gtk::manage( new Gtk::MenuItem( "履歴から削除" ) ); item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_remove_history ) ); m_popupmenu.append( *item ); item = Gtk::manage( new Gtk::SeparatorMenuItem() ); m_popupmenu.append( *item ); item = Gtk::manage( new Gtk::MenuItem( "プロパティ" ) ); item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_show_property ) ); m_popupmenu.append( *item ); m_popupmenu.show_all_children(); }
void ModelStructureModule::compose() { mp_MainPanel = Gtk::manage(new Gtk::VPaned()); Gtk::VBox* ButtonsPanel = Gtk::manage(new Gtk::VBox()); ButtonsPanel->pack_start(*mp_StructureListToolBox->asWidget(),Gtk::PACK_SHRINK); ButtonsPanel->set_visible(true); Gtk::HBox* TopPanel = Gtk::manage(new Gtk::HBox()); TopPanel->set_border_width(5); TopPanel->pack_start(*mp_ModelStructureMVP->asWidget(),Gtk::PACK_EXPAND_WIDGET,5); TopPanel->pack_start(*ButtonsPanel, Gtk::PACK_SHRINK,5); TopPanel->pack_start(*mp_ModelFctDetailMVP->asWidget(),Gtk::PACK_SHRINK,5); TopPanel->set_visible(true); TopPanel->set_border_width(6); Gtk::HBox* BottomPanel = Gtk::manage(new Gtk::HBox()); BottomPanel->set_border_width(5); BottomPanel->pack_start(*mp_ModelParamsPanel->asWidget()); BottomPanel->set_visible(true); BottomPanel->set_border_width(6); BuilderFrame* TopFrame = Gtk::manage(new BuilderFrame()); TopFrame->setLabelText(_("Model definition")); TopFrame->set_visible(true); TopFrame->add(*TopPanel); BuilderFrame* BottomFrame = Gtk::manage(new BuilderFrame()); BottomFrame->setLabelText(_("Model parameters")); BottomFrame->set_visible(true); BottomFrame->add(*BottomPanel); mp_MainPanel->pack1(*TopFrame, true,false); mp_MainPanel->pack2(*BottomFrame, true,false); mp_MainPanel->set_visible(true); }
void RVolume::initGTK() { _optList.reset(new Gtk::VBox);//The Vbox of options {//Transfer function widget _transferFunction.reset(new magnet::gtk::TransferFunction (magnet::function::MakeDelegate (this, &RVolume::transferFunctionUpdated))); _transferFunction->set_size_request(-1, 100); _optList->add(*_transferFunction); _transferFunction->show(); transferFunctionUpdated(); //Force an update of the transfer function now we have the widget } {//Volume renderer step size _stepSize.reset(new Gtk::Entry); Gtk::HBox* box = manage(new Gtk::HBox); Gtk::Label* label = manage(new Gtk::Label("Raytrace Step Size")); box->pack_start(*label, false, false); label->show(); box->pack_end(*_stepSize, false, false); _stepSize->show(); _stepSize->set_text("0.01"); _optList->add(*box); box->show(); } {//Diffusive lighting Gtk::HBox* box = manage(new Gtk::HBox); Gtk::Label* label = manage(new Gtk::Label("Diffuse Lighting")); box->pack_start(*label, false, false); label->show(); _diffusiveLighting.reset(new Gtk::HScale); box->pack_end(*_diffusiveLighting, true, true); _diffusiveLighting->set_range(0,2); _diffusiveLighting->set_digits(3); _diffusiveLighting->show(); _diffusiveLighting->set_value(1.0); _optList->add(*box); box->show(); } {//Specular lighting Gtk::HBox* box = manage(new Gtk::HBox); Gtk::Label* label = manage(new Gtk::Label("Specular Lighting")); box->pack_start(*label, false, false); label->show(); _specularLighting.reset(new Gtk::HScale); box->pack_end(*_specularLighting, true, true); _specularLighting->set_range(0,2); _specularLighting->set_digits(3); _specularLighting->show(); _specularLighting->set_value(1.0); _optList->add(*box); box->show(); } {//Ray Dithering Gtk::HBox* box = manage(new Gtk::HBox); Gtk::Label* label = manage(new Gtk::Label("Ray Dithering")); box->pack_start(*label, false, false); label->show(); _ditherRay.reset(new Gtk::HScale); box->pack_end(*_ditherRay, true, true); _ditherRay->set_range(0, 1); _ditherRay->set_digits(3); _ditherRay->show(); _ditherRay->set_value(1.0); _optList->add(*box); box->show(); } _optList->show(); //Callbacks _stepSize->signal_changed() .connect(sigc::bind<Gtk::Entry&>(&magnet::Gtk::forceNumericEntry, *_stepSize)); _stepSize->signal_activate().connect(sigc::mem_fun(*this, &RVolume::guiUpdate)); guiUpdate(); }
void RLight::initGTK() { _optList.reset(new Gtk::VBox); { //Intensity Gtk::HBox* box = manage(new Gtk::HBox); box->show(); { Gtk::Label* label = manage(new Gtk::Label("Intensity and Color", 0.95, 0.5)); box->pack_start(*label, true, true); label->show(); } _intensityEntry.reset(new Gtk::Entry); box->pack_start(*_intensityEntry, false, false); _intensityEntry->show(); _intensityEntry->set_width_chars(7); _intensityEntry->set_text(boost::lexical_cast<std::string>(_intensity)); _intensityEntry->signal_changed() .connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_intensityEntry)); _intensityEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); { _lightColor.reset(new Gtk::ColorButton); _lightColor->set_use_alpha(false); Gdk::Color color; color.set_rgb(_color[0] * G_MAXUSHORT, _color[1] * G_MAXUSHORT, _color[2] * G_MAXUSHORT); _lightColor->set_color(color); box->pack_start(*_lightColor, false, false); _lightColor->show(); _lightColor->signal_color_set().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); } { Gtk::Label* label = manage(new Gtk::Label("Attenuation", 0.95, 0.5)); box->pack_start(*label, true, true); label->show(); } _attenuationEntry.reset(new Gtk::Entry); box->pack_start(*_attenuationEntry, false, false); _attenuationEntry->show(); _attenuationEntry->set_width_chars(7); _attenuationEntry->set_text(boost::lexical_cast<std::string>(_attenuation)); _attenuationEntry->signal_changed() .connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_attenuationEntry)); _attenuationEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); _optList->pack_start(*box, false, false); } { //Specular Gtk::HBox* box = manage(new Gtk::HBox); box->show(); { Gtk::Label* label = manage(new Gtk::Label("Specular Exponent", 0.95, 0.5)); box->pack_start(*label, true, true); label->show(); } _specularExponentEntry.reset(new Gtk::Entry); box->pack_start(*_specularExponentEntry, false, false); _specularExponentEntry->show(); _specularExponentEntry->set_width_chars(7); _specularExponentEntry->set_text(boost::lexical_cast<std::string>(_specularExponent)); _specularExponentEntry->signal_changed() .connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularExponentEntry)); _specularExponentEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); { Gtk::Label* label = manage(new Gtk::Label("Specular Strength", 0.95, 0.5)); box->pack_start(*label, true, true); label->show(); } _specularFactorEntry.reset(new Gtk::Entry); box->pack_start(*_specularFactorEntry, false, false); _specularFactorEntry->show(); _specularFactorEntry->set_width_chars(7); _specularFactorEntry->set_text(boost::lexical_cast<std::string>(_specularFactor)); _specularFactorEntry->signal_changed() .connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry)); _specularFactorEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); _optList->pack_start(*box, false, false); } { //Specular Gtk::HBox* box = manage(new Gtk::HBox); box->show(); { Gtk::Label* label = manage(new Gtk::Label("Position", 0.95, 0.5)); box->pack_start(*label, true, true); label->show(); } _positionXEntry.reset(new Gtk::Entry); box->pack_start(*_positionXEntry, false, false); _positionXEntry->show(); _positionXEntry->set_width_chars(7); _positionXEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[0])); _positionXEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry)); _positionXEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); _positionYEntry.reset(new Gtk::Entry); box->pack_start(*_positionYEntry, false, false); _positionYEntry->show(); _positionYEntry->set_width_chars(7); _positionYEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[1])); _positionYEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry)); _positionYEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); _positionZEntry.reset(new Gtk::Entry); box->pack_start(*_positionZEntry, false, false); _positionZEntry->show(); _positionZEntry->set_width_chars(7); _positionZEntry->set_text(boost::lexical_cast<std::string>(getEyeLocationObjSpace()[2])); _positionZEntry->signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::gtk::forceNumericEntry, *_specularFactorEntry)); _positionZEntry->signal_activate().connect(sigc::mem_fun(*this, &RLight::guiUpdate)); _optList->pack_start(*box, false, false); } _optList->show(); guiUpdate(); }
PreferencesDialogImpl::PreferencesDialogImpl() : Gtk::Dialog() { m_editorEntry = NULL; m_ctagsEntry = NULL; // dialog properties set_title("Preferences"); set_position(GTK_WIN_POS_CENTER); set_modal(true); set_border_width(10); set_policy(false, false, true); // create the Default button Gtk::Button* defaultButton = manage(new Gtk::Button("Default")); defaultButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::defaultButtonCB)); defaultButton->set_usize(80, -1); defaultButton->set_flags(GTK_CAN_DEFAULT); defaultButton->show(); // create the Apply button Gtk::Button* applyButton = manage(new Gtk::Button("Apply")); applyButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::applyButtonCB)); applyButton->set_usize(80, -1); applyButton->set_flags(GTK_CAN_DEFAULT); applyButton->show(); // create the OK button and make it default Gtk::Button* okButton = manage(new Gtk::Button("OK")); okButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::okButtonCB)); okButton->set_usize(80, -1); okButton->set_flags(GTK_CAN_DEFAULT); okButton->grab_default(); okButton->show(); // create the Cancel button Gtk::Button* cancelButton = manage(new Gtk::Button("Cancel")); cancelButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::cancelButtonCB)); cancelButton->set_usize(80, -1); cancelButton->set_flags(GTK_CAN_DEFAULT); cancelButton->show(); // add the buttons to the hbox Gtk::HBox* hbox = get_action_area(); hbox->set_spacing(10); hbox->pack_start(*defaultButton, false, false); hbox->pack_start(*applyButton, false, false); hbox->pack_start(*okButton, false, false); hbox->pack_start(*cancelButton, false, false); // editor stuff Gtk::HBox* editorBox = manage(new Gtk::HBox()); Gtk::Label* editorLabel = manage(new Gtk::Label("Editor Command: ")); editorLabel->show(); editorBox->pack_start(*editorLabel, false, false); m_editorEntry = manage(new Gtk::Entry()); m_editorEntry->set_text(g_configMap[Config::EDITOR[0]]); m_editorEntry->show(); editorBox->pack_end(*m_editorEntry); editorBox->show(); // ctags stuff Gtk::HBox* ctagsBox = manage(new Gtk::HBox()); Gtk::Label* ctagsLabel = manage(new Gtk::Label("Ctags Command: ")); ctagsLabel->show(); ctagsBox->pack_start(*ctagsLabel, false, false); m_ctagsEntry = manage(new Gtk::Entry()); m_ctagsEntry->set_text(g_configMap[Config::CTAGS[0]]); m_ctagsEntry->show(); ctagsBox->pack_end(*m_ctagsEntry); ctagsBox->show(); // add everything to the vbox Gtk::VBox* vbox = get_vbox(); vbox->set_spacing(5); vbox->pack_start(*editorBox, false, false); vbox->pack_start(*ctagsBox, false, false); show(); Gtk::Main::run(); }
ModelGeneratorCreationDialog::ModelGeneratorCreationDialog( openfluid::core::CoreRepository& CoreRepos, openfluid::machine::ModelInstance* ModelInstance) : mp_CoreRepos(&CoreRepos), mp_ModelInstance(ModelInstance) { mp_VarNameEntry = Gtk::manage(new Gtk::Entry()); mp_VarNameEntry->set_activates_default(true); mp_VarNameEntry->signal_changed().connect(sigc::mem_fun(*this, &ModelGeneratorCreationDialog::onVarNameEntryChanged)); mp_ClassCombo = Gtk::manage(new Gtk::ComboBoxText()); Gtk::RadioButton::Group RadioGrp; mp_ScalarRadio = Gtk::manage( new Gtk::RadioButton(RadioGrp, _("Double Value"))); mp_VectorRadio = Gtk::manage(new Gtk::RadioButton(RadioGrp, _("Vector Value:") + std::string(" "))); mp_VarSizeSpin = Gtk::manage(new Gtk::SpinButton()); mp_VarSizeSpin->set_numeric(true); mp_VarSizeSpin->set_increments(1, 1); mp_VarSizeSpin->set_range(2.0, 9.0); mp_VarSizeSpin->set_activates_default(true); Gtk::Table* GenInfoTable = Gtk::manage(new Gtk::Table()); GenInfoTable->set_row_spacings(10); GenInfoTable->set_col_spacings(3); GenInfoTable->attach( *Gtk::manage(new Gtk::Label(_("Variable name"), 1, 0.5)), 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK); GenInfoTable->attach(*mp_VarNameEntry, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); GenInfoTable->attach(*Gtk::manage(new Gtk::Label(_("Unit class"), 1, 0.5)), 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK); GenInfoTable->attach(*mp_ClassCombo, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); Gtk::HBox* VectorBox = Gtk::manage(new Gtk::HBox()); VectorBox->pack_start(*mp_VectorRadio, Gtk::PACK_SHRINK); VectorBox->pack_start(*Gtk::manage(new Gtk::Label(_("Size"))), Gtk::PACK_SHRINK); VectorBox->pack_start(*mp_VarSizeSpin, Gtk::PACK_SHRINK); mp_Dialog = new Gtk::Dialog(_("Generator creation")); mp_InfoBarLabel = Gtk::manage(new Gtk::Label("")); mp_InfoBar = Gtk::manage(new Gtk::InfoBar()); mp_InfoBar->set_message_type(Gtk::MESSAGE_WARNING); ((Gtk::Container*) mp_InfoBar->get_content_area())->add(*mp_InfoBarLabel); mp_Dialog->get_vbox()->pack_start(*mp_InfoBar, Gtk::PACK_SHRINK); mp_Dialog->get_vbox()->pack_start(*GenInfoTable, Gtk::PACK_SHRINK, 10); mp_Dialog->get_vbox()->pack_start(*mp_ScalarRadio, Gtk::PACK_SHRINK); mp_Dialog->get_vbox()->pack_start(*VectorBox, Gtk::PACK_SHRINK, 10); mp_Dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); mp_Dialog->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); mp_Dialog->set_default_response(Gtk::RESPONSE_OK); mp_Dialog->show_all_children(); }
void StimResponseEditor::populateWindow() { // Create the overall vbox _dialogVBox = Gtk::manage(new Gtk::VBox(false, 12)); add(*_dialogVBox); // Create the notebook and add it to the vbox _notebook = Gtk::manage(new Gtk::Notebook); _dialogVBox->pack_start(*_notebook, true, true, 0); // The tab label items (icon + label) Gtk::HBox* stimLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); stimLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_STIM + SUFFIX_EXTENSION))), false, false, 3 ); stimLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Stims"))), false, false, 3); Gtk::HBox* responseLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); responseLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_RESPONSE + SUFFIX_EXTENSION))), false, false, 3 ); responseLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Responses"))), false, false, 3); Gtk::HBox* customLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); customLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_CUSTOM_STIM))), false, false, 3 ); customLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Custom Stims"))), false, false, 3); // Show the widgets before using them as label, they won't appear otherwise stimLabelHBox->show_all(); responseLabelHBox->show_all(); customLabelHBox->show_all(); // Cast the helper class to a widget and add it to the notebook page _stimPageNum = _notebook->append_page(*_stimEditor, *stimLabelHBox); _responsePageNum = _notebook->append_page(*_responseEditor, *responseLabelHBox); _customStimPageNum = _notebook->append_page(*_customStimEditor, *customLabelHBox); if (_lastShownPage == -1) { _lastShownPage = _stimPageNum; } // Pack in dialog buttons _dialogVBox->pack_start(createButtons(), false, false, 0); }
Example_markers::Example_markers() { Gtk::VBox *vbox, *vbox2; Gtk::HBox *hbox; Gtk::RadioButton *rbutton; set_title("Line Markers Example"); set_border_width(10); m_Viewport.canvas()->set_size( 500, 400 ); vbox = Gtk::manage(new Gtk::VBox()); vbox->pack_start( m_Viewport ); m_line = Papyrus::Polyline::create(); m_line->add_vertex(-100, 0); m_line->add_vertex(100, 0); m_line->set_stroke( Cairo::SolidPattern::create_rgb(0.0, 0.0, 1.0) ); m_line->stroke()->set_width(3); m_line->set_marker(Papyrus::START_MARKER, Papyrus::Marker::create()); m_line->marker(Papyrus::START_MARKER)->set_facing(Papyrus::Marker::LEFT); m_line->marker(Papyrus::START_MARKER)->stroke()->set_width(3); m_line->set_marker(Papyrus::END_MARKER, Papyrus::Marker::create()); m_line->marker(Papyrus::END_MARKER)->set_facing(Papyrus::Marker::RIGHT); m_line->marker(Papyrus::END_MARKER)->stroke()->set_width(3); m_Viewport.canvas()->add( m_line ); vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) ); hbox = Gtk::manage(new Gtk::HBox()); vbox->pack_start( *hbox ); vbox2 = Gtk::manage(new Gtk::VBox()); vbox2->pack_start( *Gtk::manage(new Gtk::Label("Start Marker")) ); vbox2->pack_start( m_start_combobox ); Gtk::RadioButtonGroup start_facing_group; rbutton = Gtk::manage(new Gtk::RadioButton(start_facing_group, "Left")); rbutton->set_active(); rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::START_MARKER, Papyrus::Marker::LEFT)); vbox2->pack_start(*rbutton); rbutton = Gtk::manage(new Gtk::RadioButton(start_facing_group, "Right")); rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::START_MARKER, Papyrus::Marker::RIGHT)); vbox2->pack_start(*rbutton); hbox->pack_start(*vbox2); vbox2 = Gtk::manage(new Gtk::VBox()); vbox2->pack_start( *Gtk::manage(new Gtk::Label("End Marker")) ); vbox2->pack_start( m_end_combobox ); Gtk::RadioButtonGroup end_facing_group; rbutton = Gtk::manage(new Gtk::RadioButton(end_facing_group, "Left")); rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::END_MARKER, Papyrus::Marker::LEFT)); vbox2->pack_start(*rbutton); rbutton = Gtk::manage(new Gtk::RadioButton(end_facing_group, "Right")); rbutton->set_active(); rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::END_MARKER, Papyrus::Marker::RIGHT)); vbox2->pack_start(*rbutton); hbox->pack_start(*vbox2); for (unsigned i=Papyrus::Marker::FIRST_STYLE; i < Papyrus::Marker::LAST_STYLE; i++) { m_start_combobox.append_text( Papyrus::Marker::style_strings[i] ); m_end_combobox.append_text( Papyrus::Marker::style_strings[i] ); } m_start_combobox.signal_changed().connect( sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_style_changed), Papyrus::START_MARKER)); m_start_combobox.set_active(Papyrus::Marker::NONE); m_end_combobox.signal_changed().connect( sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_style_changed), Papyrus::END_MARKER)); m_end_combobox.set_active(Papyrus::Marker::NONE); this->add( *vbox ); show_all(); }
Widget_Preview::Widget_Preview(): Gtk::Table(1, 5), adj_time_scrub(Gtk::Adjustment::create(0, 0, 1000, 0, 10, 0)), scr_time_scrub(adj_time_scrub), b_loop(/*_("Loop")*/), currentindex(-100000),//TODO get the value from canvas setting or preview option timedisp(-1), audiotime(0), jackbutton(), offset_widget(), adj_sound(Gtk::Adjustment::create(0, 0, 4)), l_lasttime("0s"), playing(false), singleframe(), toolbarisshown(), zoom_preview(true), toolbar(), play_button(), pause_button(), jackdial(NULL), jack_enabled(false), jack_is_playing(false), jack_time(0), jack_offset(0), jack_initial_time(0) #ifdef WITH_JACK , jack_client(NULL), jack_synchronizing(false) #endif { //catch key press event for shortcut keys signal_key_press_event().connect(sigc::mem_fun(*this, &Widget_Preview::on_key_pressed)); //connect to expose events //signal_expose_event().connect(sigc::mem_fun(*this, &studio::Widget_Preview::redraw)); //manage all the change in values etc... //1st row: preview content preview_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //pack preview content into scrolled window preview_window.add(draw_area); //preview window background color - Not working anymore after version 3.16! //https://developer.gnome.org/gtk3/unstable/GtkWidget.html#gtk-widget-override-background-color Gdk::RGBA bg_color; bg_color.set_red(54*256); bg_color.set_blue(59*256); bg_color.set_green(59*256); draw_area.override_background_color(bg_color); adj_time_scrub->signal_value_changed().connect(sigc::mem_fun(*this, &Widget_Preview::slider_move)); scr_time_scrub.signal_event().connect(sigc::mem_fun(*this, &Widget_Preview::scroll_move_event)); draw_area.signal_draw().connect(sigc::mem_fun(*this, &Widget_Preview::redraw)); scr_time_scrub.set_draw_value(0); Gtk::Button *button = 0; Gtk::Image *icon = 0; #if 1 //2nd row: prevframe play/pause nextframe loop | halt-render re-preview erase-all toolbar = Gtk::manage(new class Gtk::HBox(false, 0)); //prev rendered frame Gtk::Button *prev_framebutton; Gtk::Image *icon0 = manage(new Gtk::Image(Gtk::StockID("synfig-animate_seek_prev_frame"), Gtk::ICON_SIZE_BUTTON)); prev_framebutton = manage(new class Gtk::Button()); prev_framebutton->set_tooltip_text(_("Prev frame")); icon0->set_padding(0,0); icon0->show(); prev_framebutton->add(*icon0); prev_framebutton->set_relief(Gtk::RELIEF_NONE); prev_framebutton->show(); prev_framebutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &Widget_Preview::seek_frame), -1)); toolbar->pack_start(*prev_framebutton, Gtk::PACK_SHRINK, 0); { //play Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID("synfig-animate_play"), Gtk::ICON_SIZE_BUTTON)); play_button = manage(new class Gtk::Button()); play_button->set_tooltip_text(_("Play")); icon->set_padding(0,0); icon->show(); play_button->add(*icon); play_button->set_relief(Gtk::RELIEF_NONE); play_button->show(); play_button->signal_clicked().connect(sigc::mem_fun(*this, &Widget_Preview::on_play_pause_pressed)); toolbar->pack_start(*play_button, Gtk::PACK_SHRINK, 0); } { //pause Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID("synfig-animate_pause"), Gtk::ICON_SIZE_BUTTON)); pause_button = manage(new class Gtk::Button()); pause_button->set_tooltip_text(_("Pause")); icon->set_padding(0,0); icon->show(); pause_button->add(*icon); pause_button->set_relief(Gtk::RELIEF_NONE); pause_button->signal_clicked().connect(sigc::mem_fun(*this, &Widget_Preview::on_play_pause_pressed)); toolbar->pack_start(*pause_button, Gtk::PACK_SHRINK, 0); } //next rendered frame Gtk::Button *next_framebutton; Gtk::Image *icon2 = manage(new Gtk::Image(Gtk::StockID("synfig-animate_seek_next_frame"), Gtk::ICON_SIZE_BUTTON)); next_framebutton = manage(new class Gtk::Button()); next_framebutton->set_tooltip_text(_("Next frame")); icon2->set_padding(0,0); icon2->show(); next_framebutton->add(*icon2); next_framebutton->set_relief(Gtk::RELIEF_NONE); next_framebutton->show(); next_framebutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &Widget_Preview::seek_frame), 1)); toolbar->pack_start(*next_framebutton, Gtk::PACK_SHRINK, 0); //spacing Gtk::Alignment *space = Gtk::manage(new Gtk::Alignment()); space->set_size_request(8); toolbar->pack_start(*space, false, true); //loop button = &b_loop; IMAGIFY_BUTTON(button,"synfig-animate_loop", _("Loop")); toolbar->pack_start(b_loop, Gtk::PACK_SHRINK,0); //spacing Gtk::Alignment *space1 = Gtk::manage(new Gtk::Alignment()); space1->set_size_request(24); toolbar->pack_start(*space1, false, true); //halt render button = manage(new Gtk::Button(/*_("Halt Render")*/)); button->signal_clicked().connect(sigc::mem_fun(*this, &Widget_Preview::stoprender)); IMAGIFY_BUTTON(button,Gtk::Stock::STOP, _("Halt render")); toolbar->pack_start(*button, Gtk::PACK_SHRINK, 0); //re-preview button = manage(new Gtk::Button(/*_("Re-Preview")*/)); button->signal_clicked().connect(sigc::mem_fun(*this, &Widget_Preview::repreview)); IMAGIFY_BUTTON(button, Gtk::Stock::EDIT, _("Re-preview")); toolbar->pack_start(*button, Gtk::PACK_SHRINK, 0); //erase all button = manage(new Gtk::Button(/*_("Erase All")*/)); button->signal_clicked().connect(sigc::mem_fun(*this, &Widget_Preview::eraseall)); IMAGIFY_BUTTON(button, Gtk::Stock::CLEAR, _("Erase all rendered frame(s)")); toolbar->pack_start(*button, Gtk::PACK_SHRINK, 0); //spacing Gtk::Alignment *space2 = Gtk::manage(new Gtk::Alignment()); space1->set_size_request(24); toolbar->pack_start(*space2, false, true); //jack jackdial = Gtk::manage(new JackDial()); #ifdef WITH_JACK jack_dispatcher.connect(sigc::mem_fun(*this, &Widget_Preview::on_jack_sync)); jack_dispatcher.connect(sigc::mem_fun(*this, &Widget_Preview::on_jack_sync)); jackbutton = jackdial->get_toggle_jackbutton(); jackdial->signal_toggle_jack().connect(sigc::mem_fun(*this, &studio::Widget_Preview::toggle_jack_button)); jackdial->signal_offset_changed().connect(sigc::mem_fun(*this, &studio::Widget_Preview::on_jack_offset_changed)); #endif //FIXME: Hardcoded FPS! jackdial->set_fps(24.f); jackdial->set_offset(jack_offset); if ( !getenv("SYNFIG_DISABLE_JACK") ) jackdial->show(); toolbar->pack_start(*jackdial, false, true); //zoom preview factor_refTreeModel = Gtk::ListStore::create(factors); zoom_preview.set_model(factor_refTreeModel); zoom_preview.property_has_frame() = true; zoom_preview.signal_changed().connect(sigc::mem_fun(*this, &Widget_Preview::preview_draw)); Gtk::TreeModel::Row row = *(factor_refTreeModel->append()); row[factors.factor_id] = "1"; row[factors.factor_value] = "25%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "2"; row[factors.factor_value] = "50%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "3"; row[factors.factor_value] = "100%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "4"; row[factors.factor_value] = "200%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "5"; row[factors.factor_value] = _("Fit"); zoom_preview.set_entry_text_column(factors.factor_value); Gtk::Entry* entry = zoom_preview.get_entry(); entry->set_text("100%"); //default zoom level entry->set_icon_from_stock(Gtk::StockID("synfig-zoom")); entry->signal_activate().connect(sigc::mem_fun(*this, &Widget_Preview::on_zoom_entry_activated)); //set the zoom widget width zoom_preview.set_size_request(100, -1); zoom_preview.show(); toolbar->pack_end(zoom_preview, Gtk::PACK_SHRINK, 0); show_toolbar(); //3rd row: previewing frame numbering and rendered frame numbering Gtk::HBox *status = manage(new Gtk::HBox); status->pack_start(l_currenttime, Gtk::PACK_SHRINK, 5); Gtk::Label *separator = manage(new Gtk::Label(" / ")); status->pack_start(*separator, Gtk::PACK_SHRINK, 0); status->pack_start(l_lasttime, Gtk::PACK_SHRINK, 5); status->show_all(); // attach all widgets attach(preview_window, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0); attach(scr_time_scrub, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); attach(*toolbar, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); attach(*status, 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); preview_window.show_all(); scr_time_scrub.show_all(); //if(draw_area.get_window()) gc_area = Gdk::GC::create(draw_area.get_window()); #endif }
PanelEscenario::PanelEscenario(string rutaNivel, InformableSeleccion* informable, int cantidadJugadores, bool nivelNuevo) { this->cantidadJugadores = cantidadJugadores; this->rutaNivel = rutaNivel; this->informable = informable; cargarCaracteristicasNivel(); int ancho = (int)(anchoFlotante * PIXELES_SOBRE_METRO); int alto = (int)(altoFlotante * PIXELES_SOBRE_METRO); // Inicializacion de los widgets propios lienzo = new Lienzo(ancho, alto, cantidadJugadores, rutaFondo, rutaSuelo, informable); paletaEscenario = new PaletaEscenario(); eliminador = new EliminadorPosicionables(lienzo); entrada = new EntradaPajaros(anchoFlotante, altoFlotante); if (!nivelNuevo) { lienzo->cargarNivel(rutaNivel); entrada->cargarNivel(rutaNivel); } // Inicializacion del boton para guardar el nivel botonGuardar = new Gtk::Button(); Gtk::Image* imagenGuardar = manage(new Gtk::Image( Gtk::StockID("gtk-floppy"), Gtk::IconSize(Gtk::ICON_SIZE_BUTTON))); botonGuardar->set_image(*imagenGuardar); Gtk::Label* etiquetaGuardar = manage(new Gtk::Label("Guardar nivel: ")); // Inicializacion del boton para volver a la seleccion de niveles botonVolver = new Gtk::Button(); Gtk::Image* imagenVolver = manage(new Gtk::Image( Gtk::StockID("gtk-go-back"), Gtk::IconSize(Gtk::ICON_SIZE_BUTTON))); botonVolver->set_image(*imagenVolver); botonVolver->set_tooltip_text("Volver al panel de mundos"); // Contenedores Gtk::VBox* cajaVerticalUno = manage(new Gtk::VBox(false, 20)); cajaVerticalUno->pack_start(*paletaEscenario); cajaVerticalUno->pack_start(*eliminador); Gtk::VButtonBox* cajaAuxiliarUno = manage(new Gtk::VButtonBox()); cajaAuxiliarUno->set_layout(Gtk::BUTTONBOX_CENTER); cajaAuxiliarUno->pack_start(*botonGuardar, Gtk::PACK_SHRINK); Gtk::VButtonBox* cajaAuxiliarDos = manage(new Gtk::VButtonBox()); cajaAuxiliarDos->set_layout(Gtk::BUTTONBOX_CENTER); cajaAuxiliarDos->pack_start(*botonVolver, Gtk::PACK_SHRINK); Gtk::HBox* cajaHorizontalUno = manage(new Gtk::HBox(false, 20)); cajaHorizontalUno->pack_start(*etiquetaGuardar); cajaHorizontalUno->pack_start(*cajaAuxiliarUno); Gtk::VBox* cajaVerticalDos = manage(new Gtk::VBox(false, 20)); cajaVerticalDos->pack_start(*entrada); cajaVerticalDos->pack_start(*cajaHorizontalUno, Gtk::PACK_SHRINK); cajaVerticalDos->pack_start(*cajaAuxiliarDos, Gtk::PACK_SHRINK); Gtk::HBox* cajaHorizontal = manage(new Gtk::HBox(false, 20)); Gtk::VBox* cajaVerticalLienzo = manage(new Gtk::VBox(false, 0)); cajaVerticalLienzo->pack_start(*lienzo, Gtk::PACK_SHRINK); cajaHorizontal->pack_start(*cajaVerticalUno); cajaHorizontal->pack_start(*cajaVerticalLienzo, Gtk::PACK_SHRINK); cajaHorizontal->pack_start(*cajaVerticalDos); add(*cajaHorizontal); // Seniales botonGuardar->signal_clicked().connect(sigc::mem_fun(*this, &PanelEscenario::botonGuardarClickeado)); botonVolver->signal_clicked().connect(sigc::mem_fun(*this, &PanelEscenario::volverAPanelMundos)); }
preferencesDialog::preferencesDialog(int const _min_port, int const _max_port) : portrange_begin(0), beginPortRangeSpinbuttonAdj(0), portrange_end(0), endPortRangeSpinbuttonAdj(0), workPathEntry(0), outputPathEntry(0), leechModeCheckbutton(0), min_port(_max_port), max_port(_min_port), workPath(), outputPath(), leechmode(false), portrange_begin_intial_value(0), portrange_end_intial_value(0), workPath_initial_value(""), outputPath_initial_value(""), leechmode_initial_value(false), portrange_begin_signal(), portrange_end_signal(), save_btn_pressed(false) { Gtk::Label* workLabel = Gtk::manage(new class Gtk::Label("Working directory")); Gtk::Label* outputLabel = Gtk::manage(new class Gtk::Label("Output directory")); Gtk::Label* portRangeLabel = Gtk::manage(new class Gtk::Label("Port range")); Gtk::Label* leechModeLabel = Gtk::manage(new class Gtk::Label("Leech mode")); outputPathEntry = Gtk::manage(new class Gtk::Entry()); workPathEntry = Gtk::manage(new class Gtk::Entry()); leechModeCheckbutton = Gtk::manage(new class Gtk::CheckButton("enabled")); Gtk::Table* settingsTable = Gtk::manage(new class Gtk::Table(2, 2, false)); // Ports: Gtk::Table* portTable = Gtk::manage(new class Gtk::Table(2, 2, false));; Gtk::Label* beginPortLabel = Gtk::manage(new class Gtk::Label("Begin Port")); Gtk::Label* endPortLabel = Gtk::manage(new class Gtk::Label("End Port")); beginPortRangeSpinbuttonAdj = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10)); portrange_begin = Gtk::manage(new class Gtk::SpinButton(*beginPortRangeSpinbuttonAdj, 1, 0)); endPortRangeSpinbuttonAdj = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10)); portrange_end = Gtk::manage(new class Gtk::SpinButton(*endPortRangeSpinbuttonAdj, 1, 0)); beginPortLabel->set_alignment(0,0.5); beginPortLabel->set_padding(5,5); beginPortLabel->set_justify(Gtk::JUSTIFY_LEFT); beginPortLabel->set_line_wrap(false); beginPortLabel->set_use_markup(false); beginPortLabel->set_selectable(false); endPortLabel->set_alignment(0,0.5); endPortLabel->set_padding(5,5); endPortLabel->set_justify(Gtk::JUSTIFY_LEFT); endPortLabel->set_line_wrap(false); endPortLabel->set_use_markup(false); endPortLabel->set_selectable(false); portrange_end->set_flags(Gtk::CAN_FOCUS); portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_end->set_numeric(false); portrange_end->set_digits(0); portrange_end->set_wrap(false); portrange_end->set_flags(Gtk::CAN_FOCUS); portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_end->set_numeric(true); portrange_end->set_digits(0); portrange_end->set_wrap(false); portrange_begin->set_flags(Gtk::CAN_FOCUS); portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_begin->set_numeric(false); portrange_begin->set_digits(0); portrange_begin->set_wrap(false); portrange_begin->set_flags(Gtk::CAN_FOCUS); portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_begin->set_numeric(true); portrange_begin->set_digits(0); portrange_begin->set_wrap(false); portTable->set_border_width(10); portTable->set_row_spacings(5); portTable->set_col_spacings(5); portTable->attach(*beginPortLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); portTable->attach(*endPortLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0); portTable->attach(*portrange_end, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); portTable->attach(*portrange_begin, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); beginPortLabel->show(); endPortLabel->show(); portrange_begin->show(); portrange_end->show(); portTable->show(); Gtk::VBox *preferencesVbox = Gtk::manage(new class Gtk::VBox(false, 10)); outputLabel->set_alignment(0,0.5); outputLabel->set_padding(5,0); outputLabel->set_justify(Gtk::JUSTIFY_LEFT); outputLabel->set_line_wrap(false); outputLabel->set_use_markup(false); outputLabel->set_selectable(false); workLabel->set_alignment(0,0.5); workLabel->set_padding(5,0); workLabel->set_justify(Gtk::JUSTIFY_LEFT); workLabel->set_line_wrap(false); workLabel->set_use_markup(false); workLabel->set_selectable(false); portRangeLabel->set_alignment(0,0.5); portRangeLabel->set_padding(5,0); portRangeLabel->set_justify(Gtk::JUSTIFY_LEFT); portRangeLabel->set_line_wrap(false); portRangeLabel->set_use_markup(false); portRangeLabel->set_selectable(false); leechModeLabel->set_alignment(0,0.5); leechModeLabel->set_padding(5,0); leechModeLabel->set_justify(Gtk::JUSTIFY_LEFT); leechModeLabel->set_line_wrap(false); leechModeLabel->set_use_markup(false); leechModeLabel->set_selectable(false); Gtk::HBox* pathHbox = Gtk::manage(new class Gtk::HBox(false, 10)); Gtk::HBox* workPathHbox = Gtk::manage(new class Gtk::HBox(false, 10)); outputPathEntry->set_flags(Gtk::CAN_FOCUS); outputPathEntry->set_visibility(true); outputPathEntry->set_editable(false); outputPathEntry->set_max_length(0); outputPathEntry->set_text(""); outputPathEntry->set_has_frame(true); outputPathEntry->set_activates_default(false); workPathEntry->set_flags(Gtk::CAN_FOCUS); workPathEntry->set_visibility(true); workPathEntry->set_editable(false); workPathEntry->set_max_length(0); workPathEntry->set_text(""); workPathEntry->set_has_frame(true); workPathEntry->set_activates_default(false); Gtk::Button* pathButton = Gtk::manage(new class Gtk::Button("Change Path")); Gtk::Button* workPathButton = Gtk::manage(new class Gtk::Button("Change Path")); pathHbox->pack_start(*outputPathEntry); pathHbox->pack_start(*pathButton, Gtk::PACK_SHRINK, 0); workPathHbox->pack_start(*workPathEntry); workPathHbox->pack_start(*workPathButton, Gtk::PACK_SHRINK, 0); leechModeCheckbutton->set_flags(Gtk::CAN_FOCUS); leechModeCheckbutton->set_relief(Gtk::RELIEF_NORMAL); leechModeCheckbutton->set_mode(true); leechModeCheckbutton->set_active(false); settingsTable->set_border_width(10); settingsTable->set_row_spacings(20); settingsTable->set_col_spacings(5); // left rigth top bottom /* table1->attach(*label1, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*label2, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*label3, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*label4, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry1, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry2, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry3, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry4, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); */ settingsTable->attach(*workLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*outputLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*portRangeLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*leechModeLabel, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*workPathHbox, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*pathHbox, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*portTable, 1, 2, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0); settingsTable->attach(*leechModeCheckbutton, 1, 2, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0); preferencesVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0); set_title( GPD->sGUI_CLIENT() + " " + GPD->sFULLVERSION() + " / Preferences" ); set_modal(true); property_window_position().set_value(Gtk::WIN_POS_CENTER); set_resizable(true); property_destroy_with_parent().set_value(false); set_has_separator(true); get_vbox()->pack_start(*preferencesVbox); set_default_size(300, 200); outputLabel->show(); workLabel->show(); portRangeLabel->show(); leechModeLabel->show(); outputPathEntry->show(); pathButton->show(); pathHbox->show(); workPathEntry->show(); workPathButton->show(); workPathHbox->show(); leechModeCheckbutton->show(); settingsTable->show(); preferencesVbox->show(); // Create buttons and connect their signals. add_button("Save", 1); add_button("Cancel", 2); signal_response().connect(sigc::mem_fun(*this, &preferencesDialog::on_dialog_button_pressed)); pathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_path_select_button_pressed)); workPathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_work_path_select_button_pressed)); get_vbox()->show(); }
CreadorNivel::CreadorNivel(int idProximoNivel, InformableSeleccion* informable) { this->idProximoNivel = idProximoNivel; this->informable = informable; // Widgets sin funcionalidad Gtk::Label* etiquetaTamanio = manage(new Gtk::Label( "Seleccione el tamaño que tendra el escenario: ")); Gtk::Label* etiquetaDuracion = manage(new Gtk::Label( "Seleccione la duración del nivel (en segundos): ")); Gtk::Label* etiquetaImagen = manage(new Gtk::Label( "Seleccione la imagen de fondo del nivel: ")); Gtk::Label* etiquetaImagenSuelo = manage(new Gtk::Label( "Seleccione la imagen del suelo del nivel: ")); // Widgets con funcionalidad selectorTamanio.append_text("Chico"); selectorTamanio.append_text("Mediano"); selectorTamanio.append_text("Grande"); selectorTamanio.set_active_text("Mediano"); ajuste = new Gtk::Adjustment(1.0, 15.0, MAXIMA_DURACION_NIVEL); selectorDuracion = new Gtk::SpinButton(*ajuste); selectorDuracion->set_editable(false); archivoImagenFondo = new Gtk::Entry(); archivoImagenSuelo = new Gtk::Entry(); archivoImagenFondo->set_editable(false); archivoImagenSuelo->set_editable(false); botonExaminarFondo = new Gtk::Button("Examinar..."); botonExaminarSuelo = new Gtk::Button("Examinar..."); // Contenedores Gtk::HBox* cajaHorizontalUno = manage(new Gtk::HBox(false, 20)); cajaHorizontalUno->pack_start(*etiquetaTamanio); cajaHorizontalUno->pack_start(selectorTamanio); Gtk::HBox* cajaHorizontalDos = manage(new Gtk::HBox(false, 20)); cajaHorizontalDos->pack_start(*etiquetaDuracion); cajaHorizontalDos->pack_start(*selectorDuracion); Gtk::HBox* cajaHorizontalTres = manage(new Gtk::HBox(false, 20)); cajaHorizontalTres->pack_start(*etiquetaImagen); cajaHorizontalTres->pack_start(*botonExaminarFondo); Gtk::HBox* cajaHorizontalCuatro = manage(new Gtk::HBox(false, 20)); cajaHorizontalCuatro->pack_start(*etiquetaImagenSuelo); cajaHorizontalCuatro->pack_start(*botonExaminarSuelo); Gtk::VBox* cajaVerticalAuxiliar = manage(new Gtk::VBox(false, 20)); cajaVerticalAuxiliar->pack_start(*cajaHorizontalTres); cajaVerticalAuxiliar->pack_start(*archivoImagenFondo); Gtk::VBox* cajaVerticalAuxiliarDos = manage(new Gtk::VBox(false, 20)); cajaVerticalAuxiliarDos->pack_start(*cajaHorizontalCuatro); cajaVerticalAuxiliarDos->pack_start(*archivoImagenSuelo); Gtk::VBox* cajaVertical = manage(new Gtk::VBox(false, 30)); cajaVertical->pack_start(*cajaHorizontalUno); cajaVertical->pack_start(*cajaHorizontalDos); cajaVertical->pack_start(*cajaVerticalAuxiliar); cajaVertical->pack_start(*cajaVerticalAuxiliarDos); add(*cajaVertical); // Seniales botonExaminarFondo->signal_clicked().connect(sigc::mem_fun(*this, &CreadorNivel::botonExaminarClickeado)); botonExaminarSuelo->signal_clicked().connect(sigc::mem_fun(*this, &CreadorNivel::botonExaminarClickeadoSuelo)); }
void RSphericalParticles::initGTK() { _optList.reset(new Gtk::VBox);//The Vbox of options _colorMap.reset(new magnet::gtk::ColorMapSelector); _singleColorMode.reset(new Gtk::RadioButton("Single Color")); _colorByIDMode.reset(new Gtk::RadioButton("Color by ID")); _RFixed.reset(new Gtk::SpinButton); _GFixed.reset(new Gtk::SpinButton); _BFixed.reset(new Gtk::SpinButton); _AFixed.reset(new Gtk::SpinButton); { _optList->add(*_colorMap); _colorMap->show(); //Horizontal seperator Gtk::HSeparator* line = manage(new Gtk::HSeparator); line->show(); _optList->add(*line); } {//Single color and RGBA boxes Gtk::HBox* box = manage(new Gtk::HBox); box->pack_start(*_singleColorMode, true, true);_singleColorMode->show(); if (_mode == SINGLE_COLOR) _singleColorMode->set_active(); Gtk::Label* label = manage(new Gtk::Label("RGBA")); box->pack_start(*label, false, false); label->show(); _RFixed->set_increments(1.0, 1.0); _RFixed->set_range(0.0, 255.0); _RFixed->set_value(_colorFixed.s[0]); _GFixed->set_increments(1.0, 1.0); _GFixed->set_range(0.0, 255.0); _GFixed->set_value(_colorFixed.s[1]); _BFixed->set_increments(1.0, 1.0); _BFixed->set_range(0.0, 255.0); _BFixed->set_value(_colorFixed.s[2]); _AFixed->set_increments(1.0, 1.0); _AFixed->set_range(0.0, 255.0); _AFixed->set_value(_colorFixed.s[3]); box->pack_start(*_RFixed, false, false); _RFixed->show(); box->pack_start(*_GFixed, false, false); _GFixed->show(); box->pack_start(*_BFixed, false, false); _BFixed->show(); box->pack_start(*_AFixed, false, false); _AFixed->show(); _optList->add(*box); box->show(); //Horizontal seperator Gtk::HSeparator* line = manage(new Gtk::HSeparator); line->show(); _optList->add(*line); } Gtk::RadioButton::Group group = _singleColorMode->get_group(); {//Color by ID _colorByIDMode->set_group(group); _colorByIDMode->show(); if (_mode == COLOR_BY_ID) _colorByIDMode->set_active(); _optList->add(*_colorByIDMode); //Horizontal seperator Gtk::HSeparator* line = manage(new Gtk::HSeparator); line->show(); _optList->add(*line); } _optList->show(); _singleColorMode->signal_toggled() .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate)); _colorMap->signal_changed() .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate)); _RFixed->signal_value_changed() .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate)); _GFixed->signal_value_changed() .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate)); _BFixed->signal_value_changed() .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate)); _AFixed->signal_value_changed() .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate)); _colorByIDMode->signal_toggled() .connect(sigc::mem_fun(*this, &RSphericalParticles::guiUpdate)); guiUpdate(); }
void FindAndReplaceShader::populateWindow() { Gtk::VBox* dialogVBox = Gtk::manage(new Gtk::VBox(false, 6)); add(*dialogVBox); Gtk::HBox* findHBox = Gtk::manage(new Gtk::HBox(false, 0)); Gtk::HBox* replaceHBox = Gtk::manage(new Gtk::HBox(false, 0)); // Pack these hboxes into an alignment so that they are indented Gtk::Alignment* alignment = Gtk::manage(new gtkutil::LeftAlignment(*findHBox, 18, 1.0f)); Gtk::Alignment* alignment2 = Gtk::manage(new gtkutil::LeftAlignment(*replaceHBox, 18, 1.0f)); dialogVBox->pack_start(*alignment, true, true, 0); dialogVBox->pack_start(*alignment2, true, true, 0); // Create the labels and pack them in the hbox Gtk::Label* findLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_(LABEL_FIND))); Gtk::Label* replaceLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_(LABEL_REPLACE))); findLabel->set_size_request(60, -1); replaceLabel->set_size_request(60, -1); findHBox->pack_start(*findLabel, false, false, 0); replaceHBox->pack_start(*replaceLabel, false, false, 0); _findEntry = Gtk::manage(new Gtk::Entry); _replaceEntry = Gtk::manage(new Gtk::Entry); _findEntry->signal_changed().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onFindChanged)); _replaceEntry->signal_changed().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onReplaceChanged)); findHBox->pack_start(*_findEntry, true, true, 6); replaceHBox->pack_start(*_replaceEntry, true, true, 6); // Create the icon buttons to open the ShaderChooser and override the size request _findSelectButton = Gtk::manage( new gtkutil::IconTextButton("", GlobalUIManager().getLocalPixbuf(FOLDER_ICON)) ); _findSelectButton->set_size_request(-1, -1); _findSelectButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onChooseFind)); _replaceSelectButton = Gtk::manage( new gtkutil::IconTextButton("", GlobalUIManager().getLocalPixbuf(FOLDER_ICON)) ); _replaceSelectButton->set_size_request(-1, -1); _replaceSelectButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onChooseReplace)); findHBox->pack_start(*_findSelectButton, false, false, 0); replaceHBox->pack_start(*_replaceSelectButton, false, false, 0); Gtk::Alignment* spacer = Gtk::manage(new Gtk::Alignment(0,0,0,0)); spacer->set_size_request(10, 2); dialogVBox->pack_start(*spacer, false, false, 0); // The checkbox for "search selected only" _selectedOnly = Gtk::manage(new Gtk::CheckButton(_(LABEL_SELECTED_ONLY), true)); Gtk::Alignment* alignment3 = Gtk::manage(new gtkutil::LeftAlignment(*_selectedOnly, 18, 1.0f)); dialogVBox->pack_start(*alignment3, false, false, 0); // Finally, add the buttons dialogVBox->pack_start(createButtons(), false, false, 0); }
Simple::Simple(): m_rotate_object(0), m_zoom_object(0) { m_rect = Papyrus::Rectangle::create( ); m_drawables[0] = m_rect; m_circle = Papyrus::Circle::create( ); m_drawables[1] = m_circle; m_text = Papyrus::Text::create( ); m_drawables[2] = m_text; m_lines = Papyrus::Polyline::create( ); m_drawables[3] = m_lines; m_polygon = Papyrus::Polygon::create( ); m_drawables[4] = m_polygon; m_png = Papyrus::Image::create( ); m_drawables[5] = m_png; m_drawables[6] = m_viewport.canvas(); set_title("Papyrus Group Transformation Demo"); m_vbox.set_border_width(12); m_frame.set_shadow_type(Gtk::SHADOW_IN); m_slider.set_range(0, ROTATE_MAX); m_slider.set_increments(M_PI/8.0, M_PI/8.0); m_zoom.set_range(0.1, 4.0); m_zoom.set_increments(0.25, 0.25); m_zoom.set_value(1.0); m_viewport.set_size_request(INITIAL_SIZE, INITIAL_SIZE); adjust_canvas(INITIAL_SIZE, INITIAL_SIZE); // This is the method that demonstrates the Papyrus objects draw_scene(); m_frame.add(m_viewport); m_vbox.pack_start(m_frame); m_slider.set_draw_value(false); m_slider.signal_value_changed().connect(sigc::mem_fun(*this, &Simple::slider_changed)); m_vbox.pack_start(*Gtk::manage(new Gtk::Label("Rotate")), Gtk::PACK_SHRINK); m_vbox.pack_start(m_slider, Gtk::PACK_SHRINK); m_animate.set_label("Animate Rotation"); m_animate.signal_toggled().connect(sigc::mem_fun(*this, &Simple::animate_toggled)); m_vbox.pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK); m_vbox.pack_start(m_animate, Gtk::PACK_SHRINK); m_zoom.signal_value_changed().connect(sigc::mem_fun(*this, &Simple::zoom_changed)); m_vbox.pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK); m_vbox.pack_start(*Gtk::manage(new Gtk::Label("Zoom")), Gtk::PACK_SHRINK); m_vbox.pack_start(m_zoom, Gtk::PACK_SHRINK); m_vbox.pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK); Gtk::RadioButtonGroup button_group1, button_group2; Gtk::RadioButton* radio_button; Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox()); m_vbox.pack_start(*hbox); Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox()); hbox->pack_start(*vbox); vbox->pack_start(*Gtk::manage(new Gtk::Label("Rotation Object"))); radio_button = Gtk::manage(new Gtk::RadioButton(button_group1, "Rectangle")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_rotate_object_changed), 0)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group1, "Circle")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_rotate_object_changed), 1)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group1, "Text")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_rotate_object_changed), 2)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group1, "Lines")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_rotate_object_changed), 3)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group1, "Polygon")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_rotate_object_changed), 4)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group1, "Image")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_rotate_object_changed), 5)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group1, "Canvas")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_rotate_object_changed), 6)); vbox->pack_start(*radio_button); vbox = Gtk::manage(new Gtk::VBox()); hbox->pack_start(*vbox); vbox->pack_start(*Gtk::manage(new Gtk::Label("Zoom Object"))); radio_button = Gtk::manage(new Gtk::RadioButton(button_group2, "Rectangle")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_zoom_object_changed), 0)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group2, "Circle")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_zoom_object_changed), 1)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group2, "Text")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_zoom_object_changed), 2)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group2, "Lines")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_zoom_object_changed), 3)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group2, "Polygon")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_zoom_object_changed), 4)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group2, "Image")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_zoom_object_changed), 5)); vbox->pack_start(*radio_button); radio_button = Gtk::manage(new Gtk::RadioButton(button_group2, "Canvas")); radio_button->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Simple::on_zoom_object_changed), 6)); vbox->pack_start(*radio_button); signal_size_allocate().connect(sigc::mem_fun(*this, &Simple::on_sig_size_allocate)); add(m_vbox); m_vbox.show_all(); show(); }
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(); }
HIGMessageDialog::HIGMessageDialog(Gtk::Window *parent, GtkDialogFlags flags, Gtk::MessageType msg_type, Gtk::ButtonsType btn_type, const Glib::ustring & header, const Glib::ustring & msg) : Gtk::Dialog() , m_extra_widget(NULL) { set_border_width(5); set_resizable(false); set_title(""); get_vbox()->set_spacing(12); get_action_area()->set_layout(Gtk::BUTTONBOX_END); m_accel_group = Glib::RefPtr<Gtk::AccelGroup>(Gtk::AccelGroup::create()); add_accel_group(m_accel_group); Gtk::HBox *hbox = manage(new Gtk::HBox (false, 12)); hbox->set_border_width(5); hbox->show(); get_vbox()->pack_start(*hbox, false, false, 0); switch (msg_type) { case Gtk::MESSAGE_ERROR: m_image = new Gtk::Image (Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_DIALOG); break; case Gtk::MESSAGE_QUESTION: m_image = new Gtk::Image (Gtk::Stock::DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG); break; case Gtk::MESSAGE_INFO: m_image = new Gtk::Image (Gtk::Stock::DIALOG_INFO, Gtk::ICON_SIZE_DIALOG); break; case Gtk::MESSAGE_WARNING: m_image = new Gtk::Image (Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG); break; default: m_image = new Gtk::Image (); break; } if (m_image) { Gtk::manage(m_image); m_image->show(); m_image->property_yalign().set_value(0); hbox->pack_start(*m_image, false, false, 0); } Gtk::VBox *label_vbox = manage(new Gtk::VBox (false, 0)); label_vbox->show(); hbox->pack_start(*label_vbox, true, true, 0); std::string title = str(boost::format("<span weight='bold' size='larger'>%1%" "</span>\n") % header.c_str()); Gtk::Label *label; label = manage(new Gtk::Label (title)); label->set_use_markup(true); label->set_justify(Gtk::JUSTIFY_LEFT); label->set_line_wrap(true); label->set_alignment (0.0f, 0.5f); label->show(); label_vbox->pack_start(*label, false, false, 0); label = manage(new Gtk::Label(msg)); label->set_use_markup(true); label->set_justify(Gtk::JUSTIFY_LEFT); label->set_line_wrap(true); label->set_alignment (0.0f, 0.5f); label->show(); label_vbox->pack_start(*label, false, false, 0); m_extra_widget_vbox = manage(new Gtk::VBox (false, 0)); m_extra_widget_vbox->show(); label_vbox->pack_start(*m_extra_widget_vbox, true, true, 12); switch (btn_type) { case Gtk::BUTTONS_NONE: break; case Gtk::BUTTONS_OK: add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true); break; case Gtk::BUTTONS_CLOSE: add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE, true); break; case Gtk::BUTTONS_CANCEL: add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, true); break; case Gtk::BUTTONS_YES_NO: add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO, false); add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES, true); break; case Gtk::BUTTONS_OK_CANCEL: add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, false); add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true); break; } if (parent){ set_transient_for(*parent); } if ((flags & GTK_DIALOG_MODAL) != 0) { set_modal(true); } if ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) != 0) { property_destroy_with_parent().set_value(true); } }
/** \brief Creates a new preference dialog for extension preferences \param name Name of the Extension whose dialog this is \param help The help string for the extension (NULL if none) \param controls The extension specific widgets in the dialog This function initializes the dialog with the name of the extension in the title. It adds a few buttons and sets up handlers for them. It also places the passed-in widgets into the dialog. */ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, Effect * effect) : #if WITH_GTKMM_3_0 Gtk::Dialog::Dialog(_(name.c_str()), true), #else Gtk::Dialog::Dialog(_(name.c_str()), true, true), #endif _help(help), _name(name), _button_ok(NULL), _button_cancel(NULL), _button_preview(NULL), _param_preview(NULL), _effect(effect), _exEnv(NULL) { Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); if (controls == NULL) { if (_effect == NULL) { std::cout << "AH!!! No controls and no effect!!!" << std::endl; return; } controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL); _signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change)); } hbox->pack_start(*controls, true, true, 6); hbox->show(); this->get_vbox()->pack_start(*hbox, true, true, 6); /* Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP); if (_help == NULL) help_button->set_sensitive(false); */ _button_cancel = add_button(_effect == NULL ? Gtk::Stock::CANCEL : Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL); _button_cancel->set_use_stock(true); _button_ok = add_button(_effect == NULL ? Gtk::Stock::OK : Gtk::Stock::APPLY, Gtk::RESPONSE_OK); _button_ok->set_use_stock(true); set_default_response(Gtk::RESPONSE_OK); _button_ok->grab_focus(); if (_effect != NULL && !_effect->no_live_preview) { if (_param_preview == NULL) { XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), NULL); _param_preview = Parameter::make(doc->root(), _effect); } Gtk::HSeparator * sep = Gtk::manage(new Gtk::HSeparator()); sep->show(); this->get_vbox()->pack_start(*sep, true, true, 4); hbox = Gtk::manage(new Gtk::HBox()); _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); _button_preview->show(); hbox->pack_start(*_button_preview, true, true,6); hbox->show(); this->get_vbox()->pack_start(*hbox, true, true, 6); Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview); if (hbox != NULL) { #if WITH_GTKMM_3_0 _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->get_children().front()); #else _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->children().back().get_widget()); #endif } preview_toggle(); _signal_preview.connect(sigc::mem_fun(this, &PrefDialog::preview_toggle)); } // Set window modality for effects that don't use live preview if (_effect != NULL && _effect->no_live_preview) { set_modal(false); } GtkWidget *dlg = GTK_WIDGET(gobj()); sp_transientize(dlg); return; }
void uiFileDetailsTreeView::show_file_details(const Gtk::TreeModel::iterator& iter) { Gtk::TreeModel::Row row = *iter; sqlite3_stmt *stmt = 0; const char query[] = "SELECT header FROM files WHERE animalID=? AND cellID=? AND fileID=?"; sqlite3_prepare_v2(*db, query, strlen(query), &stmt, NULL); sqlite3_bind_text(stmt, 1, row.get_value(m_Columns.m_col_animalID).c_str(), -1, SQLITE_TRANSIENT); sqlite3_bind_int(stmt, 2, row.get_value(m_Columns.m_col_cellID)); sqlite3_bind_int(stmt, 3, row.get_value(m_Columns.m_col_filenum)); int r = sqlite3_step(stmt); if (r == SQLITE_ROW) { SpikeData sd; void *header = (void*)sqlite3_column_blob(stmt, 0); sd.setHeader(header); Gtk::Dialog dialog("File Details", true); dialog.set_transient_for(*m_parent); dialog.set_resizable(false); dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); Gtk::HBox hbTime; Gtk::Label lblTimeName("Recording Time: "); Gtk::Label lblTime(sd.iso8601(sd.m_head.cDateTime)); hbTime.pack_start(lblTimeName); hbTime.pack_start(lblTime); dialog.get_vbox()->pack_start(hbTime); Gtk::CheckButton cbHidden("Hide file in file list"); cbHidden.set_active(row.get_value(m_Columns.m_col_hidden)); dialog.get_vbox()->pack_start(cbHidden); sqlite3_stmt *stmt2 = 0; const char query2[] = "SELECT tag FROM tags WHERE animalID=? AND cellID=? AND fileID=?"; sqlite3_prepare_v2(*db, query2, -1, &stmt2, 0); sqlite3_bind_text(stmt2, 1, row.get_value(m_Columns.m_col_animalID).c_str(), -1, SQLITE_TRANSIENT); sqlite3_bind_int(stmt2, 2, row.get_value(m_Columns.m_col_cellID)); sqlite3_bind_int(stmt2, 3, row.get_value(m_Columns.m_col_filenum)); std::vector<Glib::ustring> tags; while (sqlite3_step(stmt2) == SQLITE_ROW) { Glib::ustring t = (char*)sqlite3_column_text(stmt2, 0); tags.push_back(t); } sqlite3_finalize(stmt2); Gtk::Frame frameTags("File Tags"); uiTags tagsFile(m_parent); tagsFile.tags(tags); tagsFile.delete_assist = true; frameTags.add(tagsFile); dialog.get_vbox()->pack_start(frameTags); tagsFile.signal_deleted().connect(sigc::mem_fun(*this, &uiFileDetailsTreeView::on_tag_deleted)); tagsFile.signal_added().connect(sigc::mem_fun(*this, &uiFileDetailsTreeView::on_tag_added)); dialog.show_all_children(); int result = dialog.run(); switch (result) { case (Gtk::RESPONSE_OK): if (row.get_value(m_Columns.m_col_hidden) != cbHidden.get_active()) m_signal_file_set_hidden.emit(cbHidden.get_active()); break; } } else { Gtk::MessageDialog dialog(*m_parent, "Error loading file from database.", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK); dialog.set_secondary_text(sqlite3_errmsg(*db)); dialog.run(); } sqlite3_finalize(stmt); }