2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbtkQt.h,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.3 $
34 =========================================================================*/
38 #ifndef __bbtkQt_h_INCLUDED__
39 #define __bbtkQt_h_INCLUDED__
41 //===========================================================================
42 // SIGNAL/SLOT MECHANISM
43 // FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION
45 #include <boost/signals2/signal.hpp>
46 #include <boost/bind.hpp>
47 //typedef boost::signals2::signal::trackable SignalObserver;
49 //===========================================================================
52 //===========================================================================
62 typedef void QBusyCursor;
64 #endif // EO USE_WXWIDGETS
65 //===========================================================================
67 //===========================================================================
68 #include "bbtkSystem.h"
69 //===========================================================================
75 //==================================================================
76 /// Global qt handlers (cursor...)
79 #define bbtkAddQtSignalObserver(METHOD) \
80 Qt::AddSignalObserver(boost::bind(&METHOD, this))
83 #define BBTK_BUSY_CURSOR bbtk::Qt::BusyCursor __bbtk_dummy_busy_cursor;
89 // The keyword 'signals' is also a macro in qt
90 // typedef boost::signals::trackable SignalObserver;
91 typedef boost::signals2::signal<void ()> Signal_type;
92 typedef Signal_type::slot_function_type Slot_function_type;
96 static void ResetCursor();
97 static void BeginBusyCursor();
98 static void EndBusyCursor();
101 static void LoopUntilAllWindowsClose();
108 //wxBusyCursor* mCursor;
111 static void SetTopWindowParent(QWidget*);
112 static void SetAutoDestroyTopWindow(bool);
114 /// Returns the creation time parent of all bbtk windows
115 /// (window can be reparented after creation)
116 static QWidget* GetTopWindow();
117 static bool TopWindowExists();
119 static void IncNbWindowsAlive();
120 static void DecNbWindowsAlive();
121 static int GetNbWindowsAlive();
122 static bool IsSomeWindowAlive();
124 static void IncNbWindowsShown();
125 static void DecNbWindowsShown();
126 static int GetNbWindowsShown();
127 static bool IsSomeWindowShown();
130 static void AddSignalObserver(Slot_function_type);
135 static void CreateQtAppIfNeeded();
136 static void DestroyQtAppIfNeeded();
139 static void CreateTopWindowIfNeeded();
140 static void DestroyTopWindowIfNeeded();
142 /// Sets the creation time parent of all bbtk windows
143 static void SetTopWindow(QWidget*);
145 //==================================================================
155 #endif // EO __bbtkQt_h_INCLUDED__