]> Creatis software - bbtk.git/commitdiff
key word -> HORIZONTAL VERTICAL TOP RIGHT BOTTM LEFT
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Fri, 8 Feb 2008 14:58:31 +0000 (14:58 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Fri, 8 Feb 2008 14:58:31 +0000 (14:58 +0000)
in (wx)  Notebook Sizer Slider Split

bbtkUtilities.cxx

kernel/src/bbtkUtilities.cxx
kernel/src/bbtkUtilities.h
packages/wx/bbs/appli/testNotebook2.bbs
packages/wx/src/bbwxNotebook.cxx
packages/wx/src/bbwxNotebook.h
packages/wx/src/bbwxSizer.cxx
packages/wx/src/bbwxSizer.h
packages/wx/src/bbwxSlider.cxx
packages/wx/src/bbwxSlider.h
packages/wx/src/bbwxSplit.cxx
packages/wx/src/bbwxSplit.h

index f15e7080650ce658a9bc018695552c9722905d57..9a6b0283e3ca0fc0ea3f36ee5d04f7967aeb78dc 100644 (file)
@@ -4,4 +4,25 @@
 namespace bbtk
 {
 
+
+bool Utilities::loosematch(std::string stdLine,std::string stdOptions) 
+{
+       bool result=false;
+       char charTmp;
+         std::vector<std::string> tokens;
+         SplitString ( stdOptions,"|", tokens);
+                         int j,sizeStdLineTmp;
+         int i,size=tokens.size();  
+         for (i=0; i<size; i++)
+         {               
+                 if ( strcasecmp(stdLine.c_str(),tokens[i].c_str())==0) 
+                 { 
+                         result=true; 
+                 }               
+         }
+         return result;
+}
+
+
+
 }
index 47779dea87130710e957480a760dfcb75ffecafd..8711393d233f267a2645ae01051ec1bddf8f92bb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkUtilities.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/04 13:02:58 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -47,6 +47,7 @@
    #include <sys/types.h>
 #endif
 
+#include <cctype>    // std::toupper
 //#include "bbtkMessageManager.h"
 
 namespace bbtk
@@ -534,10 +535,21 @@ static int Explore(std::string const &dirpath, bool recursive, std::vector<std::
       replace( str, "<", "&lt;" );
       replace( str, ">", "&gt;" );
     }
+    
+    
+    //========================================================================
+    // Usefull functions OPTIONS string
     //========================================================================
 
+    
+    static bool loosematch(std::string stdLine,std::string stdOptions);
+    
+   
+    
+    
   };
 
+  
 } // namespace bbtk
  
 #endif //#ifndef __bbtkUtilities_h_INCLUDED__
index e22dc32a9e4cf65986be4524047f398dc4a057ae..e02f2924fc460b86317f7f35c665f1dee109d464 100644 (file)
@@ -13,6 +13,7 @@ new Notebook main
 new Slider sA
 new Slider sB
 new Notebook notebook
+  set notebook.Orientation "L"
 
 connect slider2.Widget sizer.Widget1
 connect slider3.Widget sizer.Widget2
index 384224ae2df94ce4dcbe666395b04ed86230e60a..d4aa4ff80c6633fe99d54722ca67c23dc169e7aa 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxNotebook.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/05 18:05:32 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  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
@@ -26,7 +26,7 @@
 
 #include "bbwxNotebook.h"
 #include "bbwxPackage.h"
-
+#include "bbtkUtilities.h"
 
 
 
@@ -40,8 +40,7 @@ namespace bbwx
   
        void Notebook::bbUserConstructor() 
        { 
-               bbSetInputWinTitle("Notebook");
-               bbSetInputOrientation(0);
+               bbSetInputOrientation("TOP");
                bbSetInputWidget1(NULL);
                bbSetInputWidget2(NULL);
                bbSetInputWidget3(NULL);
@@ -51,7 +50,6 @@ namespace bbwx
                bbSetInputWidget7(NULL);
                bbSetInputWidget8(NULL);
                bbSetInputWidget9(NULL);
-               bbSetInputWidget10(NULL);
        }
 
        void Notebook::TryInsertWindow(wxNotebook *book, wxWindow *widgetchild )
@@ -72,14 +70,13 @@ namespace bbwx
        void Notebook::CreateWidget() 
        { 
          long style = wxNB_TOP;
-         if (bbGetInputOrientation()==0) { style=wxNB_TOP; }
-         if (bbGetInputOrientation()==1) { style=wxNB_LEFT; }
-         if (bbGetInputOrientation()==2) { style=wxNB_RIGHT; }
-         if (bbGetInputOrientation()==3) { style=wxNB_BOTTOM; }
+         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|T|TOP")==true)     { style=wxNB_TOP; }
+         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|R|RIGHT")==true)   { style=wxNB_RIGHT; }
+         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"2|B|BOTTOM")==true)  { style=wxNB_BOTTOM; }
+         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"3|L|LEFT")==true)    { style=wxNB_LEFT; }
          wxNotebook *w = new wxNotebook(bbGetWxParent(), -1, wxDefaultPosition,wxDefaultSize,style );
          w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
