コード例 #1
0
ファイル: scriptAddDlgGtk.cpp プロジェクト: Sebi55/GPC
ScriptAddDlgGtk::ScriptAddDlgGtk()
	: lvScriptPreview(1)
	, lblScriptSelection(gettext("Script to insert:")
	, Gtk::ALIGN_LEFT)
	, lblScriptPreview(gettext("Preview:"), Gtk::ALIGN_LEFT)
{
	this->set_title(gettext("Add script"));
	this->set_icon_name("gpc");
	this->set_default_size(400, 300);
	Gtk::VBox* vbScriptAddDlg = this->get_vbox();
	vbScriptAddDlg->set_spacing(10);
	vbScriptAddDlg->pack_start(hbScriptSelection, Gtk::PACK_SHRINK);
	hbScriptSelection.set_border_width(10);
	hbScriptSelection.pack_start(lblScriptSelection);
	hbScriptSelection.pack_start(cbScriptSelection);
	vbScriptAddDlg->pack_start(vbScriptPreview);
	vbScriptPreview.pack_start(lblScriptPreview, Gtk::PACK_SHRINK);
	vbScriptPreview.pack_start(scrScriptPreview);
	scrScriptPreview.add(lvScriptPreview);
	vbScriptPreview.set_border_width(10);
	scrScriptPreview.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
	scrScriptPreview.set_shadow_type(Gtk::SHADOW_IN);
	lvScriptPreview.set_column_title(0, gettext("Entry"));
	lvScriptPreview.set_headers_visible(false);
	
	this->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	this->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

	this->signal_response().connect(sigc::mem_fun(this, &ScriptAddDlgGtk::signal_scriptAddDlg_response));
	cbScriptSelection.signal_changed().connect(sigc::mem_fun(this, &ScriptAddDlgGtk::signal_script_selection_changed));
}
コード例 #2
0
ファイル: mviewer.cpp プロジェクト: cargabsj175/bombono-dvd
void MakeBoxHIGed(Gtk::VBox& vbox)
{
//     vbox.set_border_width(12);
//     vbox.set_spacing(24);
    vbox.set_border_width(0);
    vbox.set_spacing(WDG_BORDER_WDH);
}
コード例 #3
0
ファイル: lpe-simplify.cpp プロジェクト: AakashDabas/inkscape
Gtk::Widget *
LPESimplify::newWidget()
{
    // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
    Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox(Effect::newWidget()) );
    
    vbox->set_border_width(5);
    vbox->set_homogeneous(false);
    vbox->set_spacing(2);
    std::vector<Parameter *>::iterator it = param_vector.begin();
    Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0));
    while (it != param_vector.end()) {
        if ((*it)->widget_is_visible) {
            Parameter * param = *it;
            Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
            if (param->param_key == "simplify_individual_paths" ||
                    param->param_key == "simplify_just_coalesce") {
                Glib::ustring * tip = param->param_getTooltip();
                if (widg) {
                    buttons->pack_start(*widg, true, true, 2);
                    if (tip) {
                        widg->set_tooltip_text(*tip);
                    } else {
                        widg->set_tooltip_text("");
                        widg->set_has_tooltip(false);
                    }
                }
            } else {
                Glib::ustring * tip = param->param_getTooltip();
                if (widg) {
                    Gtk::HBox * horizontal_box = dynamic_cast<Gtk::HBox *>(widg);
                    std::vector< Gtk::Widget* > child_list = horizontal_box->get_children();
                    Gtk::Entry* entry_widg = dynamic_cast<Gtk::Entry *>(child_list[1]);
                    entry_widg->set_width_chars(8);
                    vbox->pack_start(*widg, true, true, 2);
                    if (tip) {
                        widg->set_tooltip_text(*tip);
                    } else {
                        widg->set_tooltip_text("");
                        widg->set_has_tooltip(false);
                    }
                }
            }
        }

        ++it;
    }
    vbox->pack_start(*buttons,true, true, 2);
    return dynamic_cast<Gtk::Widget *>(vbox);
}
コード例 #4
0
AddUPnPServerDlg::AddUPnPServerDlg(MusicLibrary& library)
: Gtk::Dialog(_("Add UPnP server"), true)
, m_SelectContainerLabel(_("Select a upnp container containing albums"), Gtk::ALIGN_LEFT)
, m_EnterNameLabel(_("Server name: "), Gtk::ALIGN_LEFT)
, m_CustomServerName(false)
, m_Destroy(false)
, m_pLibrary(dynamic_cast<UPnPMusicLibrary*>(&library))
, m_pClient(m_pLibrary ? (&m_pLibrary->getClient()) : new upnp::Client())
, m_DeviceScanner(*m_pClient, upnp::Device::Type::MediaServer)
, m_IOwnControlPoint(m_pLibrary == nullptr)
, m_ContainerDispatcher(*this)
{
    set_title(_("Add UPnP server"));
    set_size_request(400, 400);
    set_resizable(true);
    set_border_width(5);

    m_TreeModel = Gtk::TreeStore::create(m_Columns);
    m_TreeView.set_model(m_TreeModel);

    Gtk::TreeView::Column* pColumn = Gtk::manage(new Gtk::TreeView::Column("Server"));
    pColumn->pack_start(m_Columns.icon, false); //false = don't expand.
    pColumn->pack_start(m_Columns.name);

    m_TreeView.append_column(*pColumn);
    m_TreeView.set_headers_visible(false);

    m_ScrolledWindow.add(m_TreeView);
    m_ScrolledWindow.set_shadow_type(Gtk::SHADOW_IN);
    m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);

    m_NameLayout.set_spacing(5);
    m_NameLayout.pack_start(m_EnterNameLabel, Gtk::PACK_SHRINK);
    m_NameLayout.pack_start(m_ServerNameEntry, Gtk::PACK_EXPAND_WIDGET);

    Gtk::VBox* pVBox = get_vbox();
    pVBox->set_spacing(5);
    pVBox->pack_start(m_SelectContainerLabel, Gtk::PACK_SHRINK);
    pVBox->pack_start(m_ScrolledWindow, Gtk::PACK_EXPAND_WIDGET);
    pVBox->pack_start(m_NameLayout, Gtk::PACK_SHRINK);

    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    add_button(Gtk::Stock::ADD, Gtk::RESPONSE_OK);
    set_response_sensitive (Gtk::RESPONSE_OK, false);

    m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &AddUPnPServerDlg::onCheckAddSensitivity));
    m_ServerNameEntry.signal_changed().connect(sigc::mem_fun(*this, &AddUPnPServerDlg::onCheckAddSensitivity));
    m_ServerNameEntry.signal_key_release_event().connect(sigc::mem_fun(*this, &AddUPnPServerDlg::onCustomServerName));

    show_all_children();

    m_DeviceAddedDispatcher.DispatchedItemEvent.connect(std::bind(&AddUPnPServerDlg::onUPnPDeviceDiscovered, this, _1), this);
    m_DeviceRemovedDispatcher.DispatchedItemEvent.connect(std::bind(&AddUPnPServerDlg::onUPnPDeviceDissapeared, this, _1), this);
    m_DeviceScanner.DeviceDiscoveredEvent.connect([this] (std::shared_ptr<upnp::Device> dev) { m_DeviceAddedDispatcher.onItem(dev); }, this);
    m_DeviceScanner.DeviceDissapearedEvent.connect([this] (std::shared_ptr<upnp::Device> dev) { m_DeviceRemovedDispatcher.onItem(dev); }, this);

    if (m_IOwnControlPoint)
    {
        m_pClient->initialize();
    }

    m_DeviceScanner.start();
    m_DeviceScanner.refresh();
}
コード例 #5
0
bool gui_show_text_entry_dialog(const std::string& title, const std::string& message, const std::string& sec_message,
		std::string& result, const std::string& default_str, Gtk::Window* parent, bool sec_msg_markup)
{
	int response = 0;
	std::string input_str;

	{  // the dialog hides at the end of scope
		Gtk::Dialog dialog(title, true);  // modal

		dialog.set_resizable(false);
		dialog.set_skip_taskbar_hint(true);
		dialog.set_border_width(5);

		if (parent) {
			dialog.set_transient_for(*parent);
			dialog.set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
		} else {
			dialog.set_position(Gtk::WIN_POS_MOUSE);
		}


		Gtk::Label main_label;
		main_label.set_markup("<big><b>" + Glib::Markup::escape_text(message)
				+ (sec_message.empty() ? "\n" : "") + "</b></big>");
		main_label.set_line_wrap(true);
		main_label.set_selectable(true);
		main_label.set_alignment(0.0, 0.0);

		Gtk::Label sec_label;
		if (sec_msg_markup) {
			sec_label.set_markup(sec_message);
		} else {
			sec_label.set_text(sec_message);
		}
		sec_label.set_line_wrap(true);
		sec_label.set_selectable(true);
		sec_label.set_alignment(0.0, 0.0);

		Gtk::Entry input_entry;
		input_entry.set_activates_default(true);


		Gtk::VBox vbox;
		vbox.set_spacing(12);
		vbox.pack_start(main_label, false, false, 0);
		vbox.pack_start(sec_label, true, true, 0);
		vbox.pack_start(input_entry, true, true, 0);
		vbox.show_all();

		dialog.get_action_area()->set_border_width(5);
		dialog.get_action_area()->set_spacing(6);

		dialog.get_vbox()->set_spacing(14);  // as in MessageDialog
		dialog.get_vbox()->pack_start(vbox, false, false, 0);


		dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);

		Gtk::Button ok_button(Gtk::Stock::OK);
		ok_button.set_flags(ok_button.get_flags() | Gtk::CAN_DEFAULT);
		ok_button.show_all();
		dialog.add_action_widget(ok_button, Gtk::RESPONSE_OK);
		ok_button.grab_default();  // make it the default widget

		response = dialog.run();  // blocks until the dialog is closed

		input_str = input_entry.get_text();
	}

	if (response == Gtk::RESPONSE_OK) {
		result = input_str;
		return true;
	}

	return false;
}
コード例 #6
0
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();
}