bbtk::Wx Struct Reference

#include <bbtkWx.h>

List of all members.

Public Types

typedef boost::signals::trackable SignalObserver
typedef boost::signal< void()> Signal_type
typedef
Signal_type::slot_function_type 
Slot_function_type

Static Public Member Functions

static void LoopUntilAllWindowsClose ()
static void SetTopWindowParent (wxWindow *)
static void SetAutoDestroyTopWindow (bool)
static wxWindow * GetTopWindow ()
static bool TopWindowExists ()
static void IncNbWindowsAlive ()
static void DecNbWindowsAlive ()
static int GetNbWindowsAlive ()
static bool IsSomeWindowAlive ()
static void IncNbWindowsShown ()
static void DecNbWindowsShown ()
static int GetNbWindowsShown ()
static bool IsSomeWindowShown ()
static void AddSignalObserver (Slot_function_type)

Static Private Member Functions

static void CreateWxAppIfNeeded ()
static void DestroyWxAppIfNeeded ()
static void CreateTopWindowIfNeeded ()
static void DestroyTopWindowIfNeeded ()
static void SetTopWindow (wxWindow *)
 Sets the creation time parent of all bbtk windows.

Classes

class  BusyCursor


Detailed Description

Definition at line 113 of file bbtkWx.h.


Member Typedef Documentation

typedef boost::signals::trackable bbtk::Wx::SignalObserver

Definition at line 117 of file bbtkWx.h.

typedef boost::signal<void ()> bbtk::Wx::Signal_type

Definition at line 118 of file bbtkWx.h.

typedef Signal_type::slot_function_type bbtk::Wx::Slot_function_type

Definition at line 119 of file bbtkWx.h.


Member Function Documentation

void bbtk::Wx::LoopUntilAllWindowsClose (  )  [static]

Definition at line 158 of file bbtkWx.cxx.

References bbtkDebugMessage, bbtk::i, and bbtk::mgTopWindow.

00159   {
00160     int i = 0;
00161     while (mgTopWindow != 0)
00162       {
00163         if (i % 100 == 0) 
00164           {
00165             bbtkDebugMessage("wx",2,"Wx::Loop "<<i << std::endl);
00166           }
00167         i++;
00168         wxMilliSleep(10);
00169 
00170       }
00171   }

void bbtk::Wx::SetTopWindowParent ( wxWindow *  w  )  [static]

Definition at line 114 of file bbtkWx.cxx.

References bbtkGlobalError, and bbtk::mgTopWindowParent.

00115   {
00116     if (mgTopWindowParent != 0)
00117       {
00118         bbtkGlobalError("Wx::SetTopWindowParent : top window parent != 0");
00119       }
00120     mgTopWindowParent = w;
00121   }

void bbtk::Wx::SetAutoDestroyTopWindow ( bool  b  )  [static]

Definition at line 199 of file bbtkWx.cxx.

References bbtk::mgAutoDestroyTopWindow.

00200   {
00201     mgAutoDestroyTopWindow = b;
00202   }

wxWindow * bbtk::Wx::GetTopWindow (  )  [static]

Returns the creation time parent of all bbtk windows (window can be reparented after creation)

Definition at line 175 of file bbtkWx.cxx.

References bbtk::mgTopWindow.

00176   { 
00177     Wx::CreateTopWindowIfNeeded();
00178     return mgTopWindow; 
00179   }

bool bbtk::Wx::TopWindowExists (  )  [static]

Definition at line 183 of file bbtkWx.cxx.

References bbtk::mgTopWindow.

00184   {
00185     return (mgTopWindow!=0);
00186   }

void bbtk::Wx::IncNbWindowsAlive (  )  [static]

Definition at line 218 of file bbtkWx.cxx.

References bbtkDebugMessage, bbtk::mgNbWindowsAlive, and bbtk::mgWxSignal.

00219   { 
00220     mgNbWindowsAlive++; 
00221     bbtkDebugMessage("wx",2,"* Number of windows alive = "<<mgNbWindowsAlive
00222                      <<std::endl);
00223     // BBTKWXSIG
00224     mgWxSignal();
00225     // \BBTKWXSIG
00226   }

void bbtk::Wx::DecNbWindowsAlive (  )  [static]

Definition at line 230 of file bbtkWx.cxx.

References bbtkDebugMessage, DestroyTopWindowIfNeeded(), bbtk::mgNbWindowsAlive, and bbtk::mgWxSignal.

00231   { 
00232     mgNbWindowsAlive--; 
00233     bbtkDebugMessage("wx",2,"* Number of windows alive = "<<mgNbWindowsAlive
00234                      <<std::endl);
00235 
00236     DestroyTopWindowIfNeeded();
00237      // BBTKWXSIG
00238     mgWxSignal();
00239     // \BBTKWXSIG
00240   }

Here is the call graph for this function:

int bbtk::Wx::GetNbWindowsAlive (  )  [static]

Definition at line 272 of file bbtkWx.cxx.

References bbtk::mgNbWindowsAlive.

00273   { 
00274     return mgNbWindowsAlive; 
00275   }

bool bbtk::Wx::IsSomeWindowAlive (  )  [static]

Definition at line 279 of file bbtkWx.cxx.

References bbtk::mgNbWindowsAlive.

00280   { 
00281     return (mgNbWindowsAlive>0);
00282   }

void bbtk::Wx::IncNbWindowsShown (  )  [static]

Definition at line 244 of file bbtkWx.cxx.

