メインページ   モジュール   名前空間一覧   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TRecordDisplayTab.cc

解説を見る。
00001 // ============================================================================
00002 //  $Id: TRecordDisplayTab.cc,v 1.2 2004/03/07 10:30:27 goiwai Exp $
00003 //  $Name: CLDAQ-1-14-03 $
00004 //  $Log: TRecordDisplayTab.cc,v $
00005 //  Revision 1.2  2004/03/07 10:30:27  goiwai
00006 //  ROOTに組みこむためのおまじないマクロを埋めこみました。
00007 //  全てにおいて完全に動作するわけではありません。
00008 //
00009 //  Revision 1.1  2004/03/01 02:36:25  goiwai
00010 //  RecordDisplay用のクラス群を置きました.
00011 //  お蔵入りになってたものに手直しを加えたものですが,
00012 //  まだ不充分な点も在ります.徐々に修正していきたいと思います.
00013 //  DataRecordオブジェクトを表示するためのツール群なのでRecordDisplayと呼
00014 //  んでいます,多分にオフライン要素が強いです.
00015 //  オンラインよりにしたものを後でEventDisplay(Eventを表示)としてコミット
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   // ないようなら newしてAddFrameする
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   //theParentFrame -> MapSubwindows();
00103   //theParentFrame -> Layout();
00104   //theParentFrame -> MapWindow();
00105 
00106   theFinishBuild = Ttrue;
00107 
00108   return;
00109 }
00110 
00111 #endif
00112 
00113 #ifdef __CLDAQ_ROOT_DLL
00114     ClassImp(TRecordDisplayTab)
00115 #endif


CLDAQ - a Class Library for DataAcQuisition (Version 1.14.3)
Go IWAI -- goiwai at users.sourceforge.jp