Changeset 1903
- Timestamp:
- Fri Feb 10 22:21:56 2006
- Files:
-
- trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx (modified) (diff)
- trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h (modified) (diff)
- trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/DialogWindow.h (modified) (diff)
- trunk/livesupport/src/modules/widgets/src/DialogWindow.cxx (modified) (diff)
- trunk/livesupport/src/modules/widgets/src/TestWindow.h (modified) (diff)
- trunk/livesupport/src/modules/widgets/src/TestWindow.cxx (modified) (diff)
- trunk/livesupport/src/modules/widgets/src/WidgetFactory.cxx (modified) (diff)
- trunk/livesupport/src/modules/widgets/src/MessageWindow.h (deleted)
- trunk/livesupport/src/modules/widgets/src/MessageWindow.cxx (deleted)
- trunk/livesupport/src/modules/widgets/etc/Makefile.in (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx
r1896 r1903 455 455 throw () 456 456 { 457 WhiteWindow * window = widgetFactory->createMessageWindow(message); 458 Gtk::Main::run(*window); 457 DialogWindow * window = widgetFactory->createDialogWindow(message, 458 getBundle()); 459 window->run(); 459 460 delete window; 460 461 } -
trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h
r1902 r1903 360 360 361 361 /** 362 * Create a window with a single line of text, and an OK button. 363 * Good for displaying error messages. 362 * Create a DialogWindow. 363 * Good for displaying error messages, confirmation messages, etc. 364 364 * It is the reponsibility of the caller to dispose of the created 365 365 * object properly. 366 366 * 367 * @param message the message to include in the window. 367 * @param message the message to include in the window. 368 * @param bundle localization for the button(s). 369 * @param buttons a list of buttons; default is a single OK button. 370 * @return the DialogWindow object. 368 371 */ 369 WhiteWindow * 370 createMessageWindow(Ptr<Glib::ustring>::Ref message) throw (); 372 DialogWindow * 373 createDialogWindow(Ptr<Glib::ustring>::Ref message, 374 Ptr<ResourceBundle>::Ref bundle, 375 int buttons = DialogWindow::okButton) 376 throw (); 371 377 }; 372 378 -
trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/DialogWindow.h
r1902 r1903 49 49 50 50 #include "LiveSupport/Widgets/WhiteWindow.h" 51 #include "LiveSupport/Widgets/Button.h"52 51 53 52 namespace LiveSupport { 103 102 protected: 104 103 /** 105 * The vertical box holding the message and the button.106 */107 Gtk::Box * layout;108 109 /**110 * The message.111 */112 Gtk::Label * messageLabel;113 114 /**115 * The Cancel button.116 */117 Button * cancelDialogButton;118 119 /**120 * The No button.121 */122 Button * noDialogButton;123 124 /**125 * The Yes button.126 */127 Button * yesDialogButton;128 129 /**130 * The OK button.131 */132 Button * okDialogButton;133 134 /**135 104 * The event handler for the Cancel button clicked. 136 105 */ -
trunk/livesupport/src/modules/widgets/src/DialogWindow.cxx
r1601 r1903 38 38 #include "LiveSupport/Widgets/WidgetFactory.h" 39 39 #include "LiveSupport/Widgets/Colors.h" 40 #include "LiveSupport/Widgets/Button.h" 40 41 41 42 #include "LiveSupport/Widgets/DialogWindow.h" … … 70 71 Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance(); 71 72 72 layout = Gtk::manage(new Gtk::VBox()); 73 74 messageLabel = Gtk::manage(new Gtk::Label(*message)); 75 layout->pack_start(*messageLabel, true, true); 76 73 Gtk::Label * messageLabel = Gtk::manage(new Gtk::Label(*message, 74 Gtk::ALIGN_CENTER, 75 Gtk::ALIGN_CENTER )); 76 Gtk::Box * messageBox = Gtk::manage(new Gtk::HBox); 77 messageBox->pack_start(*messageLabel, true, false, 10); 78 77 79 Gtk::ButtonBox * buttonBox = Gtk::manage(new Gtk::HButtonBox( 78 80 Gtk::BUTTONBOX_END, 5)); 79 layout->pack_start(*buttonBox, Gtk::PACK_SHRINK, 0); 80 81 81 82 int buttonCount = 0; 82 83 try { 83 84 if (buttonTypes & cancelButton) { 84 cancelDialogButton = Gtk::manage(widgetFactory->createButton(85 Button * button = Gtk::manage(widgetFactory->createButton( 84 85 *getResourceUstring("cancelButtonLabel") )); 85 cancelDialogButton->signal_clicked().connect(sigc::mem_fun(*this,86 button->signal_clicked().connect(sigc::mem_fun(*this, 85 86 &DialogWindow::onCancelButtonClicked)); 86 buttonBox->pack_start(* cancelDialogButton);87 buttonBox->pack_start(*button); 86 87 ++buttonCount; 87 88 } 88 89 89 90 if (buttonTypes & noButton) { 90 noDialogButton = Gtk::manage(widgetFactory->createButton(91 Button * button = Gtk::manage(widgetFactory->createButton( 90 91 *getResourceUstring("noButtonLabel") )); 91 noDialogButton->signal_clicked().connect(sigc::mem_fun(*this,92 button->signal_clicked().connect(sigc::mem_fun(*this, 91 92 &DialogWindow::onNoButtonClicked)); 92 buttonBox->pack_start(* noDialogButton);93 buttonBox->pack_start(*button); 92 93 ++buttonCount; 93 94 } 94 95 95 96 if (buttonTypes & yesButton) { 96 yesDialogButton = Gtk::manage(widgetFactory->createButton(97 Button * button = Gtk::manage(widgetFactory->createButton( 96 97 *getResourceUstring("yesButtonLabel") )); 97 yesDialogButton->signal_clicked().connect(sigc::mem_fun(*this,98 button->signal_clicked().connect(sigc::mem_fun(*this, 97 98 &DialogWindow::onYesButtonClicked)); 98 buttonBox->pack_start(* yesDialogButton);99 buttonBox->pack_start(*button); 98 99 ++buttonCount; 99 100 } 100 101 101 102 if (buttonTypes & okButton) { 102 okDialogButton = Gtk::manage(widgetFactory->createButton(103 Button * button = Gtk::manage(widgetFactory->createButton( 102 103 *getResourceUstring("okButtonLabel") )); 103 okDialogButton->signal_clicked().connect(sigc::mem_fun(*this,104 button->signal_clicked().connect(sigc::mem_fun(*this, 103 104 &DialogWindow::onOkButtonClicked)); 104 buttonBox->pack_start(* okDialogButton);105 buttonBox->pack_start(*button); 104 105 ++buttonCount; 105 106 } 121 122 } 122 123 124 Gtk::Box * bottomBox = Gtk::manage(new Gtk::HBox); 125 bottomBox->pack_start(*buttonBox, true, true, 10); 126 127 Gtk::Box * layout = Gtk::manage(new Gtk::VBox); 128 layout->pack_start(*messageBox, true, false, 5); 129 layout->pack_start(*bottomBox, false, false, 0); 130 123 131 set_default_size(100*buttonCount + 50, 120); 124 132 property_window_position().set_value(Gtk::WIN_POS_CENTER); -
trunk/livesupport/src/modules/widgets/src/TestWindow.h
r1601 r1903 92 92 93 93 /** 94 * The resource bundle. 95 */ 96 Ptr<ResourceBundle>::Ref bundle; 97 98 /** 94 99 * The "are you sure?" dialog window. 95 100 */ -
trunk/livesupport/src/modules/widgets/src/TestWindow.cxx
r1902 r1903 118 118 layout->attach(*cueStopImageButton, 1, 2, 0, 1); 119 119 120 Ptr<ResourceBundle>::Ref resourceBundle;121 120 try { 122 121 Ptr<xmlpp::DomParser>::Ref parser( … … 125 124 const xmlpp::Element * root = document->get_root_node(); 126 125 127 resourceBundle = LocalizedObject::getBundle(*root);126 bundle = LocalizedObject::getBundle(*root); 127 126 128 127 } catch (std::invalid_argument &e) { … … 142 141 DialogWindow::noButton | 143 142 DialogWindow::yesButton, 144 resourceBundle ));143 bundle )); 144 143 } 145 144 163 162 Ptr<Glib::ustring>::Ref message(new Glib::ustring("Hello, World!")); 164 163 165 WhiteWindow * helloWindow = wf->createMessageWindow(message); 166 Gtk::Main::run(*helloWindow); 164 DialogWindow * helloWindow = wf->createDialogWindow(message, bundle); 165 helloWindow->run(); 167 166 delete helloWindow; 168 167 } -
trunk/livesupport/src/modules/widgets/src/WidgetFactory.cxx
r1902 r1903 38 38 39 39 #include "LiveSupport/Widgets/Colors.h" 40 #include "MessageWindow.h"41 40 42 41 #include "LiveSupport/Widgets/WidgetFactory.h" 652 651 653 652 /*------------------------------------------------------------------------------ 654 * Create a messagewindow.653 * Create a dialog window. 654 653 *----------------------------------------------------------------------------*/ 655 WhiteWindow * 656 WidgetFactory :: createMessageWindow(Ptr<Glib::ustring>::Ref message) 654 DialogWindow * 655 WidgetFactory :: createDialogWindow(Ptr<Glib::ustring>::Ref message, 656 Ptr<ResourceBundle>::Ref bundle, 657 int buttons) 657 658 throw () 658 659 { 659 return new MessageWindow(message);660 return new DialogWindow(message, buttons, bundle); 659 660 } 660 661 -
trunk/livesupport/src/modules/widgets/etc/Makefile.in
r1878 r1903 146 146 ${TMP_DIR}/ZebraCellRenderer.o \ 147 147 ${TMP_DIR}/Colors.o \ 148 ${TMP_DIR}/MessageWindow.o \149 148 ${TMP_DIR}/DialogWindow.o \ 150 149 ${TMP_DIR}/ScrolledWindow.o \