bbtkWxBlackBox.cxx

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:14 $
00006   Version:   $Revision: 1.27 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00032 #ifdef _USE_WXWIDGETS_
00033 
00034 
00035 
00041 #include "bbtkWxBlackBox.h"
00042 //#include "bbtkWxContainerBlackBox.h"
00043 #include <wx/dialog.h>
00044 
00045 //#include "bbtkData.h"
00046 //#include "bbtkFactory.h"
00047 
00048 
00049 
00050 
00051 namespace bbtk
00052 {
00053 
00054 
00055 
00056 
00057   //=========================================================================
00058   // WxBlackBoxWindow
00059   //=========================================================================
00060 
00061 
00062 
00063   //=========================================================================
00064   WxBlackBoxWindow::WxBlackBoxWindow(WxBlackBox::Pointer box)
00065     : mBox(box), mShown(false)
00066   {
00067     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::WxBlackBoxWindow("<<
00068                      mBox.lock()->bbGetFullName()<<")"<<std::endl);
00069     mBox.lock()->bbSetWindow(this);
00070     Wx::IncNbWindowsAlive();
00071   }
00072   //=========================================================================
00073 
00074   //=========================================================================
00075   WxBlackBoxWindow::~WxBlackBoxWindow()
00076   {
00077     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::~WxBlackBoxWindow() "
00078                      <<this<<std::endl);
00079     bbHide();
00080     Wx::DecNbWindowsAlive();
00081     if (!mBox.expired())
00082       {
00083         mBox.lock()->bbSetWindow(0);
00084       }
00085   }
00086   //========================================================================= 
00087 
00088 
00089   //=========================================================================
00090   void WxBlackBoxWindow::bbShow()
00091   {
00092     if (bbIsShown()) return;
00093     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbShow()"<<std::endl);
00094     Wx::IncNbWindowsShown();
00095     mShown = true;
00096   }
00097   //=========================================================================
00098 
00099   //=========================================================================
00100   void WxBlackBoxWindow::bbHide()
00101   {
00102     if (!bbIsShown()) return;
00103     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbHide()"<<std::endl);
00104     Wx::DecNbWindowsShown();
00105     mShown = false;
00106   }
00107   //=========================================================================
00108 
00109   //=========================================================================
00110   void WxBlackBoxWindow::bbClose()
00111   {
00112   }
00113   //=========================================================================
00114 
00115 
00116   //=========================================================================
00117   // WxBlackBoxDialog
00118   //=========================================================================
00119 
00120   //=========================================================================
00121   WxBlackBoxDialog::WxBlackBoxDialog(WxBlackBox::Pointer box,
00122                                      wxWindow *parent,
00123                                      wxString title,
00124                                      wxSize size)
00125     :
00126     wxDialog( parent, 
00127                 -1, 
00128                 title,
00129                 wxDefaultPosition,
00130                 size,
00131                 wxRESIZE_BORDER | 
00132                 wxSYSTEM_MENU  |
00133                 wxCLOSE_BOX |
00134                 wxMAXIMIZE_BOX | 
00135                 wxMINIMIZE_BOX | 
00136                 wxCAPTION  
00137               ),
00138     WxBlackBoxWindow(box)
00139   {
00140     bbtkDebugMessage("wx",9,"WxBlackBoxDialog::WxBlackBoxDialog("<<
00141                      bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
00142                      <<title<<",size)"<<std::endl);
00143     // Insert the widget into the window
00144     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
00145     wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget();
00146     widget->Reparent(this);
00147     sizer->Add( widget, 1, wxALL|wxEXPAND, 2);
00148     //SetAutoLayout(true);
00149     SetSizer(sizer);
00150     Layout();
00151   }
00152   //=========================================================================
00153   
00154   //=========================================================================
00155   void WxBlackBoxDialog::bbShow()
00156   { 
00157     if (bbIsShown()) return;
00158     bbtkDebugMessage("wx",5,"WxBlackBoxDialog::bbShow() ["
00159                      <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
00160     WxBlackBoxWindow::bbShow();
00161     SetReturnCode( wxDialog::ShowModal() ); 
00162     bbClose();
00163   }
00164   //=========================================================================
00165 
00166   //=========================================================================
00167   void WxBlackBoxDialog::bbHide()
00168   {
00169     bbtkDebugMessage("wx",9,"WxBlackBoxDialog::bbHide()"<<std::endl);
00170     WxBlackBoxWindow::bbHide();
00171     Hide();
00172   }
00173   //=========================================================================
00174 
00175   //=========================================================================
00176   void WxBlackBoxDialog::bbClose()
00177   {
00178     bbtkDebugMessage("wx",9,"WxBlackBoxDialog::bbClose()"<<std::endl);
00179     wxDialog::Destroy();
00180   }
00181   //=========================================================================
00182 
00183   //=========================================================================
00184   WxBlackBoxDialog::~WxBlackBoxDialog()
00185   {
00186   }
00187   //=========================================================================
00188 
00189 
00190 
00191 
00192 
00193   //=========================================================================
00194   // WxBlackBoxFrame
00195   //=========================================================================
00196 
00197   //=========================================================================
00198   WxBlackBoxFrame::WxBlackBoxFrame(WxBlackBox::Pointer box,
00199                                    wxWindow *parent,
00200                                    wxString title,
00201                                    wxSize size)
00202     :  wxFrame( parent, 
00203                -1, 
00204                title,
00205                wxDefaultPosition,
00206                size,
00207                wxRESIZE_BORDER | 
00208                wxSYSTEM_MENU  |
00209                wxCLOSE_BOX |
00210                wxMAXIMIZE_BOX | 
00211                wxMINIMIZE_BOX | 
00212                wxCAPTION  
00213                 ),
00214        WxBlackBoxWindow(box)
00215   {
00216     bbtkDebugMessage("wx",9,"WxBlackBoxFrame::WxBlackBoxFrame("<<
00217                      bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
00218                      <<title<<",size)"<<std::endl);
00219     // Insert the widget into the window
00220     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
00221     wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget();
00222     wxFrame* frame = (wxFrame*)this;
00223     widget->Reparent(frame);
00224     sizer->Add( widget, 1, wxALL|wxGROW, 2);
00225     //  frame->SetAutoLayout(true);
00226     frame->SetSizer(sizer);
00227     //frame->Fit();
00228     frame->Layout();
00229   }
00230   //=========================================================================
00231   
00232   //=========================================================================
00233   WxBlackBoxFrame::~WxBlackBoxFrame()
00234   {
00235   }
00236   //=========================================================================
00237 
00238   //=========================================================================
00239   void WxBlackBoxFrame::bbShow() 
00240   { 
00241     if (bbIsShown()) return;
00242     bbtkDebugMessage("wx",5,"WxBlackBoxFrame::bbShow("
00243                      <<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
00244     WxBlackBoxWindow::bbShow();
00245   wxFrame::Show();
00246     // This Update is ** MANDATORY ** 
00247     // to synchronize wxvtkRenderWindowInteractor objects
00248     // (force wx objects creation **NOW**)
00249 
00250 
00251 #if defined(_WIN32)
00252       wxFrame::Refresh();
00253 #endif
00254 
00255       wxFrame::Update();
00256       wxFrame::SetFocus();
00257     if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow();
00258   }
00259   //=========================================================================
00260 
00261   //=========================================================================
00262   void WxBlackBoxFrame::bbHide()
00263   {
00264     bbtkDebugMessage("wx",9,"WxBlackBoxFrame::bbHide()"<<std::endl);
00265     WxBlackBoxWindow::bbHide();
00266     wxFrame::Hide();
00267     if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnHide();
00268   }
00269   //=========================================================================
00270 
00271   //=========================================================================
00272   void WxBlackBoxFrame::bbClose()
00273   {
00274     bbtkDebugMessage("wx",9,"WxBlackBoxFrame::bbClose()"<<std::endl);
00275     wxFrame::Close();
00276   }
00277   //=========================================================================
00278 
00279 
00280 
00281   //=========================================================================
00282   // WxBlackBoxWidgetEventHandler
00283   //=========================================================================
00284 
00285   //=========================================================================
00286   WxBlackBoxWidgetEventHandler::
00287   WxBlackBoxWidgetEventHandler( WxBlackBox::Pointer box, 
00288                                 wxWindow *widget )
00289     :
00290     mBox(box),
00291     mWindow(widget)
00292   { 
00293     bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::WxBlackBoxWidgetEventHandler("<<mBox.lock()->bbGetFullName()<<")"<<std::endl);
00294 
00295     mBox.lock()->bbSetWidgetEventHandler(this);
00296 
00297     Connect (  mWindow->GetId(),
00298                wxEVT_DESTROY,
00299                (wxObjectEventFunction) 
00300                (void (wxEvtHandler::*)(wxWindowDestroyEvent& c))
00301                 &WxBlackBoxWidgetEventHandler::OnWindowDestroy );
00302     
00303     mWindow->PushEventHandler(this);
00304     
00305   }
00306   //=========================================================================
00307 
00308   //=========================================================================
00309   WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler()
00310   {
00311     if (mBox.expired()) return;
00312     bbtkDebugMessage("wx",9,
00313                      "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler() ["
00314                      <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
00315      mBox.lock()->bbSetWidgetEventHandler(0);   
00316   }
00317   //=========================================================================
00318 
00319   //=========================================================================
00320   void WxBlackBoxWidgetEventHandler::OnWindowDestroy(wxWindowDestroyEvent&)
00321   {
00322     if (mBox.expired()) return;
00323     bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() ["
00324                      <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
00325     mBox.lock()->bbSetOutputWidget(0);
00326     mBox.lock()->bbSetModifiedStatus();
00327   }
00328   //=========================================================================
00329 
00330 
00331 
00332 
00333 
00334 
00335 
00336   //=========================================================================
00337   // WxBlackBox
00338   //=========================================================================
00339 
00340   //=========================================================================
00341   //=========================================================================
00342   //=========================================================================
00343   //=========================================================================
00344   BBTK_BLACK_BOX_IMPLEMENTATION(WxBlackBox,AtomicBlackBox);
00345   //=========================================================================
00346   
00347   //=========================================================================
00348   void WxBlackBox::bbUserConstructor()
00349   {
00350     bbtkDebugMessage("Kernel",9,"WxBlackBox::bbUserConstructor()"<<std::endl);
00351     bbInitAttributes();
00352   }
00353   //=========================================================================
00354 
00355   //=========================================================================
00356   void WxBlackBox::bbUserCopyConstructor()
00357   {
00358     bbtkDebugMessage("Kernel",9,"WxBlackBox::bbUserCopyConstructor()"
00359                      <<std::endl);
00360     bbInitAttributes();
00361   }
00362   //=========================================================================
00363 
00364 
00365   //=========================================================================
00366   void WxBlackBox::bbUserDestructor()
00367   {
00368     bbtkDebugMessage("wx",9,"==> WxBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
00369     if (bbGetWindow()) {
00370       delete bbGetWindow();
00371       bbSetWindow(0);
00372     }
00373     bbtkDebugMessage("wx",9,"<== WxBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
00374   }
00375   //=========================================================================
00376   
00377 
00378   /*
00379   //=========================================================================
00380   WxBlackBox::Widget*  WxBlackBox::bbGetWidget()
00381   { 
00382     if (bbGetOutputWidget() && bbGetOutputWidget()->IsDead()) 
00383       {
00384         bbtkDebugMessage("wx",9,"WxBlackBox::bbGetWidget() ["<<
00385                          bbGetFullName()<<"] : Widget is dead : deleting it"
00386                          <<std::endl);
00387         delete bbGetOutputWidget();
00388         bbSetOutputWidget(0);
00389       }
00390     return bbGetOutputWidget();
00391   }
00392   //=========================================================================
00393   */
00394 
00395 
00396   //=========================================================================
00401   void WxBlackBox::bbInitAttributes()
00402   {
00403     bbmWindow = 0;
00404     //    bbmWidget = 0;
00405     //    bbSetInputWinParent(0);
00406     bbSetInputWinTitle(bbGetName());
00407     bbSetInputWinWidth(800);
00408     bbSetInputWinHeight(800);
00409     bbSetInputWinDialog(false);
00410     bbSetOutputWidget(0);
00411 
00412     bbSetWidgetEventHandler(0);
00413     bbSetUpdateTransferedToParent(false);
00414   }
00415   //=========================================================================
00416 
00417   //=========================================================================
00419   void WxBlackBox::bbExecute(bool force)
00420   {
00421     bbtkDebugMessageInc("process",2,
00422                         "=> WxBlackBox::bbExecute() ["
00423                         <<bbGetFullName()<<"]"<<std::endl);
00424 
00425     // If the output 'Widget' is connected then 
00426     // we must execute the parent box
00427     BlackBox::OutputConnectorMapType::const_iterator i 
00428       = bbGetOutputConnectorMap().find("Widget");
00429 
00430     if ( i->second->GetConnectionVector().size() != 0 ) 
00431       {
00432         bbtkDebugMessage("process",3,
00433                          "-> Output 'Widget' connected : transfering execution to parent"
00434                          <<std::endl);
00435         
00436         i->second->GetConnectionVector().front() //.lock()
00437           ->GetBlackBoxTo()->bbExecute(force);
00438 
00439       }
00440     // else call 'standard' BlackBox execution method
00441     else 
00442       {
00443         BlackBox::bbExecute(force);
00444       }
00445     //
00446 
00447     bbtkDebugMessageDec("process",2,
00448                         "<= WxBlackBox::bbExecute() ["
00449                         <<bbGetFullName()<<"]"<<std::endl);
00450   }
00451   //=========================================================================
00452 
00453 
00454   //=========================================================================
00456   IOStatus WxBlackBox::bbBackwardUpdate( Connection::Pointer caller )
00457   {
00458     bbtkDebugMessage("process",3,
00459                      "=> WxBlackBox::bbBackwardUpdate("
00460                      <<(caller?caller->GetFullName():"0")<<") ["
00461                      <<bbGetFullName()<<"]"<<std::endl);
00462     // If the caller's box to is not the box to connected to the 
00463     // output 'Widget'
00464     if ( ! (( bbGetStatus() == MODIFIED ) ||
00465             ( bbBoxProcessModeIsAlways() )) )
00466       {
00467         bbtkDebugMessage("process",3,"Up-to-date : nothing to do"<<std::endl);
00468         bbtkDebugMessage("process",3,
00469                          "<= WxBlackBox::bbBackwardUpdate("
00470                          <<(caller?caller->GetFullName():"0")<<") ["
00471                          <<bbGetFullName()<<"]"<<std::endl);
00472         return bbGetStatus();
00473       }
00474  
00475     BlackBox::OutputConnectorMapType::const_iterator i 
00476       = bbGetOutputConnectorMap().find("Widget") ;
00477     if ( i->second->GetConnectionVector().size() != 0 )
00478       
00479       {
00480         BlackBox::Pointer to = 
00481           i->second->GetConnectionVector()[0]->GetBlackBoxTo();
00482                 
00483         if (caller) 
00484           {
00485             bbtkDebugMessage("process",3,
00486                              "-> Output 'Widget' connected to '"
00487                              <<to->bbGetFullName()<<"' - caller->to = '"
00488                              <<caller->GetBlackBoxTo()->bbGetFullName()
00489                              <<"'"
00490                              <<std::endl);
00491           }
00492         else
00493           {
00494             bbtkDebugMessage("process",3,
00495                              "-> Output 'Widget' connected to '"
00496                              <<to->bbGetFullName()<<"'"
00497                              <<std::endl);
00498           }
00499         if ((caller==0) ||
00500             ((caller!=0) && 
00501              (caller->GetBlackBoxTo() != to))&&
00502             (!bbGetUpdateTransferedToParent())&&
00503             (to->bbGetStatus()!=UPDATING))
00504           {
00505             bbtkDebugMessage("process",3,
00506                              "   ... Transfering update order to parent"
00507                              <<std::endl);
00508             
00509             bbSetUpdateTransferedToParent(true);
00510             i->second->GetConnectionVector().front() //.lock()
00511               ->GetBlackBoxTo()->bbExecute(false);
00512           }
00513         else
00514           {
00515             bbSetUpdateTransferedToParent(false);
00516             bbtkDebugMessage("process",3,
00517                              "   ... No need to transfer to parent"
00518                              <<std::endl);
00519           }
00520       }
00521     /*    
00522 
00523     // If the caller is not the connection to the output widget
00524     // and the output 'Widget' is connected then 
00525     // we must execute the parent box 
00526     // but only one time 
00527     // (this is the role of the flag UpdateTransferedToParent)
00528     if ( (caller==0) ||
00529          ((caller!=0)&&(caller->GetBlackBoxFromOutput()!="Widget"))
00530          )
00531       {
00532       }
00533     */
00534     // call 'standard' BlackBox execution method
00535     if (!bbGetUpdateTransferedToParent()) 
00536       { 
00537           AtomicBlackBox::bbBackwardUpdate(caller);
00538       }
00539     
00540     bbtkDebugMessageDec("process",3,
00541                         "<= WxBlackBox::bbBackwardUpdate() ["
00542                         <<bbGetFullName()<<"]"<<std::endl);
00543     
00544    return bbGetStatus();
00545      
00546 
00547   }
00548 
00549   //=========================================================================
00550   void WxBlackBox::bbProcess()
00551   { 
00552     if (bbGetOutputWidget()==0) this->bbUserCreateWidget();
00553     this->bbUserProcess(); 
00554     bbShowWindow();
00555     //    this->bbUserOnShow();
00556   }
00557   //=========================================================================
00558   
00559   //==================================================================
00563   void WxBlackBox::bbShowWindow()
00564   {
00565     bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbShowWindow() ["
00566                         <<bbGetFullName()<<"]"<<std::endl);
00567  
00568     // If Event Handler for the widget does not exist or is obsolete : create it 
00569     if (bbGetOutputWidget()!=0)
00570       {
00571         if (bbGetWidgetEventHandler()==0)
00572           {
00573             bbtkDebugMessage("wx",3,
00574                              "-> No widget event handler : creating one"
00575                              <<std::endl);
00576             new WxBlackBoxWidgetEventHandler(GetThisPointer<WxBlackBox>(),
00577                                              bbGetOutputWidget());
00578           }
00579         else if ( ! bbGetWidgetEventHandler()->IsHandlerOf 
00580                   ( bbGetOutputWidget() ) )
00581           {
00582             bbtkDebugMessage("wx",3,
00583                              "-> Obsolete widget event handler : re-creating one"
00584                              <<std::endl);
00585             delete bbGetWidgetEventHandler();
00586             new WxBlackBoxWidgetEventHandler(GetThisPointer<WxBlackBox>(),
00587                                              bbGetOutputWidget());
00588           }
00589         // Sets the name of the wxWindow to the input WinTitle
00590         bbGetOutputWidget()->SetName(bbtk::std2wx(bbGetInputWinTitle()));
00591       }
00592 
00593     // If the output 'Widget' is connected then it's gonna 
00594     // be captured by its parent window : nothing to do 
00595     if ( (*bbGetOutputConnectorMap().find("Widget")).second
00596          ->GetConnectionVector().size() != 0 ) 
00597       {
00598         
00599         bbtkDebugMessage("wx",2,
00600                          "-> Output 'Widget' connected : nothing to do"
00601                          <<std::endl);
00602         return;
00603       }
00604 
00605 
00606     Window* show = 0;
00607     // If the window already exists : no need creating it
00608     if (bbGetWindow()!=0)
00609       {
00610         bbtkDebugMessage("wx",2,
00611                          "-> Window already exists"
00612                          <<std::endl);
00613         show = bbGetWindow();
00614       }
00615     // Else if the widget exists : create window 
00616     else if (bbGetOutputWidget()!=0) 
00617       {
00618         bbtkDebugMessage("wx",2,
00619                          "-> Widget exists : creating the window"
00620                          <<std::endl);
00621 
00622 
00623         // Input WinDialog set to true : creating a Dialog
00624         if (bbGetInputWinDialog()) 
00625           {
00626             bbtkDebugMessage("wx",2,
00627                              "   Input WinDialog set to true : creating a Dialog"
00628                              <<std::endl);
00629             show = (Window*) new WxBlackBoxDialog( GetThisPointer<WxBlackBox>(),
00630                                                    bbGetWxParent(), 
00631                                                    std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"),
00632                                                    wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
00633           }
00634         // Input WinDialog set to false : creating a Frame
00635         else 
00636           {
00637             bbtkDebugMessage("process",2,
00638                              "   Input WinDialog set to false : creating a Frame"
00639                              <<std::endl);
00640             show = (Window*) new WxBlackBoxFrame( GetThisPointer<WxBlackBox>(),
00641                                                   bbGetWxParent(), 
00642                                                   std2wx( bbGetInputWinTitle()  + " - bbtk (c) CREATIS LRMN"),
00643                                                   wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
00644           }
00645 
00646       }
00647     // No window nor widget : error
00648     else
00649       {
00650         bbtkError("WxBlackBox::bbShowWindow() ["
00651                   <<bbGetFullName()
00652                   <<"] : No widget. Did you set the box output 'Widget' in the processing method of the box ?");
00653       }
00654  
00655     
00656     // Show the window
00657     if (true) 
00658       {
00659         show->bbShow(); 
00660       }
00661     else 
00662       {
00663         bbtkDebugMessage("wx",2,"-> Already shown : nothing to do"<<std::endl);
00664       }
00665   
00666 
00667     bbtkDebugMessage("wx",1,"<= WxBlackBox::bbShowWindow() ["
00668                         <<bbGetFullName()<<"]"<<std::endl);
00669 
00670   }
00671   //==================================================================
00672 
00673 
00674 
00675 
00676   //==================================================================
00677    void WxBlackBox::bbHideWindow()
00678   {
00679     bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbHideWindow() ["
00680                         <<bbGetFullName()<<"]"<<std::endl);
00681 
00682     if (bbGetWindow()!=0) bbGetWindow()->bbHide();
00683 
00684     bbtkDebugMessageDec("wx",1,"<= WxBlackBox::bbHideWindow() ["
00685                         <<bbGetFullName()<<"]"<<std::endl);
00686   }
00687   //==================================================================
00688 
00689 
00690   //==================================================================
00691    void WxBlackBox::bbCloseWindow()
00692   {
00693     bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbCloseWindow() ["
00694                         <<bbGetFullName()<<"]"<<std::endl);
00695 
00696     if (bbGetWindow()!=0) bbGetWindow()->bbClose();
00697 
00698     bbtkDebugMessageDec("wx",1,"<= WxBlackBox::bbCloseWindow() ["
00699                         <<bbGetFullName()<<"]"<<std::endl);
00700   }
00701   //==================================================================
00702 
00703   //==================================================================
00704   WxBlackBox::Window* WxBlackBox::bbGetContainingWindow()
00705   {
00706     if (bbGetWindow()!=0) return bbGetWindow();
00707     BlackBox::OutputConnectorMapType::const_iterator i 
00708       = bbGetOutputConnectorMap().find("Widget");
00709     if ( i->second->GetConnectionVector().size() != 0 ) 
00710       {
00711         return boost::static_pointer_cast<WxBlackBox>
00712           (i->second->GetConnectionVector().front() //.lock()
00713            ->GetBlackBoxTo())->bbGetContainingWindow();
00714       }
00715     return 0;
00716   }
00717   //==================================================================
00718 
00719 
00720   //==================================================================
00721   wxWindow* WxBlackBox::bbGetWxParent() { return Wx::GetTopWindow(); }
00722   //==================================================================
00723   
00724   
00725   //==================================================================
00726   bool WxBlackBox::bbIsShown()
00727   {
00728     if (bbGetContainingWindow()!=0)
00729       return bbGetContainingWindow()->bbIsShown();
00730     return false;
00731   }
00732   //==================================================================
00733 
00734 
00735 }//namespace bbtk
00736 
00737 
00738 #endif
00739 

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6