-         
-         
+                 
          TryInsertWindow(w,bbGetInputWidget1());
          TryInsertWindow(w,bbGetInputWidget2());
          TryInsertWindow(w,bbGetInputWidget3());
@@ -89,7 +86,6 @@ namespace bbwx
          TryInsertWindow(w,bbGetInputWidget7());
          TryInsertWindow(w,bbGetInputWidget8());
          TryInsertWindow(w,bbGetInputWidget9());
-         TryInsertWindow(w,bbGetInputWidget10());
          
          bbSetOutputWidget( w );
        }
index ec3f51b472802a701b18fe17df1ab972148e3035..1a77078a534a94de9b324173b91fd3968a5b7e0d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxNotebook.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/07 07:58:56 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -59,8 +59,7 @@ namespace bbwx
     BBTK_DECLARE_INPUT(Widget7,wxWindow*);
     BBTK_DECLARE_INPUT(Widget8,wxWindow*);
     BBTK_DECLARE_INPUT(Widget9,wxWindow*);
-    BBTK_DECLARE_INPUT(Widget10,wxWindow*);
-    BBTK_DECLARE_INPUT(Orientation,int);
+    BBTK_DECLARE_INPUT(Orientation,std::string);
     BBTK_PROCESS(Process);
     BBTK_CREATE_WIDGET(CreateWidget);
     
@@ -80,18 +79,17 @@ namespace bbwx
   BBTK_NAME("Notebook");
   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
   BBTK_DESCRIPTION("Notebook widget (wxNotebook)");
-  // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
-  BBTK_INPUT(Notebook,Widget1,"widget 1",wxWindow*);
-  BBTK_INPUT(Notebook,Widget2,"widget 2",wxWindow*);
-  BBTK_INPUT(Notebook,Widget3,"widget 3",wxWindow*);
-  BBTK_INPUT(Notebook,Widget4,"widget 4",wxWindow*);
-  BBTK_INPUT(Notebook,Widget5,"widget 5",wxWindow*);
-  BBTK_INPUT(Notebook,Widget6,"widget 6",wxWindow*);
-  BBTK_INPUT(Notebook,Widget7,"widget 7",wxWindow*);
-  BBTK_INPUT(Notebook,Widget8,"widget 8",wxWindow*);
-  BBTK_INPUT(Notebook,Widget9,"widget 9",wxWindow*);
-  BBTK_INPUT(Notebook,Widget10,"widget 10",wxWindow*);
-  BBTK_INPUT(Notebook,Orientation,"Orientation (default 0), 0=Top , 1=Left , 2=Right , 3=Botton",int);
+    // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
+    BBTK_INPUT(Notebook,Widget1,"widget 1",wxWindow*);
+    BBTK_INPUT(Notebook,Widget2,"widget 2",wxWindow*);
+    BBTK_INPUT(Notebook,Widget3,"widget 3",wxWindow*);
+    BBTK_INPUT(Notebook,Widget4,"widget 4",wxWindow*);
+    BBTK_INPUT(Notebook,Widget5,"widget 5",wxWindow*);
+    BBTK_INPUT(Notebook,Widget6,"widget 6",wxWindow*);
+    BBTK_INPUT(Notebook,Widget7,"widget 7",wxWindow*);
+    BBTK_INPUT(Notebook,Widget8,"widget 8",wxWindow*);
+    BBTK_INPUT(Notebook,Widget9,"widget 9",wxWindow*);
+    BBTK_INPUT(Notebook,Orientation,"Orientation (default T), 0=T=TOP , 1=R=RIGHT , 2=B=BOTTON , 3=L=LEFT " ,std::string);
   BBTK_END_DESCRIBE_BLACK_BOX(Notebook);
   //=================================================================
 
index e30cb2208727ff5d8645c1828b290a6d20eb5caf..86736a9b4da16a2ca0d1db59607da7ec523e39c3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSizer.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/05 18:05:32 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  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
@@ -26,6 +26,7 @@
 
 #include "bbwxSizer.h"
 #include "bbwxPackage.h"
+#include "bbtkUtilities.h"
 
 
 
