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