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;
+}
+
+
+
}
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
#include <sys/types.h>
#endif
+#include <cctype> // std::toupper
//#include "bbtkMessageManager.h"
namespace bbtk
replace( str, "<", "<" );
replace( str, ">", ">" );
}
+
+
+ //========================================================================
+ // Usefull functions OPTIONS string
//========================================================================
+
+ static bool loosematch(std::string stdLine,std::string stdOptions);
+
+
+
+
};
+
} // namespace bbtk
#endif //#ifndef __bbtkUtilities_h_INCLUDED__
new Slider sA
new Slider sB
new Notebook notebook
+ set notebook.Orientation "L"
connect slider2.Widget sizer.Widget1
connect slider3.Widget sizer.Widget2
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
#include "bbwxNotebook.h"
#include "bbwxPackage.h"
-
+#include "bbtkUtilities.h"
void Notebook::bbUserConstructor()
{
- bbSetInputWinTitle("Notebook");
- bbSetInputOrientation(0);
+ bbSetInputOrientation("TOP");
bbSetInputWidget1(NULL);
bbSetInputWidget2(NULL);
bbSetInputWidget3(NULL);
bbSetInputWidget7(NULL);
bbSetInputWidget8(NULL);
bbSetInputWidget9(NULL);
- bbSetInputWidget10(NULL);
}
void Notebook::TryInsertWindow(wxNotebook *book, wxWindow *widgetchild )
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());
TryInsertWindow(w,bbGetInputWidget7());
TryInsertWindow(w,bbGetInputWidget8());
TryInsertWindow(w,bbGetInputWidget9());
- TryInsertWindow(w,bbGetInputWidget10());
bbSetOutputWidget( w );
}
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
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);
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);
//=================================================================
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
#include "bbwxSizer.h"
#include "bbwxPackage.h"
+#include "bbtkUtilities.h"
void Sizer::bbUserConstructor()
{
- bbSetInputWinTitle("Sizer");
- bbSetInputOrientation(1);
+ bbSetInputOrientation("VERTICAL");
bbSetInputWidget1(NULL);
bbSetInputWidget2(NULL);
bbSetInputWidget3(NULL);
bbSetInputWidget7(NULL);
bbSetInputWidget8(NULL);
bbSetInputWidget9(NULL);
- bbSetInputWidget10(NULL);
}
void Sizer::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer)
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);
TryInsertWindow(w,bbGetInputWidget7(),sizer);
TryInsertWindow(w,bbGetInputWidget8(),sizer);
TryInsertWindow(w,bbGetInputWidget9(),sizer);
- TryInsertWindow(w,bbGetInputWidget10(),sizer);
w -> SetSizer(sizer);
bbSetOutputWidget( w );
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
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);
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);
//=================================================================
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
#include "bbwxSlider.h"
#include "bbwxPackage.h"
+#include "bbtkUtilities.h"
bbSetInputMin(0);
bbSetInputMax(500);
bbSetOutputOut(0);
- bbSetInputOrientation(0);
+ bbSetInputOrientation("HORIZONTAL");
bbSetInputChangeResolution(false);
bbSetInputLabel(true);
bbSetInputReactiveOnTrack(0);
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() ),
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
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);
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,
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
#include "bbwxSplit.h"
#include "bbwxPackage.h"
+#include "bbtkUtilities.h"
+
//#include "bbtk
void Split::bbUserConstructor()
{
bbSetInputWinTitle("Split");
- bbSetInputOrientation(0);
+ bbSetInputOrientation("HORIZONTAL");
bbSetInputProportion(50);
}
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 );
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
{
- /*
-
- 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
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);
// 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);
//=================================================================