@@ -40,8 +41,7 @@ namespace bbwx
   
        void Sizer::bbUserConstructor() 
        { 
-               bbSetInputWinTitle("Sizer");
-               bbSetInputOrientation(1);
+               bbSetInputOrientation("VERTICAL");
                bbSetInputWidget1(NULL);
                bbSetInputWidget2(NULL);
                bbSetInputWidget3(NULL);
@@ -51,7 +51,6 @@ namespace bbwx
                bbSetInputWidget7(NULL);
                bbSetInputWidget8(NULL);
                bbSetInputWidget9(NULL);
-               bbSetInputWidget10(NULL);
        }
 
        void Sizer::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer)
@@ -74,12 +73,12 @@ namespace bbwx
          wxBoxSizer *sizer;
          wxPanel *w=new wxPanel(bbGetWxParent(), -1);
          w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
-         if (bbGetInputOrientation()==0)
-         {
-                 sizer = new wxBoxSizer(wxHORIZONTAL);
-         } else {
-                 sizer = new wxBoxSizer(wxVERTICAL);
-         } 
+         
+         int style=0;
+      if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { style=wxHORIZONTAL; }
+         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)        { style=wxVERTICAL; }
+         
+         sizer = new wxBoxSizer(style);
 
          TryInsertWindow(w,bbGetInputWidget1(),sizer);
          TryInsertWindow(w,bbGetInputWidget2(),sizer);
@@ -90,7 +89,6 @@ namespace bbwx
          TryInsertWindow(w,bbGetInputWidget7(),sizer);
          TryInsertWindow(w,bbGetInputWidget8(),sizer);
          TryInsertWindow(w,bbGetInputWidget9(),sizer);
-         TryInsertWindow(w,bbGetInputWidget10(),sizer);
          
          w     -> SetSizer(sizer); 
          bbSetOutputWidget( w );
index d348919c637c34f07d3f45c885a12de3bd90fce6..863deb429ebaa9c83c93fa34b9a54709cb1e3b4d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSizer.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/07 07:58:56 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -59,8 +59,7 @@ namespace bbwx
     BBTK_DECLARE_INPUT(Widget7,wxWindow*);
     BBTK_DECLARE_INPUT(Widget8,wxWindow*);
     BBTK_DECLARE_INPUT(Widget9,wxWindow*);
-    BBTK_DECLARE_INPUT(Widget10,wxWindow*);
-    BBTK_DECLARE_INPUT(Orientation,int);
+    BBTK_DECLARE_INPUT(Orientation,std::string);
     BBTK_PROCESS(Process);
     BBTK_CREATE_WIDGET(CreateWidget);
     
@@ -91,8 +90,7 @@ namespace bbwx
   BBTK_INPUT(Sizer,Widget7,"widget 7",wxWindow*);
   BBTK_INPUT(Sizer,Widget8,"widget 8",wxWindow*);
   BBTK_INPUT(Sizer,Widget9,"widget 9",wxWindow*);
