00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef __CLDAQ_ROOT_USE
00020 #include "TRecordDisplayTab.hh"
00021 #include "TRecordDisplay.hh"
00022 #include "TRecordDisplayPreference.hh"
00023
00024 static const Tsize_t _maxlen = 0x10;
00025 static const Tstring _dots = "...";
00026
00027 TRecordDisplayTab::TRecordDisplayTab( TRecordDisplay* d )
00028 : TRecordDisplayComponent( d ),
00029 TGTab( theRecordDisplay, 0, 0 )
00030 {
00031 Build();
00032 }
00033
00034 TRecordDisplayTab::TRecordDisplayTab( TRecordDisplay* d, TGCompositeFrame* p )
00035 : TRecordDisplayComponent( d, p ),
00036 TGTab( theParentFrame, 0, 0 )
00037 {
00038 Build();
00039 }
00040
00041 TRecordDisplayTab::~TRecordDisplayTab()
00042 {
00043
00044 }
00045
00046
00047 Tstring TRecordDisplayTab::GetTabText( const Tstring& title ) const
00048 {
00049 Tstring tabtext = title;
00050
00051
00052 if ( tabtext.size() > _maxlen ) {
00053 tabtext = tabtext.substr( 0, _maxlen - _dots.size() );
00054 tabtext += _dots;
00055 }
00056
00057 return tabtext;
00058 }
00059
00060 TGCompositeFrame* TRecordDisplayTab::GetFrame( const Tstring& title )
00061 {
00062 Tstring tabtext = GetTabText( title );
00063
00064 Tint index = 0;
00065 for ( Tint i = 0; i < GetNumberOfTabs(); i ++ ) {
00066 TGTabElement* e = GetTabTab( i );
00067 Tstring text = e -> GetText() -> GetString();
00068 if ( text == tabtext ) {
00069 return GetTabContainer(i);
00070 }
00071 index ++;
00072 }
00073
00074
00075 return AddTab( tabtext.c_str() );
00076 }
00077
00078 TRecordDisplayTab* TRecordDisplayTab::GetTab( TGCompositeFrame* frame )
00079 {
00080
00081 TIter next( frame->GetList() );
00082 TGFrameElement* el = 0;
00083 while ( ( el = (TGFrameElement*)next() ) ) {
00084 TGFrame* f = el -> fFrame;
00085 Tstring cname = f -> ClassName();
00086 if ( cname == "TGTab" ) {
00087 return (TRecordDisplayTab*)f;
00088 }
00089 }
00090
00091
00092 TRecordDisplayTab* newtab = new TRecordDisplayTab( theRecordDisplay, frame );
00093 return newtab;
00094 }
00095
00096 Tvoid TRecordDisplayTab::Build()
00097 {
00098 TGLayoutHints* tabL =
00099 theRecordDisplay -> GetPreference() -> GetTabLayoutHint();
00100 theParentFrame -> AddFrame( this, tabL );
00101
00102
00103
00104
00105
00106 theFinishBuild = Ttrue;
00107
00108 return;
00109 }
00110
00111 #endif
00112
00113 #ifdef __CLDAQ_ROOT_DLL
00114 ClassImp(TRecordDisplayTab)
00115 #endif