1 /*=========================================================================
3 Module: $RCSfile: bbtkQt.h,v $
5 Date: $Date: 2009/04/08 07:56:11 $
6 Version: $Revision: 1.1 $
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
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.
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
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 * ------------------------------------------------------------------------ */
32 /* ---------------------------------------------------------------------
34 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
35 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
37 * This software is governed by the CeCILL-B license under French law and
38 * abiding by the rules of distribution of free software. You can use,
39 * modify and/ or redistribute the software under the terms of the CeCILL-B
40 * license as circulated by CEA, CNRS and INRIA at the following URL
41 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
42 * or in the file LICENSE.txt.
44 * As a counterpart to the access to the source code and rights to copy,
45 * modify and redistribute granted by the license, users are provided only
46 * with a limited warranty and the software's author, the holder of the
47 * economic rights, and the successive licensors have only limited
50 * The fact that you are presently reading this means that you have had
51 * knowledge of the CeCILL-B license and that you accept its terms.
52 * ------------------------------------------------------------------------ */
55 #ifndef __bbtkQt_h_INCLUDED__
56 #define __bbtkQt_h_INCLUDED__
58 //===========================================================================
59 // SIGNAL/SLOT MECHANISM
60 // FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION
62 #include <boost/signal.hpp>
63 #include <boost/bind.hpp>
64 typedef boost::signals::trackable SignalObserver;
66 //===========================================================================
69 //===========================================================================
79 typedef void QBusyCursor;
81 #endif // EO USE_WXWIDGETS
82 //===========================================================================
84 //===========================================================================
85 #include "bbtkSystem.h"
86 //===========================================================================
92 //==================================================================
93 /// Global qt handlers (cursor...)
96 #define bbtkAddQtSignalObserver(METHOD) \
97 Qt::AddSignalObserver(boost::bind(&METHOD, this))
100 #define BBTK_BUSY_CURSOR bbtk::Qt::BusyCursor __bbtk_dummy_busy_cursor;
102 struct BBTK_EXPORT Qt
106 // The keyword 'signals' is also a macro in qt
107 // typedef boost::signals::trackable SignalObserver;
108 typedef boost::signal<void ()> Signal_type;
109 typedef Signal_type::slot_function_type Slot_function_type;
113 static void ResetCursor();
114 static void BeginBusyCursor();
115 static void EndBusyCursor();
118 static void LoopUntilAllWindowsClose();
125 //wxBusyCursor* mCursor;
128 static void SetTopWindowParent(QWidget*);
129 static void SetAutoDestroyTopWindow(bool);
131 /// Returns the creation time parent of all bbtk windows
132 /// (window can be reparented after creation)
133 static QWidget* GetTopWindow();
134 static bool TopWindowExists();
136 static void IncNbWindowsAlive();
137 static void DecNbWindowsAlive();
138 static int GetNbWindowsAlive();
139 static bool IsSomeWindowAlive();
141 static void IncNbWindowsShown();
142 static void DecNbWindowsShown();
143 static int GetNbWindowsShown();
144 static bool IsSomeWindowShown();
147 static void AddSignalObserver(Slot_function_type);
152 static void CreateQtAppIfNeeded();
153 static void DestroyQtAppIfNeeded();
156 static void CreateTopWindowIfNeeded();
157 static void DestroyTopWindowIfNeeded();
159 /// Sets the creation time parent of all bbtk windows
160 static void SetTopWindow(QWidget*);
162 //==================================================================
172 #endif // EO __bbtkQt_h_INCLUDED__