]> Creatis software - bbtk.git/blob - kernel/src/bbtkKW.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkKW.h
1 /*=========================================================================                                                                               
2   Program:   bbtk
3   Module:    $RCSfile: bbtkKW.h,v $
4   Language:  C++
5   Date:      $Date: 2008/11/29 21:41:33 $
6   Version:   $Revision: 1.1 $
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
14 *  This software is governed by the CeCILL-B license under French law and 
15 *  abiding by the rules of distribution of free software. You can  use, 
16 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
17 *  license as circulated by CEA, CNRS and INRIA at the following URL 
18 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
19 *  or in the file LICENSE.txt.
20 *
21 *  As a counterpart to the access to the source code and  rights to copy,
22 *  modify and redistribute granted by the license, users are provided only
23 *  with a limited warranty  and the software's author,  the holder of the
24 *  economic rights,  and the successive licensors  have only  limited
25 *  liability. 
26 *
27 *  The fact that you are presently reading this means that you have had
28 *  knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
30
31 #ifndef __bbtkKW_h_INCLUDED__
32 #define __bbtkKW_h_INCLUDED__
33
34 //===========================================================================
35 #ifdef USE_KWWIDGETS
36
37
38 // KW headers
39 //#include <vtkKWWidget.h>
40 //#include <vtkKWWindowBase.h>
41
42
43
44 //===========================================================================
45
46 //===========================================================================
47 #include "bbtkSystem.h"
48 #include "vtkKWApplication.h"
49 //===========================================================================
50
51 //===========================================================================
52 // SIGNAL/SLOT MECHANISM 
53 // FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 
54 // BBTKKWSIG
55 #include <boost/signal.hpp>
56 #include <boost/bind.hpp>
57 // \BBTKKWSIG
58 //===========================================================================
59
60 namespace bbtk
61 {
62
63   //==================================================================
64   /// Global KWWidgets handlers (application, cursor...)
65   
66 // BBTKKWSIG
67 #define bbtkAddKWSignalObserver(METHOD)         \
68   KW::AddSignalObserver(boost::bind(&METHOD, this))
69 // \BBTKKWSIG
70
71 #define BBTK_KW_BUSY_CURSOR bbtk::KW::BusyCursor __bbtk_dummy_busy_cursor;
72
73   struct BBTK_EXPORT KW
74   {     
75   public:
76     // BBTKKWSIG
77     typedef boost::signals::trackable SignalObserver;
78     typedef boost::signal<void ()>  Signal_type;
79     typedef Signal_type::slot_function_type Slot_function_type;
80     // \BBTKKWSIG
81     
82     static vtkKWApplication* GetApplication();
83     
84     /*
85     static void ResetCursor();
86     static void BeginBusyCursor(); 
87     static void EndBusyCursor();
88     */
89
90     //    static void LoopUntilAllWindowsClose();
91
92     class BusyCursor
93     {
94     public:
95       BusyCursor();
96       ~BusyCursor();
97       //      wxBusyCursor* mCursor;
98     };
99
100     //    static void SetTopWindowParent(vtkKWWidget*);
101     static void SetAutoDestroyTopWindow(bool);
102
103     /// Returns the creation time parent of all bbtk windows 
104     /// (window can be reparented after creation)
105     //    static vtkKWWindowBase* GetTopWindow();
106     //    static bool TopWindowExists();
107     
108     static void IncNbWindowsAlive();
109     static void DecNbWindowsAlive();
110     static int  GetNbWindowsAlive();
111     static bool IsSomeWindowAlive();
112     
113     static void IncNbWindowsShown();
114     static void DecNbWindowsShown();
115     static int  GetNbWindowsShown();
116     static bool IsSomeWindowShown();
117
118     // BBTKKWSIG
119     static void AddSignalObserver(Slot_function_type);
120     // \BBTKKWSIG
121     
122   private:
123     
124     static void CreateKWAppIfNeeded();
125     static void DestroyKWAppIfNeeded();
126     
127     //    static void CreateTopWindowIfNeeded();
128     //    static void DestroyTopWindowIfNeeded();
129     
130     /// Sets the creation time parent of all bbtk windows
131     //    static void SetTopWindow(vtkKWWindowBase*);
132     
133   }; 
134   // struct KW
135   //==================================================================
136   
137
138
139   
140 } // namespace bbtk
141   
142 #endif // EO USE_KWWIDGETS
143 #endif // EO __bbtkKW_h_INCLUDED__