Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:55

0001 // @(#):$Id$
0002 // Author: M.Gheata
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGeoTabManager
0013 #define ROOT_TGeoTabManager
0014 
0015 #include "TGFrame.h"
0016 
0017 #include "TMap.h"
0018 
0019 class TVirtualPad;
0020 class TClass;
0021 
0022 class TList;
0023 class TGCompositeFrame;
0024 class TGLabel;
0025 class TGTab;
0026 class TGComboBox;
0027 class TGListTree;
0028 class TGListTreeItem;
0029 class TGCanvas;
0030 
0031 class TGedEditor;
0032 
0033 class TGeoShape;
0034 class TGeoVolume;
0035 class TGeoMedium;
0036 class TGeoMaterial;
0037 class TGeoMatrix;
0038 
0039 class TGeoTreeDialog;
0040 class TGeoTransientPanel;
0041 
0042 class TGeoTabManager : public TObject {
0043    friend class TGeoManagerEditor;
0044 
0045 private:
0046    TGedEditor *fGedEditor;             // Parent editor
0047    TVirtualPad *fPad;                  // Pad to which this applies
0048    TGTab *fTab;                        // Parent tab
0049    TGeoVolume *fVolume;                // Edited volume
0050    TGeoTransientPanel *fShapePanel;    // Panel for editing shapes
0051    TGeoTransientPanel *fMediumPanel;   // Panel for editing media
0052    TGeoTransientPanel *fMaterialPanel; // Panel for editing materials
0053    TGeoTransientPanel *fMatrixPanel;   // Panel for editing matrices
0054    TGCompositeFrame *fVolumeTab;       // Volume tab
0055 
0056    static TMap fgEditorToMgrMap; // Map from ged-editor to associated tab-manager
0057 
0058    void GetEditors(TClass *cl);
0059 
0060 public:
0061    TGeoTabManager(TGedEditor *ged);
0062    ~TGeoTabManager() override;
0063 
0064    static TGeoTabManager *GetMakeTabManager(TGedEditor *ged);
0065    static void Cleanup(TGCompositeFrame *frame);
0066    TVirtualPad *GetPad() const { return fPad; }
0067    TGTab *GetTab() const { return fTab; }
0068    Int_t GetTabIndex() const;
0069    static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p);
0070    void SetVolTabEnabled(Bool_t flag = kTRUE);
0071    void SetModel(TObject *model);
0072    void SetTab();
0073 
0074    void GetShapeEditor(TGeoShape *shape);
0075    void GetVolumeEditor(TGeoVolume *vol);
0076    void GetMatrixEditor(TGeoMatrix *matrix);
0077    void GetMediumEditor(TGeoMedium *medium);
0078    void GetMaterialEditor(TGeoMaterial *material);
0079 
0080    TGCompositeFrame *GetVolumeTab() const { return fVolumeTab; }
0081    TGeoVolume *GetVolume() const { return fVolume; }
0082 
0083    ClassDefOverride(TGeoTabManager, 0) // Tab manager for geometry editors
0084 };
0085 
0086 //////////////////////////////////////////////////////////////////////////
0087 //                                                                      //
0088 //  TGeoTreeDialog                                                      //
0089 //                                                                      //
0090 //  Dialog frame for selecting objects with a tree hierarchy            //
0091 //                                                                      //
0092 //////////////////////////////////////////////////////////////////////////
0093 
0094 class TGeoTreeDialog : public TGTransientFrame {
0095 
0096 protected:
0097    static TObject *fgSelectedObj; // Selected object
0098    TGCanvas *fCanvas;             // TGCanvas containing the list tree
0099    TGLabel *fObjLabel;            // Label for selected object
0100    TGListTree *fLT;               // List tree for selecting
0101    TGCompositeFrame *f1;          // Composite frame containing the selection
0102    TGTextButton *fClose;          // Close button
0103 
0104    virtual void BuildListTree() = 0;
0105    virtual void ConnectSignalsToSlots() = 0;
0106 
0107 public:
0108    TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
0109    ~TGeoTreeDialog() override;
0110 
0111    static TObject *GetSelected();
0112    // Slots
0113    virtual void DoClose() = 0;
0114    virtual void DoItemClick(TGListTreeItem *item, Int_t btn) = 0;
0115    void DoSelect(TGListTreeItem *item);
0116 
0117    ClassDefOverride(TGeoTreeDialog, 0) // List-Tree based dialog
0118 };
0119 
0120 //////////////////////////////////////////////////////////////////////////
0121 //                                                                      //
0122 //  TGeoVolumeDialog                                                    //
0123 //                                                                      //
0124 //  Special tree dialog class for selecting volumes.                    //
0125 //                                                                      //
0126 //////////////////////////////////////////////////////////////////////////
0127 
0128 class TGeoVolumeDialog : public TGeoTreeDialog {
0129 
0130 protected:
0131    void BuildListTree() override;
0132    void ConnectSignalsToSlots() override;
0133 
0134 public:
0135    TGeoVolumeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
0136    ~TGeoVolumeDialog() override {}
0137 
0138    // Slots
0139    void DoClose() override;
0140    void DoItemClick(TGListTreeItem *item, Int_t btn) override;
0141 
0142    ClassDefOverride(TGeoVolumeDialog, 0) // List-Tree based volume dialog
0143 };
0144 
0145 //////////////////////////////////////////////////////////////////////////
0146 //                                                                      //
0147 //  TGeoShapeDialog                                                     //
0148 //                                                                      //
0149 //  Special tree dialog class for selecting shapes.                     //
0150 //                                                                      //
0151 //////////////////////////////////////////////////////////////////////////
0152 
0153 class TGeoShapeDialog : public TGeoTreeDialog {
0154 
0155 protected:
0156    void BuildListTree() override;
0157    void ConnectSignalsToSlots() override;
0158 
0159 public:
0160    TGeoShapeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
0161    ~TGeoShapeDialog() override {}
0162 
0163    // Slots
0164    void DoClose() override;
0165    void DoItemClick(TGListTreeItem *item, Int_t btn) override;
0166 
0167    ClassDefOverride(TGeoShapeDialog, 0) // List-Tree based shape dialog
0168 };
0169 
0170 //////////////////////////////////////////////////////////////////////////
0171 //                                                                      //
0172 //  TGeoMediumDialog                                                    //
0173 //                                                                      //
0174 //  Special tree dialog class for selecting media.                      //
0175 //                                                                      //
0176 //////////////////////////////////////////////////////////////////////////
0177 
0178 class TGeoMediumDialog : public TGeoTreeDialog {
0179 
0180 protected:
0181    void BuildListTree() override;
0182    void ConnectSignalsToSlots() override;
0183 
0184 public:
0185    TGeoMediumDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
0186    ~TGeoMediumDialog() override {}
0187 
0188    // Slots
0189    void DoClose() override;
0190    void DoItemClick(TGListTreeItem *item, Int_t btn) override;
0191 
0192    ClassDefOverride(TGeoMediumDialog, 0) // List-Tree based medium dialog
0193 };
0194 
0195 //////////////////////////////////////////////////////////////////////////
0196 //                                                                      //
0197 //  TGeoMaterialDialog                                                  //
0198 //                                                                      //
0199 //  Special tree dialog class for selecting materials.                  //
0200 //                                                                      //
0201 //////////////////////////////////////////////////////////////////////////
0202 
0203 class TGeoMaterialDialog : public TGeoTreeDialog {
0204 
0205 protected:
0206    void BuildListTree() override;
0207    void ConnectSignalsToSlots() override;
0208 
0209 public:
0210    TGeoMaterialDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
0211    ~TGeoMaterialDialog() override {}
0212 
0213    // Slots
0214    void DoClose() override;
0215    void DoItemClick(TGListTreeItem *item, Int_t btn) override;
0216 
0217    ClassDefOverride(TGeoMaterialDialog, 0) // List-Tree based material dialog
0218 };
0219 
0220 //////////////////////////////////////////////////////////////////////////
0221 //                                                                      //
0222 //  TGeoMatrixDialog                                                    //
0223 //                                                                      //
0224 //  Special tree dialog class for selecting matrices.                   //
0225 //                                                                      //
0226 //////////////////////////////////////////////////////////////////////////
0227 
0228 class TGeoMatrixDialog : public TGeoTreeDialog {
0229 
0230 protected:
0231    void BuildListTree() override;
0232    void ConnectSignalsToSlots() override;
0233 
0234 public:
0235    TGeoMatrixDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
0236    ~TGeoMatrixDialog() override {}
0237 
0238    // Slots
0239    void DoClose() override;
0240    void DoItemClick(TGListTreeItem *item, Int_t btn) override;
0241 
0242    ClassDefOverride(TGeoMatrixDialog, 0) // List-Tree based matrix dialog
0243 };
0244 
0245 //////////////////////////////////////////////////////////////////////////
0246 //                                                                      //
0247 //  TGeoTransientPanel                                                  //
0248 //                                                                      //
0249 //  Special transient tab holding TGeo editors.                         //
0250 //                                                                      //
0251 //////////////////////////////////////////////////////////////////////////
0252 
0253 class TGeoTransientPanel : public TGMainFrame {
0254    TGedEditor *fGedEditor;          // ged-editor steering this panel
0255    TGCanvas *fCan;                  // TGCanvas containing a TGTab
0256    TGTab *fTab;                     // tab widget holding the editor
0257    TGCompositeFrame *fTabContainer; // main tab container
0258    TGCompositeFrame *fStyle;        // style tab container frame
0259    TObject *fModel;                 // selected object
0260    TGTextButton *fClose;            // close button
0261 
0262 public:
0263    TGeoTransientPanel(TGedEditor *ged, const char *name, TObject *obj);
0264    ~TGeoTransientPanel() override;
0265 
0266    void CloseWindow() override;
0267    virtual void DeleteEditors();
0268 
0269    TGTab *GetTab() const { return fTab; }
0270    TGCompositeFrame *GetStyle() const { return fStyle; }
0271    TObject *GetModel() const { return fModel; }
0272 
0273    void GetEditors(TClass *cl);
0274    virtual void Hide();
0275    virtual void Show();
0276    void SetModel(TObject *model);
0277 
0278    ClassDefOverride(TGeoTransientPanel, 0) // List-Tree based dialog
0279 };
0280 
0281 #endif