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(); }
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)); } }
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(); }