00001 /*========================================================================= 00002 Program: bbtk 00003 Module: $RCSfile: bbtkKW.h,v $ 00004 Language: C++ 00005 Date: $Date: 2008/11/29 21:41:33 $ 00006 Version: $Revision: 1.1 $ 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 #ifndef __bbtkKW_h_INCLUDED__ 00032 #define __bbtkKW_h_INCLUDED__ 00033 00034 //=========================================================================== 00035 #ifdef USE_KWWIDGETS 00036 00037 00038 // KW headers 00039 //#include <vtkKWWidget.h> 00040 //#include <vtkKWWindowBase.h> 00041 00042 00043 00044 //=========================================================================== 00045 00046 //=========================================================================== 00047 #include "bbtkSystem.h" 00048 #include "vtkKWApplication.h" 00049 //=========================================================================== 00050 00051 //=========================================================================== 00052 // SIGNAL/SLOT MECHANISM 00053 // FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 00054 // BBTKKWSIG 00055 #include <boost/signal.hpp> 00056 #include <boost/bind.hpp> 00057 // \BBTKKWSIG 00058 //=========================================================================== 00059 00060 namespace bbtk 00061 { 00062 00063 //================================================================== 00065 00066 // BBTKKWSIG 00067 #define bbtkAddKWSignalObserver(METHOD) \ 00068 KW::AddSignalObserver(boost::bind(&METHOD, this)) 00069 // \BBTKKWSIG 00070 00071 #define BBTK_KW_BUSY_CURSOR bbtk::KW::BusyCursor __bbtk_dummy_busy_cursor; 00072 00073 struct BBTK_EXPORT KW 00074 { 00075 public: 00076 // BBTKKWSIG 00077 typedef boost::signals::trackable SignalObserver; 00078 typedef boost::signal<void ()> Signal_type; 00079 typedef Signal_type::slot_function_type Slot_function_type; 00080 // \BBTKKWSIG 00081 00082 static vtkKWApplication* GetApplication(); 00083 00084 /* 00085 static void ResetCursor(); 00086 static void BeginBusyCursor(); 00087 static void EndBusyCursor(); 00088 */ 00089 00090 // static void LoopUntilAllWindowsClose(); 00091 00092 class BusyCursor 00093 { 00094 public: 00095 BusyCursor(); 00096 ~BusyCursor(); 00097 // wxBusyCursor* mCursor; 00098 }; 00099 00100 // static void SetTopWindowParent(vtkKWWidget*); 00101 static void SetAutoDestroyTopWindow(bool); 00102 00105 // static vtkKWWindowBase* GetTopWindow(); 00106 // static bool TopWindowExists(); 00107 00108 static void IncNbWindowsAlive(); 00109 static void DecNbWindowsAlive(); 00110 static int GetNbWindowsAlive(); 00111 static bool IsSomeWindowAlive(); 00112 00113 static void IncNbWindowsShown(); 00114 static void DecNbWindowsShown(); 00115 static int GetNbWindowsShown(); 00116 static bool IsSomeWindowShown(); 00117 00118 // BBTKKWSIG 00119 static void AddSignalObserver(Slot_function_type); 00120 // \BBTKKWSIG 00121 00122 private: 00123 00124 static void CreateKWAppIfNeeded(); 00125 static void DestroyKWAppIfNeeded(); 00126 00127 // static void CreateTopWindowIfNeeded(); 00128 // static void DestroyTopWindowIfNeeded(); 00129 00131 // static void SetTopWindow(vtkKWWindowBase*); 00132 00133 }; 00134 // struct KW 00135 //================================================================== 00136 00137 00138 00139 00140 } // namespace bbtk 00141 00142 #endif // EO USE_KWWIDGETS 00143 #endif // EO __bbtkKW_h_INCLUDED__