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()
00062 {
00063 wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
00064 -1,
00065 wxDefaultPosition,
00066 wxDefaultSize,
00067
00068 wxSP_3D |
00069 wxSP_LIVE_UPDATE );
00070 w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
00071 wxWindow* w1 = bbGetInputWidget1();
00072 wxWindow* w2 = bbGetInputWidget2();
00073
00074 if (w1==NULL) { w1=new wxPanel(bbGetWxParent()); }
00075 if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); }
00076 w1->Reparent(w);
00077 w2->Reparent(w);
00078 int orientation=0;
00079 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true) { orientation=0; }
00080 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true) { orientation=1; }
00081
00082 if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
00083 else { w->SplitVertically( w1, w2, 100); }
00084
00085 bbSetOutputWidget( w );
00086 }
00087
00088
00089
00090
00091 void LayoutSplit::bbUserOnShow()
00092 {
00093 wxSplitterWindow* win = (wxSplitterWindow*)bbGetOutputWidget();
00094 int w,h;
00095 win->GetClientSize(&w,&h);
00096 int pos = 100;
00097 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
00098 "0|H|HORIZONTAL")==true)
00099 {
00100 pos = (int)(w * bbGetInputProportion() * 0.01);
00101 }
00102 else
00103 {
00104 pos = (int)(h * bbGetInputProportion() * 0.01);
00105 }
00106
00107
00108 win->SetSashPosition(pos,true);
00109 bbUserOnShowWidget("Widget1");
00110 bbUserOnShowWidget("Widget2");
00111 }
00112
00113
00114
00115 }
00116
00117 #endif // _USE_WXWIDGETS_
00118