References bbtkDebugMessage, bbtk::mgNbWindowsShown, and bbtk::mgWxSignal.

00245   { 
00246     mgNbWindowsShown++; 
00247     bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
00248                      <<std::endl);
00249     // BBTKWXSIG
00250     mgWxSignal();
00251     // \BBTKWXSIG
00252   }

void bbtk::Wx::DecNbWindowsShown (  )  [static]

Definition at line 256 of file bbtkWx.cxx.

References bbtkDebugMessage, DestroyTopWindowIfNeeded(), bbtk::mgNbWindowsShown, and bbtk::mgWxSignal.

00257   { 
00258     mgNbWindowsShown--; 
00259     bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
00260                      <<std::endl);
00261 
00262     DestroyTopWindowIfNeeded();
00263 
00264     // BBTKWXSIG
00265     mgWxSignal();
00266     // \BBTKWXSIG
00267   }

Here is the call graph for this function:

int bbtk::Wx::GetNbWindowsShown (  )  [static]

Definition at line 287 of file bbtkWx.cxx.

References bbtk::mgNbWindowsShown.

00288   { 
00289     return mgNbWindowsShown; 
00290   }

bool bbtk::Wx::IsSomeWindowShown (  )  [static]

Definition at line 294 of file bbtkWx.cxx.

References bbtk::mgNbWindowsShown.

00295   { 
00296     return (mgNbWindowsShown>0);
00297   }

void bbtk::Wx::AddSignalObserver ( Slot_function_type  f  )  [static]

Definition at line 191 of file bbtkWx.cxx.

References bbtk::mgWxSignal.

00192   {
00193     mgWxSignal.connect(f);
00194   }

void bbtk::Wx::CreateWxAppIfNeeded (  )  [static, private]

Definition at line 81 of file bbtkWx.cxx.

References bbtkDebugMessage, bbtkGlobalError, and bbtk::mgWxApp.

Referenced by CreateTopWindowIfNeeded().

00082   {
00083     if (wxApp::GetInstance()==0)
00084       {
00085         if (mgWxApp != 0) 
00086           {
00087             bbtkGlobalError("Wx::CreateWxAppIfNeeded() : INTERNAL ERROR ! (wxApp::GetInstance()==0) && (mgWxApp != 0)");
00088           }
00089         bbtkDebugMessage("wx",1,"  --> Creating bbtk wxApp"<<std::endl);
00090         mgWxApp = new WxApp;
00091         wxApp::SetInstance(mgWxApp);
00092         //int argc = 0;
00093         //wxEntry(argc,0);
00094         wxInitialize();
00095       } 
00096   }

Here is the caller graph for this function:

void bbtk::Wx::DestroyWxAppIfNeeded (  )  [static, private]

Definition at line 100 of file bbtkWx.cxx.

References bbtkDebugMessage, and bbtk::mgWxApp.

Referenced by DestroyTopWindowIfNeeded().

00101   {
00102     if (mgWxApp!= 0) 
00103       {
00104         bbtkDebugMessage("wx",1,"  --> Destructing bbtk WxApp"<<std::endl);
00105         //delete mgWxApp;
00106         //      mgWxApp = 0;
00107         // Uninit wx
00108         //      wxUninitialize();
00109       }
00110   }

Here is the caller graph for this function:

void bbtk::Wx::CreateTopWindowIfNeeded (  )  [static, private]

Definition at line 125 of file bbtkWx.cxx.

References _T, bbtkDebugMessage, CreateWxAppIfNeeded(), bbtk::mgTopWindow, and bbtk::mgTopWindowParent.

00126   {
00127     if (mgTopWindow!=0) return;
00128     bbtkDebugMessage("wx",1,"  --> Creating bbtk top window"<<std::endl);
00129 
00130     CreateWxAppIfNeeded();
00131 
00132     wxWindow* top = 
00133       new wxFrame(mgTopWindowParent,
00134                   -1,
00135                   _T("TOP BBTK FRAME (YOU SHOULD NOT SEE ME !!)"));
00136     top->Hide();
00137 
00138     Wx::SetTopWindow(top);
00139   }

Here is the call graph for this function:

void bbtk::Wx::DestroyTopWindowIfNeeded (  )  [static, private]

Definition at line 143 of file bbtkWx.cxx.

References bbtkDebugMessage, DestroyWxAppIfNeeded(), bbtk::mgAutoDestroyTopWindow, bbtk::mgNbWindowsAlive, and bbtk::mgTopWindow.

Referenced by DecNbWindowsAlive(), and DecNbWindowsShown().

00144   {
00145     if ( (mgNbWindowsAlive==0) && 
00146          (mgAutoDestroyTopWindow) )
00147       {
00148         bbtkDebugMessage("wx",1,"  --> Destructing bbtk top window"<<std::endl);
00149         mgTopWindow->Close();
00150         mgTopWindow = 0;
00151         
00152         DestroyWxAppIfNeeded();
00153       }
00154   } 

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Wx::SetTopWindow ( wxWindow *  w  )  [static, private]

Sets the creation time parent of all bbtk windows.

Definition at line 206 of file bbtkWx.cxx.

References bbtkGlobalError, and bbtk::mgTopWindow.

00207   {
00208     if ( mgTopWindow ) 
00209       {
00210         bbtkGlobalError("wx::SetTopWindow : top window already set !");
00211       } 
00212     mgTopWindow = w;
00213   }


The documentation for this struct was generated from the following files:

Generated on Wed Nov 12 11:38:53 2008 for BBTK by  doxygen 1.5.6