// Main constructor
SkinPropertyEditor::SkinPropertyEditor(Entity* entity,
									   const std::string& name,
									   const std::string& options)
: PropertyEditor(entity),
  _key(name)
{
	// Construct the main widget (will be managed by the base class)
	Gtk::VBox* mainVBox = new Gtk::VBox(false, 6);

	// Register the main widget in the base class
	setMainWidget(mainVBox);

	// Horizontal box contains browse button
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	// Create the browse button
	Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose skin...")));
	browseButton->set_image(*Gtk::manage(new Gtk::Image(
		PropertyEditorFactory::getPixbufFor("skin"))));

	browseButton->signal_clicked().connect(
		sigc::mem_fun(*this, &SkinPropertyEditor::_onBrowseButton));

	hbx->pack_start(*browseButton, true, false, 0);

	// Pack hbox into vbox (to limit vertical size), then edit frame
	Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 0));
	vbx->pack_start(*hbx, true, false, 0);

	mainVBox->pack_start(*vbx, true, true, 0);
}
AIHeadPropertyEditor::AIHeadPropertyEditor(Entity* entity, const std::string& key, const std::string& options) :
	_entity(entity)
{
	_widget = Gtk::manage(new Gtk::HBox(false, 0));
	_widget->set_border_width(6);

	// Horizontal box contains the browse button
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	// Browse button for models
	Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose AI head...")));

	browseButton->set_image(
		*Gtk::manage(new Gtk::Image(GlobalUIManager().getLocalPixbuf("icon_model.png")))
	);
	browseButton->signal_clicked().connect(sigc::mem_fun(*this, &AIHeadPropertyEditor::onChooseButton));

	hbx->pack_start(*browseButton, true, false, 0);

	// Pack hbox into vbox (to limit vertical size), then edit frame
	Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 0));
	vbx->pack_start(*hbx, true, false, 0);
	_widget->pack_start(*vbx, true, true, 0);
}
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);
}
// Construct the buttons
Gtk::Widget& LightTextureChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(true, 6));
	hbx->set_border_width(3);

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &LightTextureChooser::callbackOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &LightTextureChooser::callbackCancel));

	hbx->pack_end(*okButton, true, true, 0);
	hbx->pack_end(*cancelButton, true, true, 0);

	return *Gtk::manage(new gtkutil::RightAlignment(*hbx));
}
Example #5
0
// Construct the buttons
Gtk::Widget& ShaderChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &ShaderChooser::callbackOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &ShaderChooser::callbackCancel));

	hbx->pack_end(*okButton, false, false, 0);
	hbx->pack_end(*cancelButton, false, false, 0);

	return *hbx;
}
// Main constructor
ModelPropertyEditor::ModelPropertyEditor(Entity* entity,
									     const std::string& name,
									     const std::string& options)
: PropertyEditor(entity),
  _key(name)
{
	// Construct the main widget (will be managed by the base class)
	Gtk::VBox* mainVBox = new Gtk::VBox(false, 6);

	// Register the main widget in the base class
	setMainWidget(mainVBox);

	// Horizontal box contains the browse button
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	// Browse button for models
	Gtk::Button* browseButton = Gtk::manage(new Gtk::Button(_("Choose model...")));
	browseButton->set_image(*Gtk::manage(new Gtk::Image(
		PropertyEditorFactory::getPixbufFor("model"))));

	browseButton->signal_clicked().connect(sigc::mem_fun(*this, &ModelPropertyEditor::_onModelButton));

	// Browse button for particles
	Gtk::Button* particleButton = Gtk::manage(new Gtk::Button(_("Choose particle...")));
	particleButton->set_image(*Gtk::manage(new Gtk::Image(
		GlobalUIManager().getLocalPixbuf("particle16.png"))));

	particleButton->signal_clicked().connect(sigc::mem_fun(*this, &ModelPropertyEditor::_onParticleButton));

	hbx->pack_start(*browseButton, true, false, 0);
	hbx->pack_start(*particleButton, true, false, 0);

	// Pack hbox into vbox (to limit vertical size), then edit frame
	Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 0));
	vbx->pack_start(*hbx, true, false, 0);

	mainVBox->pack_start(*vbx, true, true, 0);
}
// Constructor. Create the GTK widgets here
BooleanPropertyEditor::BooleanPropertyEditor(Entity* entity,
											 const std::string& name)
: PropertyEditor(entity),
  _checkBox(NULL),
  _key(name)
{
	// Construct the main widget (will be managed by the base class)
	Gtk::VBox* mainVBox = new Gtk::VBox(false, 6);

	// Register the main widget in the base class
	setMainWidget(mainVBox);

	Gtk::HBox* editBox = Gtk::manage(new Gtk::HBox(false, 3));
	editBox->set_border_width(3);

	// Create the checkbox with correct initial state, and connect up the
	// toggle callback
	_checkBox = Gtk::manage(new Gtk::CheckButton(name));
	_checkBox->set_active(_entity->getKeyValue(_key) == "1");
	_checkBox->signal_toggled().connect(sigc::mem_fun(*this, &BooleanPropertyEditor::_onToggle));

	editBox->pack_start(*_checkBox, true, false, 0);
	mainVBox->pack_start(*editBox, true, true, 0);
}
Example #8
0
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);
}
Example #9
0
    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);
      }
    }