00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00037 #ifdef _USE_WXWIDGETS_
00038
00039 #include "bbwxLayoutSplit.h"
00040 #include "bbwxPackage.h"
00041 #include "bbtkUtilities.h"
00042
00043
00044 namespace bbwx
00045 {
00046 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,LayoutSplit);
00047 BBTK_BLACK_BOX_IMPLEMENTATION(LayoutSplit,bbtk::WxBlackBox);
00048
00049 void LayoutSplit::bbUserConstructor()
00050 {
00051 bbSetInputOrientation("VERTICAL");
00052 bbSetInputProportion(50);
00053 bbSetInputWidget1(NULL);
00054 bbSetInputWidget2(NULL);
00055 }
00056
00057 void LayoutSplit::Process()
00058 {
00059 }
00060
00061 void LayoutSplit::CreateWidget(wxWindow* parent)
00062 {
00063 wxSplitterWindow* w = new wxSplitterWindow(parent,
00064 -1,
00065 wxDefaultPosition,
00066 wxDefaultSize,
00067
00068 wxSP_3D |
00069 wxSP_LIVE_UPDATE );
00070 w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 wxWindow* w1 = bbCreateWidgetOfInput("Widget1",w);
00082 wxWindow* w2 = bbCreateWidgetOfInput("Widget2",w);
00083 if (w1==NULL) { w1=new wxPanel(parent); }
00084 if (w2==NULL) { w2=new wxPanel(parent); }
00085
00086 int orientation=0;
00087 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true) { orientation=0; }
00088 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true) { orientation=1; }
00089
00090
00091 if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
00092 else { w->SplitVertically( w1, w2, 100); }
00093
00094 bbSetOutputWidget( w );
00095 }
00096
00097
00098
00099
00100 void LayoutSplit::OnShowWidget()
00101 {
00102
00103 if (bbGetOutputWidget()==0)
00104 {
00105 return;
00106
00107 }
00108 wxSplitterWindow* win = (wxSplitterWindow*)bbGetOutputWidget();
00109 int w,h;
00110 if (win==0)
00111 {
00112 return;
00113
00114 }
00115 win->GetClientSize(&w,&h);
00116 int pos = 100;
00117 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
00118 "0|H|HORIZONTAL")==true)
00119 {
00120 pos = (int)(w * bbGetInputProportion() * 0.01);
00121 }
00122 else
00123 {
00124 pos = (int)(h * bbGetInputProportion() * 0.01);
00125 }
00126
00127
00128 win->SetSashPosition(pos,true);
00129 bbUserOnShowWidget("Widget1");
00130 bbUserOnShowWidget("Widget2");
00131 }
00132
00133
00134
00135 }
00136
00137 #endif // _USE_WXWIDGETS_
00138