if (help_on_script) bbtk::HelpBlackBox("workspace",false);
- if (!(command || bbtk::WxBlackBox::bbGlobalIsSomeWindowShown() ))
+ if (!(command || bbtk::Wx::IsSomeWindowShown() ))
{
I->Close();
}
Program: bbtk
Module: $RCSfile: bbtkBlackBox.cxx,v $
Language: C++
-Date: $Date: 2008/02/05 13:23:46 $
-Version: $Revision: 1.2 $
+Date: $Date: 2008/02/08 10:05:38 $
+Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
"=> BlackBox::bbExecute() ["
<<bbGetFullName()<<"]"<<std::endl);
- wx::BeginBusyCursor();
+ Wx::BeginBusyCursor();
// If execution frozen : return
if (bbGlobalGetFreezeExecution())
// Calls the main recursive update method
bbBackwardUpdate(0);
- wx::EndBusyCursor();
+ Wx::EndBusyCursor();
bbtkDebugMessageDec("Process",1,
"<= BlackBox::bbExecute() ["
{
return ( bbGlobalGetSomeBoxExecuting()
#ifdef _USE_WXWIDGETS_
- || WxBlackBox::bbGlobalIsSomeWindowAlive()
+ || Wx::IsSomeWindowAlive()
#endif
);
}
Program: bbtk
Module: $RCSfile: bbtkComplexBlackBox.cxx,v $
Language: C++
-Date: $Date: 2008/02/06 10:53:02 $
-Version: $Revision: 1.3 $
+Date: $Date: 2008/02/08 10:05:38 $
+Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
"ComplexBlackBox::bbExecute() ["
<<bbGetFullName()<<"]"<<std::endl);
- wx::BeginBusyCursor();
+ Wx::BeginBusyCursor();
if (mExecutionList.size() != 0)
{
}
}
- wx::EndBusyCursor();
+ Wx::EndBusyCursor();
bbtkDebugDecTab("Process",1);
#define bbtkError(MESSAGE) \
do \
{ \
- bbtk::wx::ResetCursor(); \
+ bbtk::Wx::ResetCursor(); \
std::ostringstream s; \
s << MESSAGE; \
std::ostringstream f; \
namespace bbtk
{
- void wx::ResetCursor()
+ void Wx::ResetCursor()
{
+ if (!GetTopWindow()) return;
bbtkDebugMessage("Wx",9,"wx::ResetCursor()"<<std::endl);
while (wxIsBusy()) ::wxEndBusyCursor();
}
- void wx::BeginBusyCursor()
+ void Wx::BeginBusyCursor()
{
+ if (!GetTopWindow()) return;
bbtkDebugMessage("Wx",9,"wx::BeginBusyCursor()"<<std::endl);
::wxBeginBusyCursor();
}
- void wx::EndBusyCursor()
+ void Wx::EndBusyCursor()
{
+ if (!GetTopWindow()) return;
bbtkDebugMessage("Wx",9,"wx::EndBusyCursor()"<<std::endl);
::wxEndBusyCursor();
}
+ //=========================================================================
+ void Wx::SetTopWindow(wxWindow* w)
+ {
+ if ( mgTopWindow )
+ {
+ bbtkGlobalError("wx::SetTopWindow : top window already set !");
+ }
+ mgTopWindow = w;
+ }
+ //=========================================================================
+ //=========================================================================
+ void Wx::DecNbWindowsAlive()
+ {
+ mgNbWindowsAlive--;
+ /*
+ if ( (bbmgNbWindowsAlive==0) &&
+ bbmgTopWindow && (!bbmgTopWindow->IsShown()))
+ {
+ bbmgTopWindow->Close();
+ }
+ */
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void Wx::DecNbWindowsShown()
+ {
+ mgNbWindowsShown--;
+ if ( (mgNbWindowsShown==0) &&
+ mgTopWindow && (!mgTopWindow->IsShown()))
+ {
+ mgTopWindow->Close();
+ }
+ }
+ //=========================================================================
+
+ //=========================================================================
+ // Static members
+ wxWindow* Wx::mgTopWindow = 0;
+ int Wx::mgNbWindowsAlive = 0;
+ int Wx::mgNbWindowsShown = 0;
+ //=========================================================================
+
+
+
}
{
//==================================================================
/// Global wx handlers (cursor...)
-
- struct BBTK_EXPORT wx
- { public:
- static void ResetCursor();
- static void BeginBusyCursor();
- static void EndBusyCursor();
- static int mBeginBusyCallsCount;
- }; // struct wx
-//==================================================================
-
-
+
+ struct BBTK_EXPORT Wx
+ {
+ public:
+ static void ResetCursor();
+ static void BeginBusyCursor();
+ static void EndBusyCursor();
+ static int mBeginBusyCallsCount;
+
+ /// Returns the global parent of all bbtk windows
+ static wxWindow* GetTopWindow() { return mgTopWindow; }
+ /// Sets the global parent of all bbtk windows
+ static void SetTopWindow(wxWindow*);
+
+ static void IncNbWindowsAlive() { mgNbWindowsAlive++; }
+ static void DecNbWindowsAlive();
+ static int GetNbWindowsAlive() { return mgNbWindowsAlive; }
+ static bool IsSomeWindowAlive() { return (mgNbWindowsAlive>0);}
+
+ static void IncNbWindowsShown() { mgNbWindowsShown++; }
+ static void DecNbWindowsShown();
+ static int GetNbWindowsShown() { return mgNbWindowsShown; }
+ static bool IsSomeWindowShown() { return (mgNbWindowsShown>0);}
+
+ private:
+ static wxWindow* mgTopWindow;
+ static int mgNbWindowsAlive;
+ static int mgNbWindowsShown;
+
+ }; // struct Wx
+ //==================================================================
+
+
//==================================================================
/// Conversion std::string to wxString
inline wxString std2wx(const std::string& s){
namespace bbtk
{
- struct BBTK_EXPORT wx
- {
- static void ResetCursor() {}
- static void BeginBusyCursor() {}
- static void EndBusyCursor() {}
- }; // struct wx
+ struct BBTK_EXPORT Wx
+ {
+ static void ResetCursor() {}
+ static void BeginBusyCursor() {}
+ static void EndBusyCursor() {}
+ static wxWindow* GetTopWindow() { return 0; }
+ static void SetTopWindow(wxWindow*) {}
+ static void IncNbWindowsAlive() {}
+ static void DecNbWindowsAlive() {}
+ static int GetNbWindowsAlive() { return 0; }
+ static bool IsSomeWindowAlive() { return false; }
+
+ static void IncNbWindowsShown() {}
+ static void DecNbWindowsShown() {}
+ static int GetNbWindowsShown() { return 0; }
+ static bool IsSomeWindowShown() { return false; }
+ }; // struct Wx
} // namespace bbtk
Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.cxx,v $
Language: C++
- Date: $Date: 2008/02/07 07:58:54 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2008/02/08 10:05:38 $
+ Version: $Revision: 1.7 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace bbtk
{
- //=========================================================================
- wxWindow* WxBlackBox::bbGlobalGetTopWindow()
- {
- return bbmgTopWindow;
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBox::bbGlobalSetTopWindow(wxWindow* w)
- {
- if ( bbmgTopWindow )
- {
- bbtkGlobalError("WxBlackBox::bbGlobalSetTopWindow : top window already set !");
- }
- bbmgTopWindow = w;
- }
- //=========================================================================
-
-
- //=========================================================================
- void WxBlackBox::bbGlobalDecNbWindowsAlive()
- {
- bbmgNbWindowsAlive--;
- /*
- if ( (bbmgNbWindowsAlive==0) &&
- bbmgTopWindow && (!bbmgTopWindow->IsShown()))
- {
- bbmgTopWindow->Close();
- }
- */
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBox::bbGlobalDecNbWindowsShown()
- {
- bbmgNbWindowsShown--;
- if ( (bbmgNbWindowsShown==0) &&
- bbmgTopWindow && (!bbmgTopWindow->IsShown()))
- {
- bbmgTopWindow->Close();
- }
- }
- //=========================================================================
-
- //=========================================================================
- // Static members
- wxWindow* WxBlackBox::bbmgTopWindow =0;
- int WxBlackBox::bbmgNbWindowsAlive = 0;
- int WxBlackBox::bbmgNbWindowsShown = 0;
- //=========================================================================
-
-
bbtkDebugMessage("Wx",9,"WxBlackBoxWindow::WxBlackBoxWindow("<<
mBox->bbGetFullName()<<")"<<std::endl);
mBox->bbSetWindow(this);
- WxBlackBox::bbGlobalIncNbWindowsAlive();
+ Wx::IncNbWindowsAlive();
bbtkDebugMessage("Wx",9," -> Number of windows alive = "
- <<WxBlackBox::bbGlobalGetNbWindowsAlive()<<std::endl);
+ <<Wx::GetNbWindowsAlive()<<std::endl);
}
//=========================================================================
mBox->bbGetFullName()<<"]"<<std::endl);
bbHide();
mBox->bbSetWindow(0);
- WxBlackBox::bbGlobalDecNbWindowsAlive();
+ Wx::DecNbWindowsAlive();
bbtkDebugMessage("Wx",9," -> Number of windows alive = "
- <<WxBlackBox::bbGlobalGetNbWindowsAlive()<<std::endl);
+ <<Wx::GetNbWindowsAlive()<<std::endl);
}
if (bbIsShown()) return;
bbtkDebugMessage("Wx",9,"WxBlackBoxWindow::bbShow() ["<<
mBox->bbGetFullName()<<"]"<<std::endl);
- WxBlackBox::bbGlobalIncNbWindowsShown();
+ Wx::IncNbWindowsShown();
mShown = true;
bbtkDebugMessage("Wx",9," -> Number of windows shown = "
- <<WxBlackBox::bbGlobalGetNbWindowsShown()<<std::endl);
+ <<Wx::GetNbWindowsShown()<<std::endl);
}
//=========================================================================
if (!bbIsShown()) return;
bbtkDebugMessage("Wx",9,"WxBlackBoxWindow::bbHide() ["<<
mBox->bbGetFullName()<<"]"<<std::endl);
- WxBlackBox::bbGlobalDecNbWindowsShown();
+ Wx::DecNbWindowsShown();
mShown = false;
bbtkDebugMessage("Wx",9," -> Number of windows shown = "
- <<WxBlackBox::bbGlobalGetNbWindowsShown()<<std::endl);
+ <<Wx::GetNbWindowsShown()<<std::endl);
}
//=========================================================================
" Input WinDialog set to true : creating a Dialog"
<<std::endl);
show = (Window*) new WxBlackBoxDialog( this,
- bbGlobalGetTopWindow(),
+ Wx::GetTopWindow(),
std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"),
wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
}
" Input WinDialog set to false : creating a Frame"
<<std::endl);
show = (Window*) new WxBlackBoxFrame( this,
- bbGlobalGetTopWindow(),
+ Wx::GetTopWindow(),
std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"),
wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
}
Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.h,v $
Language: C++
- Date: $Date: 2008/02/07 07:58:54 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2008/02/08 10:05:38 $
+ Version: $Revision: 1.7 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Window* bbGetWindow() { return bbmWindow; }
/// Returns the Parent Window that must be used to create the widget
- wxWindow* bbGetWxParent() { return bbGlobalGetTopWindow(); }
+ wxWindow* bbGetWxParent() { return Wx::GetTopWindow(); }
- /// Returns the global parent of all bbtk windows
- static wxWindow* bbGlobalGetTopWindow();
- /// Sets the global parent of all bbtk windows
- static void bbGlobalSetTopWindow(wxWindow*);
-
- static void bbGlobalIncNbWindowsAlive() { WxBlackBox::bbmgNbWindowsAlive++; }
- static void bbGlobalDecNbWindowsAlive();
- static int bbGlobalGetNbWindowsAlive() { return WxBlackBox::bbmgNbWindowsAlive; }
- static bool bbGlobalIsSomeWindowAlive() { return (WxBlackBox::bbmgNbWindowsAlive>0);}
-
- static void bbGlobalDecNbWindowsShown();
- static void bbGlobalIncNbWindowsShown() { WxBlackBox::bbmgNbWindowsShown++; }
- static int bbGlobalGetNbWindowsShown() { return WxBlackBox::bbmgNbWindowsShown; }
- static bool bbGlobalIsSomeWindowShown() { return (WxBlackBox::bbmgNbWindowsShown>0);}
-
-
- private:
- static wxWindow* bbmgTopWindow;
- static int bbmgNbWindowsAlive;
- static int bbmgNbWindowsShown;
-
+
protected:
Program: bbtk
Module: $RCSfile: bbtkWxConsole.cxx,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/02/08 10:05:38 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
new WxTextCtrlStreamRedirector(std::cerr,mwxTextHistory,*wxGREEN,true);
// Sets the console as the parent window of all bbtk windows
- WxBlackBox::bbGlobalSetTopWindow(this);
+ Wx::SetTopWindow(this);
// Layout