]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxBlackBox.cxx
de81d49f06a024211d05172e1e577ab6dd759ab1
[bbtk.git] / kernel / src / bbtkWxBlackBox.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/07/24 14:37:06 $
7   Version:   $Revision: 1.25 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #ifdef _USE_WXWIDGETS_
20
21
22
23 /**
24  *  \file 
25  *  \brief 
26  */
27  
28 #include "bbtkWxBlackBox.h"
29 //#include "bbtkWxContainerBlackBox.h"
30 #include <wx/dialog.h>
31
32 //#include "bbtkData.h"
33 //#include "bbtkFactory.h"
34
35
36
37
38 namespace bbtk
39 {
40
41
42
43
44   //=========================================================================
45   // WxBlackBoxWindow
46   //=========================================================================
47
48
49
50   //=========================================================================
51   WxBlackBoxWindow::WxBlackBoxWindow(WxBlackBox::Pointer box)
52     : mBox(box), mShown(false)
53   {
54     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::WxBlackBoxWindow("<<
55                      mBox.lock()->bbGetFullName()<<")"<<std::endl);
56     mBox.lock()->bbSetWindow(this);
57     Wx::IncNbWindowsAlive();
58   }
59   //=========================================================================
60
61   //=========================================================================
62   WxBlackBoxWindow::~WxBlackBoxWindow()
63   {
64     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::~WxBlackBoxWindow() "
65                      <<this<<std::endl);
66     bbHide();
67     Wx::DecNbWindowsAlive();
68     if (!mBox.expired())
69       {
70         mBox.lock()->bbSetWindow(0);
71       }
72   }
73   //========================================================================= 
74
75
76   //=========================================================================
77   void WxBlackBoxWindow::bbShow()
78   {
79     if (bbIsShown()) return;
80     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbShow()"<<std::endl);
81     Wx::IncNbWindowsShown();
82     mShown = true;
83   }
84   //=========================================================================
85
86   //=========================================================================
87   void WxBlackBoxWindow::bbHide()
88   {
89     if (!bbIsShown()) return;
90     bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbHide()"<<std::endl);
91     Wx::DecNbWindowsShown();
92     mShown = false;
93   }
94   //=========================================================================
95
96   //=========================================================================
97   void WxBlackBoxWindow::bbClose()
98   {
99   }
100   //=========================================================================
101
102
103   //=========================================================================
104   // WxBlackBoxDialog
105   //=========================================================================
106
107   //=========================================================================
108   WxBlackBoxDialog::WxBlackBoxDialog(WxBlackBox::Pointer box,
109                                      wxWindow *parent,
110                                      wxString title,
111                                      wxSize size)
112     :
113     wxDialog( parent, 
114                 -1, 
115                 title,
116                 wxDefaultPosition,
117                 size,
118                 wxRESIZE_BORDER | 
119                 wxSYSTEM_MENU  |
120                 wxCLOSE_BOX |
121                 wxMAXIMIZE_BOX | 
122                 wxMINIMIZE_BOX | 
123                 wxCAPTION  
124               ),
125     WxBlackBoxWindow(box)
126   {
127     bbtkDebugMessage("wx",9,"WxBlackBoxDialog::WxBlackBoxDialog("<<
128                      bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
129                      <<title<<",size)"<<std::endl);
130     // Insert the widget into the window
131     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
132     wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget();
133     widget->Reparent(this);
134     sizer->Add( widget, 1, wxALL|wxEXPAND, 2);
135     //SetAutoLayout(true);
136     SetSizer(sizer);
137     Layout();
138   }
139   //=========================================================================
140   
141   //=========================================================================
142   void WxBlackBoxDialog::bbShow()
143   { 
144     bbtkDebugMessage("wx",5,"WxBlackBoxDialog::bbShow() ["
145                      <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
146     WxBlackBoxWindow::bbShow();
147     SetReturnCode( wxDialog::ShowModal() ); 
148     bbClose();
149   }
150   //=========================================================================
151
152   //=========================================================================
153   void WxBlackBoxDialog::bbHide()
154   {
155     bbtkDebugMessage("wx",9,"WxBlackBoxDialog::bbHide()"<<std::endl);
156     WxBlackBoxWindow::bbHide();
157     Hide();
158   }
159   //=========================================================================
160
161   //=========================================================================
162   void WxBlackBoxDialog::bbClose()
163   {
164     bbtkDebugMessage("wx",9,"WxBlackBoxDialog::bbClose()"<<std::endl);
165     wxDialog::Destroy();
166   }
167   //=========================================================================
168
169   //=========================================================================
170   WxBlackBoxDialog::~WxBlackBoxDialog()
171   {
172   }
173   //=========================================================================
174
175
176
177
178
179   //=========================================================================
180   // WxBlackBoxFrame
181   //=========================================================================
182
183   //=========================================================================
184   WxBlackBoxFrame::WxBlackBoxFrame(WxBlackBox::Pointer box,
185                                    wxWindow *parent,
186                                    wxString title,
187                                    wxSize size)
188     :  wxFrame( parent, 
189                -1, 
190                title,
191                wxDefaultPosition,
192                size,
193                wxRESIZE_BORDER | 
194                wxSYSTEM_MENU  |
195                wxCLOSE_BOX |
196                wxMAXIMIZE_BOX | 
197                wxMINIMIZE_BOX | 
198                wxCAPTION  
199                 ),
200        WxBlackBoxWindow(box)
201   {
202     bbtkDebugMessage("wx",9,"WxBlackBoxFrame::WxBlackBoxFrame("<<
203                      bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
204                      <<title<<",size)"<<std::endl);
205     // Insert the widget into the window
206     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
207     wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget();
208     wxFrame* frame = (wxFrame*)this;
209     widget->Reparent(frame);
210     sizer->Add( widget, 1, wxALL|wxGROW, 2);
211     //  frame->SetAutoLayout(true);
212     frame->SetSizer(sizer);
213     //frame->Fit();
214     frame->Layout();
215   }
216   //=========================================================================
217   
218   //=========================================================================
219   WxBlackBoxFrame::~WxBlackBoxFrame()
220   {
221   }
222   //=========================================================================
223
224   //=========================================================================
225   void WxBlackBoxFrame::bbShow() 
226   { 
227     bbtkDebugMessage("wx",5,"WxBlackBoxFrame::bbShow("
228                      <<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
229     WxBlackBoxWindow::bbShow();
230   wxFrame::Show();
231     // This Update is ** MANDATORY ** 
232     // to synchronize wxvtkRenderWindowInteractor objects
233     // (force wx objects creation **NOW**)
234
235
236 #if defined(_WIN32)
237       wxFrame::Refresh();
238 #endif
239
240       wxFrame::Update();
241       wxFrame::SetFocus();
242     if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow();
243   }
244   //=========================================================================
245
246   //=========================================================================
247   void WxBlackBoxFrame::bbHide()
248   {
249     bbtkDebugMessage("wx",9,"WxBlackBoxFrame::bbHide()"<<std::endl);
250     WxBlackBoxWindow::bbHide();
251     wxFrame::Hide();
252     if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnHide();
253   }
254   //=========================================================================
255
256   //=========================================================================
257   void WxBlackBoxFrame::bbClose()
258   {
259     bbtkDebugMessage("wx",9,"WxBlackBoxFrame::bbClose()"<<std::endl);
260     wxFrame::Close();
261   }
262   //=========================================================================
263
264
265
266   //=========================================================================
267   // WxBlackBoxWidgetEventHandler
268   //=========================================================================
269
270   //=========================================================================
271   WxBlackBoxWidgetEventHandler::
272   WxBlackBoxWidgetEventHandler( WxBlackBox::Pointer box, 
273                                 wxWindow *widget )
274     :
275     mBox(box),
276     mWindow(widget)
277   { 
278     bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::WxBlackBoxWidgetEventHandler("<<mBox.lock()->bbGetFullName()<<")"<<std::endl);
279
280     mBox.lock()->bbSetWidgetEventHandler(this);
281
282     Connect (  mWindow->GetId(),
283                wxEVT_DESTROY,
284                (wxObjectEventFunction) 
285                (void (wxEvtHandler::*)(wxWindowDestroyEvent& c))
286                 &WxBlackBoxWidgetEventHandler::OnWindowDestroy );
287     
288     mWindow->PushEventHandler(this);
289     
290   }
291   //=========================================================================
292
293   //=========================================================================
294   WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler()
295   {
296     if (mBox.expired()) return;
297     bbtkDebugMessage("wx",9,
298                      "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler() ["
299                      <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
300      mBox.lock()->bbSetWidgetEventHandler(0);   
301   }
302   //=========================================================================
303
304   //=========================================================================
305   void WxBlackBoxWidgetEventHandler::OnWindowDestroy(wxWindowDestroyEvent&)
306   {
307     if (mBox.expired()) return;
308     bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() ["
309                      <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
310     mBox.lock()->bbSetOutputWidget(0);
311     mBox.lock()->bbSetModifiedStatus();
312   }
313   //=========================================================================
314
315
316
317
318
319
320
321   //=========================================================================
322   // WxBlackBox
323   //=========================================================================
324
325   //=========================================================================
326   //=========================================================================
327   //=========================================================================
328   //=========================================================================
329   BBTK_BLACK_BOX_IMPLEMENTATION(WxBlackBox,AtomicBlackBox);
330   //=========================================================================
331   
332   //=========================================================================
333   void WxBlackBox::bbUserConstructor()
334   {
335     bbtkDebugMessage("Kernel",9,"WxBlackBox::bbUserConstructor()"<<std::endl);
336     bbInitAttributes();
337   }
338   //=========================================================================
339
340   //=========================================================================
341   void WxBlackBox::bbUserCopyConstructor()
342   {
343     bbtkDebugMessage("Kernel",9,"WxBlackBox::bbUserCopyConstructor()"
344                      <<std::endl);
345     bbInitAttributes();
346   }
347   //=========================================================================
348
349
350   //=========================================================================
351   void WxBlackBox::bbUserDestructor()
352   {
353     bbtkDebugMessage("wx",9,"==> WxBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
354     if (bbGetWindow()) {
355       delete bbGetWindow();
356       bbSetWindow(0);
357     }
358     bbtkDebugMessage("wx",9,"<== WxBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
359   }
360   //=========================================================================
361   
362
363   /*
364   //=========================================================================
365   WxBlackBox::Widget*  WxBlackBox::bbGetWidget()
366   { 
367     if (bbGetOutputWidget() && bbGetOutputWidget()->IsDead()) 
368       {
369         bbtkDebugMessage("wx",9,"WxBlackBox::bbGetWidget() ["<<
370                          bbGetFullName()<<"] : Widget is dead : deleting it"
371                          <<std::endl);
372         delete bbGetOutputWidget();
373         bbSetOutputWidget(0);
374       }
375     return bbGetOutputWidget();
376   }
377   //=========================================================================
378   */
379
380
381   //=========================================================================
382   /**
383    * \brief Initialize the attributes of the class
384    *
385    */
386   void WxBlackBox::bbInitAttributes()
387   {
388     bbmWindow = 0;
389     //    bbmWidget = 0;
390     //    bbSetInputWinParent(0);
391     bbSetInputWinTitle(bbGetName());
392     bbSetInputWinWidth(800);
393     bbSetInputWinHeight(800);
394     bbSetInputWinDialog(false);
395     bbSetOutputWidget(0);
396
397     bbSetWidgetEventHandler(0);
398     bbSetUpdateTransferedToParent(false);
399   }
400   //=========================================================================
401
402   //=========================================================================
403   /// Main processing method of the box.
404   void WxBlackBox::bbExecute(bool force)
405   {
406     bbtkDebugMessageInc("process",2,
407                         "=> WxBlackBox::bbExecute() ["
408                         <<bbGetFullName()<<"]"<<std::endl);
409
410     // If the output 'Widget' is connected then 
411     // we must execute the parent box
412     BlackBox::OutputConnectorMapType::const_iterator i 
413       = bbGetOutputConnectorMap().find("Widget");
414
415     if ( i->second->GetConnectionVector().size() != 0 ) 
416       {
417         bbtkDebugMessage("process",3,
418                          "-> Output 'Widget' connected : transfering execution to parent"
419                          <<std::endl);
420         
421         i->second->GetConnectionVector().front() //.lock()
422           ->GetBlackBoxTo()->bbExecute(force);
423
424       }
425     // else call 'standard' BlackBox execution method
426     else 
427       {
428         BlackBox::bbExecute(force);
429       }
430     //
431
432     bbtkDebugMessageDec("process",2,
433                         "<= WxBlackBox::bbExecute() ["
434                         <<bbGetFullName()<<"]"<<std::endl);
435   }
436   //=========================================================================
437
438
439   //=========================================================================
440   /// Main processing method of the box.
441   IOStatus WxBlackBox::bbBackwardUpdate( Connection::Pointer caller )
442   {
443     bbtkDebugMessage("process",3,
444                      "=> WxBlackBox::bbBackwardUpdate("
445                      <<(caller?caller->GetFullName():"0")<<") ["
446                      <<bbGetFullName()<<"]"<<std::endl);
447     // If the caller's box to is not the box to connected to the 
448     // output 'Widget'
449     if ( ! (( bbGetStatus() == MODIFIED ) ||
450             ( bbBoxProcessModeIsAlways() )) )
451       {
452         bbtkDebugMessage("process",3,"Up-to-date : nothing to do"<<std::endl);
453         bbtkDebugMessage("process",3,
454                          "<= WxBlackBox::bbBackwardUpdate("
455                          <<(caller?caller->GetFullName():"0")<<") ["
456                          <<bbGetFullName()<<"]"<<std::endl);
457         return bbGetStatus();
458       }
459  
460     BlackBox::OutputConnectorMapType::const_iterator i 
461       = bbGetOutputConnectorMap().find("Widget") ;
462     if ( i->second->GetConnectionVector().size() != 0 )
463       
464       {
465         BlackBox::Pointer to = 
466           i->second->GetConnectionVector()[0]->GetBlackBoxTo();
467                 
468         if (caller) 
469           {
470             bbtkDebugMessage("process",3,
471                              "-> Output 'Widget' connected to '"
472                              <<to->bbGetFullName()<<"' - caller->to = '"
473                              <<caller->GetBlackBoxTo()->bbGetFullName()
474                              <<"'"
475                              <<std::endl);
476           }
477         else
478           {
479             bbtkDebugMessage("process",3,
480                              "-> Output 'Widget' connected to '"
481                              <<to->bbGetFullName()<<"'"
482                              <<std::endl);
483           }
484         if ((caller==0) ||
485             ((caller!=0) && 
486              (caller->GetBlackBoxTo() != to))&&
487             (!bbGetUpdateTransferedToParent())&&
488             (to->bbGetStatus()!=UPDATING))
489           {
490             bbtkDebugMessage("process",3,
491                              "   ... Transfering update order to parent"
492                              <<std::endl);
493             
494             bbSetUpdateTransferedToParent(true);
495             i->second->GetConnectionVector().front() //.lock()
496               ->GetBlackBoxTo()->bbExecute(false);
497           }
498         else
499           {
500             bbSetUpdateTransferedToParent(false);
501             bbtkDebugMessage("process",3,
502                              "   ... No need to transfer to parent"
503                              <<std::endl);
504           }
505       }
506     /*    
507
508     // If the caller is not the connection to the output widget
509     // and the output 'Widget' is connected then 
510     // we must execute the parent box 
511     // but only one time 
512     // (this is the role of the flag UpdateTransferedToParent)
513     if ( (caller==0) ||
514          ((caller!=0)&&(caller->GetBlackBoxFromOutput()!="Widget"))
515          )
516       {
517       }
518     */
519     // call 'standard' BlackBox execution method
520     if (!bbGetUpdateTransferedToParent()) 
521       { 
522           AtomicBlackBox::bbBackwardUpdate(caller);
523       }
524     
525     bbtkDebugMessageDec("process",3,
526                         "<= WxBlackBox::bbBackwardUpdate() ["
527                         <<bbGetFullName()<<"]"<<std::endl);
528     
529    return bbGetStatus();
530      
531
532   }
533
534   //=========================================================================
535   void WxBlackBox::bbProcess()
536   { 
537     if (bbGetOutputWidget()==0) this->bbUserCreateWidget();
538     this->bbUserProcess(); 
539     bbShowWindow();
540     //    this->bbUserOnShow();
541   }
542   //=========================================================================
543   
544   //==================================================================
545   /// Specific methods for window creation during pipeline execution
546   /// Shows the window associated to the box 
547   /// (called after bbProcess during bbExecute)
548   void WxBlackBox::bbShowWindow()
549   {
550     bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbShowWindow() ["
551                         <<bbGetFullName()<<"]"<<std::endl);
552  
553     // If Event Handler for the widget does not exist or is obsolete : create it 
554     if (bbGetOutputWidget()!=0)
555       {
556         if (bbGetWidgetEventHandler()==0)
557           {
558             bbtkDebugMessage("wx",3,
559                              "-> No widget event handler : creating one"
560                              <<std::endl);
561             new WxBlackBoxWidgetEventHandler(GetThisPointer<WxBlackBox>(),
562                                              bbGetOutputWidget());
563           }
564         else if ( ! bbGetWidgetEventHandler()->IsHandlerOf 
565                   ( bbGetOutputWidget() ) )
566           {
567             bbtkDebugMessage("wx",3,
568                              "-> Obsolete widget event handler : re-creating one"
569                              <<std::endl);
570             delete bbGetWidgetEventHandler();
571             new WxBlackBoxWidgetEventHandler(GetThisPointer<WxBlackBox>(),
572                                              bbGetOutputWidget());
573           }
574         // Sets the name of the wxWindow to the input WinTitle
575         bbGetOutputWidget()->SetName(bbtk::std2wx(bbGetInputWinTitle()));
576       }
577
578     // If the output 'Widget' is connected then it's gonna 
579     // be captured by its parent window : nothing to do 
580     if ( (*bbGetOutputConnectorMap().find("Widget")).second
581          ->GetConnectionVector().size() != 0 ) 
582       {
583         
584         bbtkDebugMessage("wx",2,
585                          "-> Output 'Widget' connected : nothing to do"
586                          <<std::endl);
587         return;
588       }
589
590
591     Window* show = 0;
592     // If the window already exists : no need creating it
593     if (bbGetWindow()!=0)
594       {
595         bbtkDebugMessage("wx",2,
596                          "-> Window already exists"
597                          <<std::endl);
598         show = bbGetWindow();
599       }
600     // Else if the widget exists : create window 
601     else if (bbGetOutputWidget()!=0) 
602       {
603         bbtkDebugMessage("wx",2,
604                          "-> Widget exists : creating the window"
605                          <<std::endl);
606
607
608         // Input WinDialog set to true : creating a Dialog
609         if (bbGetInputWinDialog()) 
610           {
611             bbtkDebugMessage("wx",2,
612                              "   Input WinDialog set to true : creating a Dialog"
613                              <<std::endl);
614             show = (Window*) new WxBlackBoxDialog( GetThisPointer<WxBlackBox>(),
615                                                    bbGetWxParent(), 
616                                                    std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"),
617                                                    wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
618           }
619         // Input WinDialog set to false : creating a Frame
620         else 
621           {
622             bbtkDebugMessage("process",2,
623                              "   Input WinDialog set to false : creating a Frame"
624                              <<std::endl);
625             show = (Window*) new WxBlackBoxFrame( GetThisPointer<WxBlackBox>(),
626                                                   bbGetWxParent(), 
627                                                   std2wx( bbGetInputWinTitle()  + " - bbtk (c) CREATIS LRMN"),
628                                                   wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
629           }
630
631       }
632     // No window nor widget : error
633     else
634       {
635         bbtkError("WxBlackBox::bbShowWindow() ["
636                   <<bbGetFullName()
637                   <<"] : No widget. Did you set the box output 'Widget' in the processing method of the box ?");
638       }
639  
640     
641     // Show the window
642     if (true) //!show->IsShown())
643       {
644         show->bbShow(); 
645       }
646     else 
647       {
648         bbtkDebugMessage("wx",2,"-> Already shown : nothing to do"<<std::endl);
649       }
650   
651
652     bbtkDebugMessage("wx",1,"<= WxBlackBox::bbShowWindow() ["
653                         <<bbGetFullName()<<"]"<<std::endl);
654
655   }
656   //==================================================================
657
658
659
660
661   //==================================================================
662    void WxBlackBox::bbHideWindow()
663   {
664     bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbHideWindow() ["
665                         <<bbGetFullName()<<"]"<<std::endl);
666
667     if (bbGetWindow()!=0) bbGetWindow()->bbHide();
668
669     bbtkDebugMessageDec("wx",1,"<= WxBlackBox::bbHideWindow() ["
670                         <<bbGetFullName()<<"]"<<std::endl);
671   }
672   //==================================================================
673
674
675   //==================================================================
676    void WxBlackBox::bbCloseWindow()
677   {
678     bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbCloseWindow() ["
679                         <<bbGetFullName()<<"]"<<std::endl);
680
681     if (bbGetWindow()!=0) bbGetWindow()->bbClose();
682
683     bbtkDebugMessageDec("wx",1,"<= WxBlackBox::bbCloseWindow() ["
684                         <<bbGetFullName()<<"]"<<std::endl);
685   }
686   //==================================================================
687
688   //==================================================================
689   WxBlackBox::Window* WxBlackBox::bbGetContainingWindow()
690   {
691     if (bbGetWindow()!=0) return bbGetWindow();
692     BlackBox::OutputConnectorMapType::const_iterator i 
693       = bbGetOutputConnectorMap().find("Widget");
694     if ( i->second->GetConnectionVector().size() != 0 ) 
695       {
696         return boost::static_pointer_cast<WxBlackBox>
697           (i->second->GetConnectionVector().front() //.lock()
698            ->GetBlackBoxTo())->bbGetContainingWindow();
699       }
700     return 0;
701   }
702   //==================================================================
703
704
705   //==================================================================
706   wxWindow* WxBlackBox::bbGetWxParent() { return Wx::GetTopWindow(); }
707   //==================================================================
708   
709   
710   //==================================================================
711   bool WxBlackBox::bbIsShown()
712   {
713     if (bbGetContainingWindow()!=0)
714       return bbGetContainingWindow()->bbIsShown();
715     return false;
716   }
717   //==================================================================
718
719
720 }//namespace bbtk
721
722
723 #endif
724