// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TEveGedEditor
#define ROOT_TEveGedEditor

#include "TGedEditor.h"
#include "TGedFrame.h"
#include "TGButton.h"

class TEveElement;
class TContextMenu;

//==============================================================================
// TEveGedEditor
//==============================================================================

class TEveGedEditor : public TGedEditor
{
   TEveGedEditor(const TEveGedEditor&);            // Not implemented
   TEveGedEditor& operator=(const TEveGedEditor&); // Not implemented

public:
   typedef TGedFrame* (*NameFrameCreator_t)(TEveGedEditor*, const TGWindow* parent, const char* tab_name);

protected:
   TEveElement   *fElement;    // Cached eve-element pointer.
   TObject       *fObject;     // Cached tobj pointer.

   virtual TGedFrame* CreateNameFrame(const TGWindow* parent, const char* tab_name); 

   static Int_t   fgMaxExtraEditors;
   static TList  *fgExtraEditors;

   static TContextMenu *fgContextMenu;

public:
   TEveGedEditor(TCanvas* canvas=0, UInt_t width=250, UInt_t height=400);
   virtual ~TEveGedEditor();

   virtual void CloseWindow();
   virtual void DeleteWindow();

   TEveElement* GetEveElement() const;

   void DisplayElement(TEveElement* re);
   void DisplayObject(TObject* obj);

   virtual void SetModel(TVirtualPad* pad, TObject* obj, Int_t event);
   virtual void Update(TGedFrame* gframe=0);

   // --- Statics for extra editors. ---

   static void SpawnNewEditor(TObject* obj);
   static void ElementChanged(TEveElement* el);
   static void ElementDeleted(TEveElement* el);

   static void DestroyEditors();

   static TContextMenu* GetContextMenu();

   ClassDef(TEveGedEditor, 0); // Specialization of TGedEditor for proper update propagation to TEveManager.
};


//==============================================================================
// TEveGedNameFrame
//==============================================================================

class TEveGedNameFrame : public TGedFrame
{
private:
   TEveGedNameFrame(const TEveGedNameFrame&);            // Not implemented
   TEveGedNameFrame& operator=(const TEveGedNameFrame&); // Not implemented

protected:
   TGTextButton   *fNCButton; // Name/Class button.

public:
   TEveGedNameFrame(const TGWindow *p=0, Int_t width=140, Int_t height=30,
                    UInt_t options=kChildFrame | kHorizontalFrame);
   virtual ~TEveGedNameFrame();

   virtual void SetModel(TObject* obj);

   void SpawnEditorClone();

   ClassDef(TEveGedNameFrame, 0); // Top name-frame used in EVE.
};


//==============================================================================
// TEveGedNameTextButton
//==============================================================================

class TEveGedNameTextButton : public TGTextButton
{
private:
   TEveGedNameTextButton(const TEveGedNameTextButton&);            // Not implemented
   TEveGedNameTextButton& operator=(const TEveGedNameTextButton&); // Not implemented

   TEveGedNameFrame *fFrame;

public:
   TEveGedNameTextButton(TEveGedNameFrame* p);
   virtual ~TEveGedNameTextButton();

   virtual Bool_t HandleButton(Event_t* event);

   ClassDef(TEveGedNameTextButton, 0); // Button for GED name-frame.
};

#endif
 TEveGedEditor.h:1
 TEveGedEditor.h:2
 TEveGedEditor.h:3
 TEveGedEditor.h:4
 TEveGedEditor.h:5
 TEveGedEditor.h:6
 TEveGedEditor.h:7
 TEveGedEditor.h:8
 TEveGedEditor.h:9
 TEveGedEditor.h:10
 TEveGedEditor.h:11
 TEveGedEditor.h:12
 TEveGedEditor.h:13
 TEveGedEditor.h:14
 TEveGedEditor.h:15
 TEveGedEditor.h:16
 TEveGedEditor.h:17
 TEveGedEditor.h:18
 TEveGedEditor.h:19
 TEveGedEditor.h:20
 TEveGedEditor.h:21
 TEveGedEditor.h:22
 TEveGedEditor.h:23
 TEveGedEditor.h:24
 TEveGedEditor.h:25
 TEveGedEditor.h:26
 TEveGedEditor.h:27
 TEveGedEditor.h:28
 TEveGedEditor.h:29
 TEveGedEditor.h:30
 TEveGedEditor.h:31
 TEveGedEditor.h:32
 TEveGedEditor.h:33
 TEveGedEditor.h:34
 TEveGedEditor.h:35
 TEveGedEditor.h:36
 TEveGedEditor.h:37
 TEveGedEditor.h:38
 TEveGedEditor.h:39
 TEveGedEditor.h:40
 TEveGedEditor.h:41
 TEveGedEditor.h:42
 TEveGedEditor.h:43
 TEveGedEditor.h:44
 TEveGedEditor.h:45
 TEveGedEditor.h:46
 TEveGedEditor.h:47
 TEveGedEditor.h:48
 TEveGedEditor.h:49
 TEveGedEditor.h:50
 TEveGedEditor.h:51
 TEveGedEditor.h:52
 TEveGedEditor.h:53
 TEveGedEditor.h:54
 TEveGedEditor.h:55
 TEveGedEditor.h:56
 TEveGedEditor.h:57
 TEveGedEditor.h:58
 TEveGedEditor.h:59
 TEveGedEditor.h:60
 TEveGedEditor.h:61
 TEveGedEditor.h:62
 TEveGedEditor.h:63
 TEveGedEditor.h:64
 TEveGedEditor.h:65
 TEveGedEditor.h:66
 TEveGedEditor.h:67
 TEveGedEditor.h:68
 TEveGedEditor.h:69
 TEveGedEditor.h:70
 TEveGedEditor.h:71
 TEveGedEditor.h:72
 TEveGedEditor.h:73
 TEveGedEditor.h:74
 TEveGedEditor.h:75
 TEveGedEditor.h:76
 TEveGedEditor.h:77
 TEveGedEditor.h:78
 TEveGedEditor.h:79
 TEveGedEditor.h:80
 TEveGedEditor.h:81
 TEveGedEditor.h:82
 TEveGedEditor.h:83
 TEveGedEditor.h:84
 TEveGedEditor.h:85
 TEveGedEditor.h:86
 TEveGedEditor.h:87
 TEveGedEditor.h:88
 TEveGedEditor.h:89
 TEveGedEditor.h:90
 TEveGedEditor.h:91
 TEveGedEditor.h:92
 TEveGedEditor.h:93
 TEveGedEditor.h:94
 TEveGedEditor.h:95
 TEveGedEditor.h:96
 TEveGedEditor.h:97
 TEveGedEditor.h:98
 TEveGedEditor.h:99
 TEveGedEditor.h:100
 TEveGedEditor.h:101
 TEveGedEditor.h:102
 TEveGedEditor.h:103
 TEveGedEditor.h:104
 TEveGedEditor.h:105
 TEveGedEditor.h:106
 TEveGedEditor.h:107
 TEveGedEditor.h:108
 TEveGedEditor.h:109
 TEveGedEditor.h:110
 TEveGedEditor.h:111
 TEveGedEditor.h:112
 TEveGedEditor.h:113
 TEveGedEditor.h:114
 TEveGedEditor.h:115
 TEveGedEditor.h:116
 TEveGedEditor.h:117
 TEveGedEditor.h:118
 TEveGedEditor.h:119
 TEveGedEditor.h:120
 TEveGedEditor.h:121