DamageWindow::DamageWindow( Glib::ustring title, Gtk::Window& parent ) : Gtk::Dialog( title, parent, true, true ), f_value(0) { Gtk::Label* label = new Gtk::Label(" ", Gtk::ALIGN_LEFT); label->set_justify( Gtk::JUSTIFY_LEFT ); f_table.AddItem( Name, gettext("Character Name"), false, label, NULL ); // label = new Gtk::Label(" ", Gtk::ALIGN_LEFT); label->set_justify( Gtk::JUSTIFY_LEFT ); label->set_use_markup( true ); f_table.AddItem( HitPoints, gettext("Current Hit Points"), false, label, NULL ); // label = new Gtk::Label(" ", Gtk::ALIGN_LEFT); label->set_justify( Gtk::JUSTIFY_LEFT ); label->set_use_markup( true ); f_table.AddItem( TempHP, gettext("Temporary Hit Points"), false, label, NULL ); // Gtk::Adjustment* adj = Gtk::manage( new Gtk::Adjustment(0.0, 0.0, 10000.0) ); f_spinButton = new Gtk::SpinButton; f_spinButton->configure( *adj, 0.0, 0 ); f_spinButton->set_numeric( true ); f_table.AddItem( DamageHealth, gettext("Enter new damage/health"), false, f_spinButton, NULL ); // Pack children into a vbox and add buttons // Gtk::VBox* vbox = get_vbox(); vbox->pack_start( f_table ); // // Respect system-dependent alternative button order (defined // in gtk+ theme). // const bool alternative_order = alternative_button_order( Glib::RefPtr<const Gdk::Screen>(0) ); // if( !alternative_order ) { add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); } // add_button( gettext("Bring to _Full"), RESPONSE_FULLHEATH ); add_button( gettext("Add _Health"), RESPONSE_HEALTH ); add_button( gettext("Add _Damage"), Gtk::RESPONSE_OK ); // if( alternative_order ) { add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); } // Dialog stuff // set_default_response( Gtk::RESPONSE_OK ); activate_default(); show_all_children(); }
/** \brief Create a label for the description */ Gtk::Widget * ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/) { if (_gui_hidden) { return NULL; } Glib::ustring newguitext; if (_context != NULL) { newguitext = g_dpgettext2(NULL, _context, _value); } else { newguitext = _(_value); } Gtk::Label * label; int padding = 12 + _indent; if (_mode == HEADER) { label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") +newguitext + Glib::ustring("</b>"), Gtk::ALIGN_START)); label->set_padding(0,5); label->set_use_markup(true); padding = _indent; } else { label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START)); } label->set_line_wrap(); label->show(); Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); hbox->pack_start(*label, true, true, padding); hbox->show(); return hbox; }
Gui_OptionSetterBaseClass::Gui_OptionSetterBaseClass(Gui_ProcessorHandler& processor_hand, const std::string name): Gtk::Frame(name), m_processor_hand(processor_hand), m_opts(m_processor_hand.getOptions()) { this->add(m_vbox); this->set_border_width(3); Gtk::Label* l; l = (Gtk::Label*) this->get_label_widget(); l->set_use_markup(); m_signal_change_options.connect(sigc::mem_fun(*this,&Gui_OptionSetterBaseClass::setOption)); set_has_tooltip(); }
/* === M E T H O D S ======================================================= */ void Widget_ColorEdit::SliderRow(int i,ColorSlider * n, char * l, Pango::AttrList & attr_list, Gtk::Table* table) { Gtk::Label *label; n->signal_slider_moved().connect(sigc::mem_fun(*this,&studio::Widget_ColorEdit::on_slider_moved)); //n->signal_activated().connect(sigc::mem_fun(*this,&studio::Widget_ColorEdit::activated)); n->signal_activated().connect(sigc::mem_fun(*this,&studio::Widget_ColorEdit::on_value_changed)); label=manage(new class Gtk::Label(l,0.0,0.5)); label->set_use_markup(false); label->set_use_underline(false); label->set_attributes(attr_list); table->attach(*label, 0, 1, 1+2*i, 2+2*i, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); table->attach(*n, 0, 1, 2+2*i, 3+2*i, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); }
void DimRegionEdit::addHeader(const char* text) { if (firstRowInBlock < rowno - 1) { Gtk::Label* filler = new Gtk::Label(" "); table[pageno]->attach(*filler, 0, 1, firstRowInBlock, rowno, Gtk::FILL, Gtk::SHRINK); } Glib::ustring str = "<b>"; str += text; str += "</b>"; Gtk::Label* label = new Gtk::Label(str); label->set_use_markup(); label->set_alignment(Gtk::ALIGN_LEFT); table[pageno]->attach(*label, 0, 3, rowno, rowno + 1, Gtk::FILL, Gtk::SHRINK); rowno++; firstRowInBlock = rowno; }
void PropertiesWindow::add_property(const Raul::URI& uri, const Atom& value) { World* world = _app->world(); const unsigned n_rows = _table->property_n_rows() + 1; _table->property_n_rows() = n_rows; // Column 0: Property LilvNode* prop = lilv_new_uri(world->lilv_world(), uri.c_str()); Glib::ustring lab_text = RDFS::label(world, prop); if (lab_text.empty()) { lab_text = world->rdf_world()->prefixes().qualify(uri); } lab_text = Glib::ustring("<a href=\"") + uri + "\">" + lab_text + "</a>"; Gtk::Label* lab = manage(new Gtk::Label(lab_text, 1.0, 0.5)); lab->set_use_markup(true); _table->attach(*lab, 0, 1, n_rows, n_rows + 1, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK); lilv_node_free(prop); // Column 1: Value Gtk::Alignment* align = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0)); Gtk::CheckButton* present = manage(new Gtk::CheckButton()); Gtk::Widget* val_widget = create_value_widget(uri, value); present->set_active(true); if (val_widget) { align->add(*val_widget); } _table->attach(*align, 1, 2, n_rows, n_rows + 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); _table->attach(*present, 2, 3, n_rows, n_rows + 1, Gtk::FILL, Gtk::SHRINK); _records.insert(make_pair(uri, Record(value, align, n_rows, present))); }
limitDialog::limitDialog(const char * _szUploadLabel, const char * _szDownloadLabel, const char * _szParam3Label, const char * _szParam4Label) : Gtk::Dialog(GPD->sGUI_CLIENT() + " " + GPD->sFULLVERSION() + " / Limit", true /* modal */, true /* use_separator aka set_has_separator() */ ), limit_interval(5), limit_selected(false), selected_upload_disable(false), selected_download_disable(false), selected_param3_disable(false), selected_param4_disable(false), uploadCombo(0), downloadCombo(0), param3Spin(0), param4Spin(0), selected_upload_limit(-1), selected_download_limit(-1) { Gtk::Label *uploadLabel = Gtk::manage(new class Gtk::Label( _szUploadLabel ? _szUploadLabel : "Upload" )); Gtk::Label *downloadLabel = Gtk::manage(new class Gtk::Label( _szDownloadLabel ? _szDownloadLabel : "Download" )); uploadCombo = Gtk::manage(new class Gtk::ComboBoxText()); downloadCombo = Gtk::manage(new class Gtk::ComboBoxText()); Gtk::Label *seedPercentLabel = Gtk::manage(new class Gtk::Label( _szParam3Label ? _szParam3Label : "Seed %" )); Gtk::Label *seedTimeLabel = Gtk::manage(new class Gtk::Label( _szParam4Label ? _szParam4Label : "Seed Time" )); Gtk::Adjustment *seedPercentAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10)); param3Spin = Gtk::manage(new class Gtk::SpinButton(*seedPercentAdjustment, 1, 0)); Gtk::Adjustment *seedTimeAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10)); param4Spin = Gtk::manage(new class Gtk::SpinButton(*seedTimeAdjustment, 1, 0)); Gtk::Table *settingsTable = Gtk::manage(new class Gtk::Table(4, 2, false)); Gtk::VBox *limitVbox = Gtk::manage(new class Gtk::VBox(false, 10)); uploadLabel->set_alignment(0,0.5); uploadLabel->set_padding(5,0); uploadLabel->set_justify(Gtk::JUSTIFY_LEFT); uploadLabel->set_line_wrap(false); uploadLabel->set_use_markup(false); uploadLabel->set_selectable(false); downloadLabel->set_alignment(0,0.5); downloadLabel->set_padding(5,0); downloadLabel->set_justify(Gtk::JUSTIFY_LEFT); downloadLabel->set_line_wrap(false); downloadLabel->set_use_markup(false); downloadLabel->set_selectable(false); seedPercentLabel->set_alignment(0,0.5); seedPercentLabel->set_padding(5,0); seedPercentLabel->set_justify(Gtk::JUSTIFY_LEFT); seedPercentLabel->set_line_wrap(false); seedPercentLabel->set_use_markup(false); seedPercentLabel->set_selectable(false); seedTimeLabel->set_alignment(0,0.5); seedTimeLabel->set_padding(5,0); seedTimeLabel->set_justify(Gtk::JUSTIFY_LEFT); seedTimeLabel->set_line_wrap(false); seedTimeLabel->set_use_markup(false); seedTimeLabel->set_selectable(false); param3Spin->set_flags(Gtk::CAN_FOCUS); param3Spin->set_update_policy(Gtk::UPDATE_ALWAYS); param3Spin->set_numeric(false); param3Spin->set_digits(0); param3Spin->set_wrap(false); param3Spin->set_range(0, MaxParam3Value); param4Spin->set_flags(Gtk::CAN_FOCUS); param4Spin->set_update_policy(Gtk::UPDATE_ALWAYS); param4Spin->set_numeric(false); param4Spin->set_digits(0); param4Spin->set_wrap(false); param4Spin->set_range(0, MaxParam4Value); uploadCombo->append_text("disable"); downloadCombo->append_text("disable"); for (t_int i=limit_interval; i<=200; i+=limit_interval) { using namespace btg::core; std::string s = convertToString<int>(i) + " KiB/sec"; uploadCombo->append_text(s); downloadCombo->append_text(s); } uploadCombo->set_active(0); downloadCombo->set_active(0); settingsTable->set_border_width(10); settingsTable->set_row_spacings(20); settingsTable->set_col_spacings(5); /* */ settingsTable->attach(*uploadLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*downloadLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*seedPercentLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*seedTimeLabel, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*param3Spin, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*param4Spin, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*uploadCombo, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*downloadCombo, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); limitVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0); property_window_position().set_value(Gtk::WIN_POS_CENTER); set_resizable(true); property_destroy_with_parent().set_value(false); get_vbox()->pack_start(*limitVbox); set_default_size(300, 200); // Create buttons and connect their signals. add_button("Set", 1); add_button("Cancel", 2); signal_response().connect(sigc::mem_fun(*this, &limitDialog::on_button_pressed)); show_all(); // flag all inner elements as visible hide(); // hide toplevel window }
Example_ScrolledViewport::Example_ScrolledViewport() { Gtk::HBox* hbox; Gtk::VBox* vbox; set_title("ScrolledViewport Example"); Papyrus::Gtk::Viewport& viewport = m_ScrolledViewport.viewport(); m_Zoomer = Papyrus::Zoomer::create( ); viewport.add_controller( m_Zoomer ); viewport.set_size_request( 300, 200 ); // Create some shapes to add to the group Papyrus::Group::pointer g = Papyrus::example_group( ); viewport.canvas()->add( g ); m_Zoomer->add( g ); vbox = Gtk::manage( new Gtk::VBox() ); vbox->pack_start( m_ScrolledViewport ); vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) ); Gtk::RadioButton* rb; Gtk::VBox* vbox2; Gtk::Frame* frame; Gtk::Label* label; label = Gtk::manage( new Gtk::Label("Use the mouse wheel to zoom in and out.\n\nThe scrollbars are set to automatic in this example so you will need to zoom in before they show up.") ); label->set_use_markup(); label->set_line_wrap(); vbox->pack_start(*label, Gtk::PACK_SHRINK, 10); vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) ); vbox2 = Gtk::manage( new Gtk::VBox() ); frame = Gtk::manage( new Gtk::Frame("Viewport Scroll Placement") ); frame->add(*vbox2); vbox->pack_start(*frame, Gtk::PACK_SHRINK, 10); label = Gtk::manage( new Gtk::Label("<i>Placement refers to the corner where the viewport will be placed</i>") ); label->set_use_markup(); label->set_line_wrap(); vbox2->pack_start(*label, Gtk::PACK_SHRINK); Gtk::RadioButtonGroup scroll_placement_group; rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Top Left" ) ); rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_TOP_LEFT) ); vbox2->pack_start( *rb ); rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Bottom Left" ) ); rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_BOTTOM_LEFT) ); vbox2->pack_start( *rb ); rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Top Right" ) ); rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_TOP_RIGHT) ); vbox2->pack_start( *rb ); rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Bottom Right" ) ); rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_BOTTOM_RIGHT) ); vbox2->pack_start( *rb ); this->add( *vbox ); show_all(); }
sessionSelectionDialog::sessionSelectionDialog(std::string const& _title, t_longList const& _sessionIDs, t_strList const& _sessionsNames, bool const _disableSelection) : disableSelection_(_disableSelection), selected(false), session(Command::INVALID_SESSION), cbt(0) { Gtk::Button* cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); Gtk::Button* okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); Gtk::Label* label = Gtk::manage(new class Gtk::Label(_title)); cbt = Gtk::manage(new class Gtk::ComboBoxText()); Gtk::VBox* vbox = Gtk::manage(new class Gtk::VBox(false, 0)); cancelbutton->set_flags(Gtk::CAN_FOCUS); cancelbutton->set_relief(Gtk::RELIEF_NORMAL); okbutton->set_flags(Gtk::CAN_FOCUS); okbutton->set_relief(Gtk::RELIEF_NORMAL); get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); label->set_alignment(0.5,0.5); label->set_padding(0,0); label->set_justify(Gtk::JUSTIFY_LEFT); label->set_line_wrap(false); label->set_use_markup(false); label->set_selectable(false); vbox->pack_start(*label, Gtk::PACK_SHRINK, 0); vbox->pack_start(*cbt); get_vbox()->set_homogeneous(false); get_vbox()->set_spacing(0); get_vbox()->pack_start(*vbox); set_title(_title); set_modal(true); property_window_position().set_value(Gtk::WIN_POS_NONE); set_resizable(true); property_destroy_with_parent().set_value(false); set_has_separator(true); add_action_widget(*cancelbutton, -6); add_action_widget(*okbutton, -5); /// Fill the combobox with session ids. t_strListCI sessionNameIter = _sessionsNames.begin(); for (t_longListCI sessionIter = _sessionIDs.begin(); sessionIter != _sessionIDs.end(); sessionIter++) { std::string session_descr = convertToString<t_long>(*sessionIter); session_descr += " ("; session_descr += *sessionNameIter; session_descr += ")"; cbt->append_text(session_descr); sessionNameIter++; } // Select the first session id. cbt->set_active(0); if (!disableSelection_) { cancelbutton->show(); } okbutton->show(); label->show(); cbt->show(); vbox->show(); show(); // Connect buttons to handlers. okbutton->signal_clicked().connect(sigc::mem_fun(*this, &sessionSelectionDialog::on_ok_clicked)); if (!disableSelection_) { cancelbutton->signal_clicked().connect(sigc::mem_fun(*this, &sessionSelectionDialog::on_cancel_clicked)); } }
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); } }
aboutDialog::aboutDialog() { Gtk::Dialog *ad = this; Gtk::Button *okbutton = Gtk::manage(new class Gtk::Button("ok")); Gtk::Label *aboutLabel = Gtk::manage(new class Gtk::Label( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + ", build " + GPD->sBUILD() )); Gtk::TextView *textview = Gtk::manage(new class Gtk::TextView()); Gtk::ScrolledWindow *scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow()); Gtk::VBox *vbox = Gtk::manage(new class Gtk::VBox(false, 0)); okbutton->set_flags(Gtk::CAN_FOCUS); okbutton->set_relief(Gtk::RELIEF_NORMAL); ad->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); ad->set_default_size(300, 200); aboutLabel->set_alignment(0.5,0.5); aboutLabel->set_padding(0,0); aboutLabel->set_justify(Gtk::JUSTIFY_LEFT); aboutLabel->set_line_wrap(false); aboutLabel->set_use_markup(false); aboutLabel->set_selectable(false); textview->set_flags(Gtk::CAN_FOCUS); textview->set_editable(true); textview->set_cursor_visible(true); textview->set_pixels_above_lines(0); textview->set_pixels_below_lines(0); textview->set_pixels_inside_wrap(0); textview->set_left_margin(0); textview->set_right_margin(0); textview->set_indent(0); textview->set_wrap_mode(Gtk::WRAP_NONE); textview->set_justification(Gtk::JUSTIFY_LEFT); using namespace std; string text; text += "btg Copyright (C) 2005 Michael Wojciechowski."; text += GPD->sNEWLINE(); text += "This program is free software; you can redistribute it and/or modify"; text += GPD->sNEWLINE(); text += "it under the terms of the GNU General Public License as published by "; text += GPD->sNEWLINE(); text += "the Free Software Foundation; either version 2 of the License, or "; text += GPD->sNEWLINE(); text += "(at your option) any later version."; text += GPD->sNEWLINE(); text += "This program is distributed in the hope that it will be useful, "; text += GPD->sNEWLINE(); text += "but WITHOUT ANY WARRANTY; without even the implied warranty of "; text += GPD->sNEWLINE(); text += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "; text += GPD->sNEWLINE(); text += "GNU General Public License for more details."; text += GPD->sNEWLINE(); text += "You should have received a copy of the GNU General Public License "; text += GPD->sNEWLINE(); text += "along with this program; if not, write to the Free Software "; text += GPD->sNEWLINE(); text += "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"; text += GPD->sNEWLINE(); textview->get_buffer()->set_text(text); scrolledwindow->set_flags(Gtk::CAN_FOCUS); scrolledwindow->set_shadow_type(Gtk::SHADOW_IN); scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT); scrolledwindow->add(*textview); vbox->pack_start(*aboutLabel, Gtk::PACK_SHRINK, 0); vbox->pack_start(*scrolledwindow); ad->get_vbox()->set_homogeneous(false); ad->get_vbox()->set_spacing(0); ad->get_vbox()->pack_start(*vbox); //ad->set_title( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() ); ad->set_title( GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + " / About" ); ad->set_modal(true); ad->property_window_position().set_value(Gtk::WIN_POS_CENTER); ad->set_resizable(true); ad->property_destroy_with_parent().set_value(false); ad->set_has_separator(true); ad->add_action_widget(*okbutton, -5); okbutton->show(); aboutLabel->show(); textview->show(); scrolledwindow->show(); vbox->show(); okbutton->signal_clicked().connect(sigc::mem_fun(*this, &aboutDialog::on_ok_clicked)); // ad->show(); }
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(); }