-  BBTK_INPUT(Sizer,Widget10,"widget 10",wxWindow*);
-  BBTK_INPUT(Sizer,Orientation,"Orientation (default 1), 0=Horizontal , 1=Vertical",int);
+  BBTK_INPUT(Sizer,Orientation,"Orientation (default V), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string);
   BBTK_END_DESCRIBE_BLACK_BOX(Sizer);
   //=================================================================
   
index c71852191f0af6979b527ac287d9de287fa6949b..ca2409a243322f53553342fd5ff7742eaaf55442 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSlider.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/06 11:31:40 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -31,6 +31,7 @@
 
 #include "bbwxSlider.h"
 #include "bbwxPackage.h"
+#include "bbtkUtilities.h"
 
 
 
@@ -345,7 +346,7 @@ namespace bbwx
     bbSetInputMin(0);
     bbSetInputMax(500);
     bbSetOutputOut(0);
-    bbSetInputOrientation(0);
+    bbSetInputOrientation("HORIZONTAL");
     bbSetInputChangeResolution(false);
     bbSetInputLabel(true);
     bbSetInputReactiveOnTrack(0);    
@@ -360,10 +361,14 @@ namespace bbwx
 
   void Slider::CreateWidget()
   {
+
+        int orientation=0;
+        if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
+        if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)    { orientation=1; }
          
          SliderWidget *w =  new SliderWidget(this, 
                                                bbGetWxParent(),
-                                               bbGetInputOrientation() , 
+                                               orientation , 
                                                bbGetInputChangeResolution(), 
                                                bbGetInputLabel(), 
                                                bbtk::std2wx( bbGetInputTitle() ),
index b61f5b9d6a65796406a9d0a699b13f50d96dee55..693df8041b087f855b70e4e334634b95a0ce6d04 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSlider.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/06 14:14:24 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  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
@@ -128,7 +128,7 @@ namespace bbwx
     BBTK_DECLARE_INPUT(Max,int);
     BBTK_DECLARE_INPUT(Label,bool);
     BBTK_DECLARE_INPUT(Title,std::string);
-    BBTK_DECLARE_INPUT(Orientation,int);
+    BBTK_DECLARE_INPUT(Orientation,std::string);
     BBTK_DECLARE_INPUT(ChangeResolution,bool);
     BBTK_DECLARE_INPUT(ReactiveOnTrack,int);    
     BBTK_DECLARE_OUTPUT(Out,int);
@@ -156,7 +156,7 @@ namespace bbwx
   BBTK_INPUT(Slider,Title,"Title shown above the slider (default '') ",
             std::string);
   BBTK_INPUT(Slider,Orientation,
-            "Orientation : 0=Horizontal / 1=Vertical (default 0)",int);
+            "Orientation : (default H)  0=H=HORIZONTAL, 1=V=VERTICAL ",std::string);
   BBTK_INPUT(Slider,ChangeResolution,
             "Can the user change the resolution of the slider ? (default FALSE) ",bool);
   BBTK_INPUT(Slider,ReactiveOnTrack,
index e780ec10f7a6bb1fa70de9ed82c7eef7ccee1823..8d05e106c3024af86cf8b1c87c8a50ff74f810c5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSplit.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/05 18:05:32 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -25,6 +25,8 @@
 
 #include "bbwxSplit.h"
 #include "bbwxPackage.h"
+#include "bbtkUtilities.h"
+
 
 //#include "bbtk
 
@@ -39,7 +41,7 @@ namespace bbwx
   void Split::bbUserConstructor() 
   { 
        bbSetInputWinTitle("Split");
-    bbSetInputOrientation(0);
+    bbSetInputOrientation("HORIZONTAL");
     bbSetInputProportion(50);
   }
 
@@ -62,7 +64,11 @@ namespace bbwx
 
     w1->Reparent(w);
     w2->Reparent(w);
-    w->SplitHorizontally( w1, w2, 100);
+    int orientation=0;
+       if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
+       if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)  { orientation=1; }
+       if (orientation==0) { w->SplitHorizontally( w1, w2, 100); }
+       if (orientation==1) { w->SplitVertically( w1, w2, 100); }
     
     
     bbSetOutputWidget( w );
index 1400deb654f7503b73b7f6d83a629f387a442ce8..4edb28ea3cb1ebbd8f9ffa600243ce9a17df859b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSplit.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/07 07:58:56 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/02/08 14:58:31 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,36 +41,6 @@ namespace bbwx
 {
   
   
-  /*
-  
-  class Split;
-  
-  //--------------------------------------------------------------------------
-  class SplitWidget : public bbtk::WxBlackBoxWidgetPanel 
-  {
-  public:
-    
-    SplitWidget(Split* bbtksplit, wxWindow *parent, int orientation);
-    ~SplitWidget();
-
-    void SetChilds(wxWindow* child1, 
-                  wxWindow* child2,
-                  int proportion);
-
-    wxSplitterWindow *GetWxSplitterWindow();
-    //   void SetProportion(int prop);
-    
-  private:
-    int                        mOrientation;
-    wxSplitterWindow   *mwxSplitterWindow;
-  };
-  
-  //------------------------------------------------------------------------
-  //------------------------------------------------------------------------
-  //------------------------------------------------------------------------
-
-  
-  */
   
   
   class Split : public bbtk::WxBlackBox
@@ -79,7 +49,7 @@ namespace bbwx
     BBTK_USER_BLACK_BOX_INTERFACE(Split,bbtk::WxBlackBox);
     BBTK_DECLARE_INPUT(Widget1,wxWindow*);
     BBTK_DECLARE_INPUT(Widget2,wxWindow*);
-    BBTK_DECLARE_INPUT(Orientation,int);
+    BBTK_DECLARE_INPUT(Orientation,std::string);
     BBTK_DECLARE_INPUT(Proportion,int);
     BBTK_PROCESS(Process);
     BBTK_CREATE_WIDGET(CreateWidget);
@@ -102,7 +72,7 @@ namespace bbwx
   // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
   BBTK_INPUT(Split,Widget1,"Upper or left widget",wxWindow*);
   BBTK_INPUT(Split,Widget2,"Lower or right widget",wxWindow*);
-  BBTK_INPUT(Split,Orientation,"Orientation (default 0), 0=Horizontal , 1=Vertical",int);
+  BBTK_INPUT(Split,Orientation,"Orientation (default H), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string);
    BBTK_INPUT(Split,Proportion,"Proportion (in percent) of the first children in the window",int);
   BBTK_END_DESCRIBE_BLACK_BOX(Split);
   //=================================================================