X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkWidgetBlackBox.h;fp=kernel%2Fsrc%2FbbtkWidgetBlackBox.h;h=20dc069fae3d79f174516989aea5db71bb3420d3;hb=8c690fedb5ea897b6a69584e1e237cb5dbad97a5;hp=03601b1db8b76abea4d083c8e928b1f5941f7143;hpb=ed1e038b4fab37ba9229f70535a73c2c80234002;p=bbtk.git diff --git a/kernel/src/bbtkWidgetBlackBox.h b/kernel/src/bbtkWidgetBlackBox.h index 03601b1..20dc069 100644 --- a/kernel/src/bbtkWidgetBlackBox.h +++ b/kernel/src/bbtkWidgetBlackBox.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkWidgetBlackBox.h,v $ Language: C++ - Date: $Date: 2009/05/14 14:43:34 $ - Version: $Revision: 1.3 $ + Date: $Date: 2009/05/28 08:12:06 $ + Version: $Revision: 1.4 $ ========================================================================*/ @@ -51,7 +51,6 @@ namespace bbtk { - template class WidgetBlackBoxWindow; //================================================================== @@ -66,7 +65,6 @@ namespace bbtk // typedef WidgetTraits Traits; typedef W Widget; typedef Widget* WidgetPointer; - typedef WidgetBlackBoxWindow Window; BBTK_BLACK_BOX_INTERFACE(WidgetBlackBox,bbtk::AtomicBlackBox); @@ -82,49 +80,25 @@ namespace bbtk /// Overloaded bbCreateWindow method for WidgetBlackBoxes which handles /// the window creation if needed virtual void bbCreateWindow(); + virtual bool bbWindowIsCreated() { return false; } //================================================================== //================================================================== /// Overloaded bbShowWindow method for WidgetBlackBoxes which handles /// the window creation if needed - virtual void bbShowWindow(); + virtual void bbShowWindow() {} //================================================================== - //================================================================== - /// Returns the **OWN** window associated to the box - /// If 0 returned = no window - Window* bbGetWindow() { return bbmWindow; } - /// Returns the window containing the widget associated to the box - /// Which can be the own window of **ANOTHER** box in case of - /// a hierarchy of widgets (layouts) - /// More precisely : - /// If bbGetWindow() != 0 then returns bbGetWindow() - /// Else if the output 'Widget' is connected - /// then returns bbGetContainingWindow() of the box connected to 'Widget' - /// Else returns 0; - Window* bbGetContainingWindow(); - - - /// Returns true iff the 'containing window' exists and is shown - /// (see bbGetContainingWindow). - bool bbIsShown(); - + /// Convenient method which returns true iff the output Widget is connected bool bbIsOutputWidgetConnected(); //================================================================== - /// User callback invoked when the containing window is shown - virtual void bbUserOnShow() {} + void bbSetShown(bool); + bool bbIsShown(); //================================================================== - //================================================================== - /// User callback invoked when the containing window is hidden - virtual void bbUserOnHide() {} - //================================================================== - - /// Sets the window - inline void bbSetWindow(Window* w) { bbmWindow=w; } - + //================================================================== /// User callback for creating the widget associated to the box /// ** Must be defined ** in user classes @@ -171,38 +145,23 @@ namespace bbtk //================================================================== //================================================================== - /// Hides the WidgetBlackBoxWindow associated to the box (if exists) - void bbHideWindow(); - /// Closes (destroys) the WidgetBlackBoxWindow associated to the box - /// (if exists) - void bbCloseWindow(); - //================================================================== - - - //================================================================== - // virtual void InitWindowManagerIfNeeded(); - virtual void IncNbWindowsAlive() {} - virtual void DecNbWindowsAlive() {} - virtual int GetNbWindowsAlive() { return 0; } - virtual bool IsSomeWindowAlive() { return false; } - - virtual void IncNbWindowsShown() {} - virtual void DecNbWindowsShown() {} - virtual int GetNbWindowsShown() { return 0; } - virtual bool IsSomeWindowShown() { return false; } + /// Destroys the WidgetBlackBoxWindow associated to the box (if exists) + virtual void bbDestroyWindow() {} //================================================================== + private: - /// friendship - friend class WidgetBlackBoxWindow; - // friend class WidgetBlackBoxWidgetEventHandler; - - /// The WidgetBlackBoxWindow associated to the box - Window* bbmWindow; - - - + + /// Set to true when the + /// window containing the widget is shown + bool bbmShown; + /// Contains the "nested" WidgetBlackBoxes, + /// i.e. if this WidgetBox is a Layout the ones + /// which are inserted into the layout + /// The list is updated by the method bbCreateWidgetOfInput + /// It is emptied when ? + std::vector bbmNestedWidgetBoxes; }; //================================================================= @@ -213,11 +172,9 @@ namespace bbtk public: \ inline void bbUserCreateWidget(Widget* parent) \ { \ - bbtkDebugMessageInc("kw",1,"**> Creating widget for [" \ - < Creating widget" \ + < Showing [" \ - < Showing" \ + <