From: Eduardo Davila Date: Mon, 4 Feb 2008 16:42:10 +0000 (+0000) Subject: wxSizer X-Git-Tag: r0.6.1~287 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=26120e8947976f2e1775f2d6dc727a2741302b36;p=bbtk.git wxSizer --- diff --git a/kernel/src/bbtkWxBrowser.h b/kernel/src/bbtkWxBrowser.h index 8efe171..faea946 100644 --- a/kernel/src/bbtkWxBrowser.h +++ b/kernel/src/bbtkWxBrowser.h @@ -5,7 +5,6 @@ #define __bbtkWxBrowser_h_INCLUDED__ #include "bbtkWx.h" -//#include #include namespace bbtk diff --git a/packages/wx/src/bbwxSizer.cxx b/packages/wx/src/bbwxSizer.cxx new file mode 100644 index 0000000..4648dd6 --- /dev/null +++ b/packages/wx/src/bbwxSizer.cxx @@ -0,0 +1,195 @@ +/*========================================================================= + + Program: bbtk + Module: $RCSfile: bbwxSizer.cxx,v $ + Language: C++ + Date: $Date: 2008/02/04 16:42:10 $ + Version: $Revision: 1.1 $ + + Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de + l'Image). All rights reserved. See Doc/License.txt or + http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +/** + * \file + * \brief + */ + + +#ifdef _USE_WXWIDGETS_ + + +#include "bbwxSizer.h" +#include "bbwxPackage.h" + + + + + +namespace bbwx +{ + BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx , Sizer); + +/* + wxWidgetSizer::wxWidgetSizer(wxWindow *parent,int orientation) + : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) + { + wxPanel *panel = this; + + if (orientation==0) + { + mwxSizer = new wxBoxSizer(wxHORIZONTAL); + } else { + mwxSizer = new wxBoxSizer(wxVERTICAL); + } + + panel -> SetSizer(mwxSizer); + panel -> SetAutoLayout(true); + panel -> Layout(); + + mbbtkSizer=NULL; + } + //------------------------------------------------------------------------- + void wxWidgetSizer::AddChild(wxWindow* child) + { + mwxSizer->Add(child, 1, wxEXPAND, 0); + } + + wxWidgetSizer::~wxWidgetSizer() + { + } + + //------------------------------------------------------------------------- + + void wxWidgetSizer::SetSizer(Sizer* bbtksizer) + { + mbbtkSizer = bbtksizer; + } + + + + //-------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + +*/ + + BBTK_USER_BLACK_BOX_IMPLEMENTATION(Sizer,bbtk::WxBlackBox); + + void Sizer::bbUserConstructor() + { + bbSetInputOrientation(1); + bbSetInputWidget1(NULL); + bbSetInputWidget2(NULL); + bbSetInputWidget3(NULL); + bbSetInputWidget4(NULL); + bbSetInputWidget5(NULL); + bbSetInputWidget6(NULL); + bbSetInputWidget7(NULL); + bbSetInputWidget8(NULL); + bbSetInputWidget9(NULL); + bbSetInputWidget10(NULL); + } + + void Sizer::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer) + { + if (w!=NULL) + { + w->Reparent(parent); + sizer->Add(w, 1, wxEXPAND, 0); + } + } + + + void Sizer::Process() + { + } + + + void Sizer::CreateWidget() + { + wxBoxSizer *sizer; + wxPanel *w=new wxPanel(bbGetWxParent(), -1); + if (bbGetInputOrientation()==0) + { + sizer = new wxBoxSizer(wxHORIZONTAL); + } else { + sizer = new wxBoxSizer(wxVERTICAL); + } + + TryInsertWindow(w,bbGetInputWidget1(),sizer); + TryInsertWindow(w,bbGetInputWidget2(),sizer); + TryInsertWindow(w,bbGetInputWidget3(),sizer); + TryInsertWindow(w,bbGetInputWidget4(),sizer); + TryInsertWindow(w,bbGetInputWidget5(),sizer); + TryInsertWindow(w,bbGetInputWidget6(),sizer); + TryInsertWindow(w,bbGetInputWidget7(),sizer); + TryInsertWindow(w,bbGetInputWidget8(),sizer); + TryInsertWindow(w,bbGetInputWidget9(),sizer); + TryInsertWindow(w,bbGetInputWidget10(),sizer); + + w -> SetSizer(sizer); +// w -> SetAutoLayout(true); +// w -> Layout(); + bbSetOutputWidget( w ); + } + + +/* + wxWindow *Sizer::CreateWxWindow(wxWindow *parent) + { + bbtkDebugMessageInc("Core",9,"Sizer::CreateWxWindow("<first=="Child") + { + const std::vector& C = i->second->GetConnectionVector(); + std::vector::const_iterator j; + for (j=C.begin(); j!=C.end(); ++j) + { +// WxBlackBox* to = ((WxBlackBox*)((*j)->GetBlackBoxTo())); +// wxWindow* cw = ((WxBlackBox*)((*j)->GetBlackBoxTo()))->GetWxWindow(wxwidgetsizer); + wxPanel *cw = new wxPanel(wxwidgetsizer,-1); + cw->SetName( wxString( (*j)->GetBlackBoxTo()->bbGetName().c_str(), wxConvUTF8 ) ); + wxwidgetsizer->AddChild(cw); + } // for j + break; + } // if Child + } // for i + // + wxwidgetsizer->SetSizer(this); + + bbtkDebugDecTab("Core",9); + + Setmwxcontainer(wxwidgetsizer); + + return wxwidgetsizer; + } + + void Sizer::AddWxBBChild(WxBlackBox *wxblackbox) // virtual + { + wxWindow *subparent = GetSubParent( wxString(wxblackbox->bbGetName().c_str(),wxConvUTF8 ) ); + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + sizer -> Add( wxblackbox->GetWxWindow( subparent ) , 1, wxALL|wxEXPAND, 2); + subparent -> SetAutoLayout(true); + subparent -> SetSizer(sizer); + subparent -> Layout(); + } +*/ + + + +}//namespace bbwx + +#endif + diff --git a/packages/wx/src/bbwxSizer.h b/packages/wx/src/bbwxSizer.h new file mode 100644 index 0000000..a4eba45 --- /dev/null +++ b/packages/wx/src/bbwxSizer.h @@ -0,0 +1,107 @@ +/*========================================================================= + + Program: bbtk + Module: $RCSfile: bbwxSizer.h,v $ + Language: C++ + Date: $Date: 2008/02/04 16:42:10 $ + Version: $Revision: 1.1 $ + + Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de + l'Image). All rights reserved. See Doc/License.txt or + http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*//** + * \brief Short description in one line + * + * Long description which + * can span multiple lines + */ +/** + * \file + * \brief Pattern for the definition of a new type of Node (header) + */ +/** + * \class bbtk::NodePatern + * \brief Pattern for the definition of a new type of Node + */ + + +#ifdef _USE_WXWIDGETS_ + + +#ifndef __bbWxSizer_h__ +#define __bbWxSizer_h__ + +#include "bbtkWxBlackBox.h" + + + +namespace bbwx +{ + + + + + class /*BBTK_EXPORT*/ Sizer : public bbtk::WxBlackBox + { + + BBTK_USER_BLACK_BOX_INTERFACE(Sizer,bbtk::WxBlackBox); + BBTK_DECLARE_INPUT(Widget1,wxWindow*); + BBTK_DECLARE_INPUT(Widget2,wxWindow*); + BBTK_DECLARE_INPUT(Widget3,wxWindow*); + BBTK_DECLARE_INPUT(Widget4,wxWindow*); + BBTK_DECLARE_INPUT(Widget5,wxWindow*); + BBTK_DECLARE_INPUT(Widget6,wxWindow*); + 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_PROCESS(Process); + BBTK_CREATE_WIDGET(CreateWidget); + + void Process(); + void CreateWidget(); + + protected: + virtual void bbUserConstructor(); + void TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer); + + }; + + +//================================================================= +// UserBlackBox description + BBTK_BEGIN_DESCRIBE_BLACK_BOX(Sizer,bbtk::WxBlackBox); + BBTK_NAME("Sizer"); + BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr"); + + BBTK_DESCRIPTION("Sizer widget (wxSizer)"); + BBTK_INPUT(Sizer,Widget1,"widget 1",wxWindow*); + BBTK_INPUT(Sizer,Widget2,"widget 2",wxWindow*); + BBTK_INPUT(Sizer,Widget3,"widget 3",wxWindow*); + BBTK_INPUT(Sizer,Widget4,"widget 4",wxWindow*); + BBTK_INPUT(Sizer,Widget5,"widget 5",wxWindow*); + BBTK_INPUT(Sizer,Widget6,"widget 6",wxWindow*); + 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_END_DESCRIBE_BLACK_BOX(Sizer); + //================================================================= + + + +} + + + +//namespace bbtk +#endif //__bbtkWxSizer_h__ + +#endif //_USE_WXWIDGETS_