Program: bbtk
Module: $RCSfile: bbkwLayoutSplit.cxx,v $
Language: C++
- Date: $Date: 2008/11/29 21:41:58 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/12/02 13:37:56 $
+ Version: $Revision: 1.3 $
=========================================================================*/
/* ---------------------------------------------------------------------
}
- void LayoutSplit::CreateWidget(vtkKWWidget* parent)
+ void LayoutSplit::CreateWidget(vtkKWFrame* parent)
{
vtkKWSplitFrame *splitframe = vtkKWSplitFrame::New();
bbSetOutputWidget(splitframe);
splitframe->SetParent(parent);
splitframe->Create();
-
splitframe->SetFrame1MinimumSize(5);
splitframe->SetFrame2MinimumSize(5);
-
- splitframe->GetApplication()->Script("pack %s -side left -anchor c -expand y",
- splitframe->GetWidgetName());
- /*
- splitframe->SetParent(parent);
- splitframe->Create();
- splitframe->SetWidth(400);
- splitframe->SetHeight(200);
- splitframe->SetReliefToGroove();
- splitframe->SetBorderWidth(2);
splitframe->SetExpandableFrameToBothFrames();
- w->SetName( bbtk::std2kw( bbGetInputWinTitle() ) );
- */
- bbCreateWidgetOfInput("Widget1",splitframe);
- bbCreateWidgetOfInput("Widget2",splitframe);
- /*
- vtkKWWidget* w1 = bbGetInputWidget1();
- if (w1)
+
+ int width = parent->GetWidth();
+ int height = parent->GetHeight();
+ int orientation = 0;
+ if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)
{
- w1->SetParent(splitframe);
- w1->Create();
+ orientation = 0;
+ }
+ else if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)
+ {
+ orientation = 1;
+ }
+ else
+ {
+ bbtkWarning("Unrecognized value '"<<bbGetInputOrientation()<<"' for input 'Orientation' of LayoutSplit "<<bbGetName()<<std::endl);
}
- vtkKWWidget* w2 = bbGetInputWidget2();
- if (w2)
+
+ if (orientation==0)
{
- w2->SetParent(splitframe);
- w2->Create();
+ splitframe->SetOrientationToHorizontal ();
+ width = width / 2;
}
- */
+ else
+ {
+ splitframe->SetOrientationToVertical ();
+ height = height / 2 ;
+ }
- /*
- 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; }
+ width = width - 5;
+ height = height - 5 ;
+ bbGetOutputWidget()->GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
+ bbGetOutputWidget()->GetWidgetName(),
+ parent->GetWidth(),
+ parent->GetHeight() );
+
+ splitframe->SetReliefToGroove();
+ splitframe->SetBorderWidth(2);
+
- if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
- else { w->SplitVertically( w1, w2, 100); }
+ vtkKWWidget* w1 = bbCreateWidgetOfInput("Widget1",splitframe->GetFrame1());
+
+ vtkKWWidget* w2 = bbCreateWidgetOfInput("Widget2",splitframe->GetFrame2());
+
+
+ splitframe->GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
+ w1->GetWidgetName(),
+ width,
+ height);
+
+ splitframe->GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
+ w2->GetWidgetName(),
+ width,
+ height);
- bbSetOutputWidget( w );
- */
+
+
}