00001 // /////////////////////////////////////////////////////////////////////////// 00002 // xrb_modalwidget.cpp by Victor Dods, created 2005/02/20 00003 // /////////////////////////////////////////////////////////////////////////// 00004 // Unless a different license was explicitly granted in writing by the 00005 // copyright holder (Victor Dods), this software is freely distributable under 00006 // the terms of the GNU General Public License, version 2. Any works deriving 00007 // from this work must also be released under the GNU GPL. See the included 00008 // file LICENSE for details. 00009 // /////////////////////////////////////////////////////////////////////////// 00010 00011 #include "xrb_modalwidget.hpp" 00012 00013 #include "xrb_gui_events.hpp" 00014 00015 namespace Xrb 00016 { 00017 00018 ModalWidget::ModalWidget ( 00019 ContainerWidget *const parent, 00020 std::string const &name) 00021 : 00022 ContainerWidget(parent, name) 00023 { 00024 // make this widget modal 00025 SetIsModal(true); 00026 } 00027 00028 void ModalWidget::Shutdown () 00029 { 00030 // tell the parent to delete this widget 00031 ASSERT1(Parent() != NULL); 00032 EventDeleteChildWidget *delete_child_widget_event = 00033 new EventDeleteChildWidget(this, Parent()->MostRecentFrameTime()); 00034 Parent()->EnqueueEvent(delete_child_widget_event); 00035 00036 // make this widget un-modal 00037 SetIsModal(false); 00038 // block future events 00039 SetIsBlockingEvents(true); 00040 } 00041 00042 void ModalWidget::UpdateRenderBackground () 00043 { 00044 SetRenderBackground( 00045 WidgetSkinWidgetBackground(WidgetSkin::MODAL_WIDGET_BACKGROUND)); 00046 } 00047 00048 void ModalWidget::HandleChangedModalWidgetBackground () 00049 { 00050 UpdateRenderBackground(); 00051 } 00052 00053 void ModalWidget::HandleChangedWidgetSkinWidgetBackground ( 00054 WidgetSkin::WidgetBackgroundType const widget_background_type) 00055 { 00056 if (widget_background_type == WidgetSkin::MODAL_WIDGET_BACKGROUND) 00057 HandleChangedModalWidgetBackground(); 00058 } 00059 00060 } // end of namespace Xrb