PageRenderTime 51ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/root-5.34.01/gui/gui/inc/TRootCanvas.h

#
C Header | 161 lines | 121 code | 22 blank | 18 comment | 0 complexity | 8e252a3a625f10315a258b1589bb1cbd MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, LGPL-2.0, JSON, GPL-2.0, BSD-3-Clause
  1. // @(#)root/gui:$Id: TRootCanvas.h 29403 2009-07-09 07:17:16Z brun $
  2. // Author: Fons Rademakers 15/01/98
  3. /*************************************************************************
  4. * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
  5. * All rights reserved. *
  6. * *
  7. * For the licensing terms see $ROOTSYS/LICENSE. *
  8. * For the list of contributors see $ROOTSYS/README/CREDITS. *
  9. *************************************************************************/
  10. #ifndef ROOT_TRootCanvas
  11. #define ROOT_TRootCanvas
  12. //////////////////////////////////////////////////////////////////////////
  13. // //
  14. // TRootCanvas //
  15. // //
  16. // This class creates a main window with menubar, scrollbars and a //
  17. // drawing area. The widgets used are the new native ROOT GUI widgets. //
  18. // //
  19. //////////////////////////////////////////////////////////////////////////
  20. #ifndef ROOT_TCanvasImp
  21. #include "TCanvasImp.h"
  22. #endif
  23. #ifndef ROOT_TGFrame
  24. #include "TGFrame.h"
  25. #endif
  26. class TGCanvas;
  27. class TGMenuBar;
  28. class TGPopupMenu;
  29. class TGLayoutHints;
  30. class TGStatusBar;
  31. class TRootContainer;
  32. class TGToolBar;
  33. class TGHorizontal3DLine;
  34. class TGVertical3DLine;
  35. class TVirtualPadEditor;
  36. class TGDockableFrame;
  37. class TGDNDManager;
  38. class TGToolTip;
  39. class TRootCanvas : public TGMainFrame, public TCanvasImp {
  40. friend class TRootContainer;
  41. private:
  42. TGCanvas *fCanvasWindow; // canvas widget
  43. TRootContainer *fCanvasContainer; // container in canvas widget
  44. TGMenuBar *fMenuBar; // menubar
  45. TGPopupMenu *fFileMenu; // file menu
  46. TGPopupMenu *fFileSaveMenu; // save cascade submenu
  47. TGPopupMenu *fEditMenu; // edit menu
  48. TGPopupMenu *fEditClearMenu; // clear cascade submenu
  49. TGPopupMenu *fViewMenu; // view menu
  50. TGPopupMenu *fViewWithMenu; // view with... cascade submenu
  51. TGPopupMenu *fOptionMenu; // option menu
  52. TGPopupMenu *fToolsMenu; // tools menu
  53. TGPopupMenu *fHelpMenu; // help menu
  54. TGLayoutHints *fMenuBarLayout; // menubar layout hints
  55. TGLayoutHints *fMenuBarItemLayout; // layout hints for menu in menubar
  56. TGLayoutHints *fMenuBarHelpLayout; // layout hint for help menu in menubar
  57. TGLayoutHints *fCanvasLayout; // layout for canvas widget
  58. TGStatusBar *fStatusBar; // statusbar widget
  59. TGLayoutHints *fStatusBarLayout; // layout hints for statusbar
  60. TGCompositeFrame *fEditorFrame; // side frame for current pad editor
  61. TGLayoutHints *fEditorLayout; // layout for editor frame
  62. TGCompositeFrame *fMainFrame; // main frame containing canvas and side frame
  63. TGLayoutHints *fToolBarLayout; // layout for toolbar widget
  64. TGToolBar *fToolBar; // icon button toolbar
  65. TGHorizontal3DLine *fToolBarSep; // toolbar separator
  66. TGLayoutHints *fMainFrameLayout; // layout for main frame
  67. TGVertical3DLine *fVertical1; // toolbar vertical separator
  68. TGVertical3DLine *fVertical2; // toolbar vertical separator
  69. TGHorizontal3DLine *fHorizontal1; // toolbar sepatator
  70. TGLayoutHints *fVertical1Layout; // layout hints for separator
  71. TGLayoutHints *fVertical2Layout; // layout hints for separator
  72. TGLayoutHints *fHorizontal1Layout; // layout hints for separator
  73. TGDockableFrame *fToolDock; // dockable frame holding the toolbar
  74. TGLayoutHints *fDockLayout; // layout hints for dockable frame widget
  75. const TGPicture *fIconPic; // icon picture
  76. TGToolTip *fToolTip; // tooltip for object info
  77. TVirtualPadEditor *fEditor; // pointer to currently loaded pad editor
  78. Int_t fCanvasID; // index in fWindows array of TGX11
  79. Bool_t fAutoFit; // when true canvas container keeps same size as canvas
  80. Int_t fButton; // currently pressed button
  81. TRootCanvas(const TRootCanvas&); // Not implemented
  82. TRootCanvas& operator=(const TRootCanvas&); // Not implemented
  83. void CreateCanvas(const char *name);
  84. void CreateEditor();
  85. Bool_t HandleContainerButton(Event_t *ev);
  86. Bool_t HandleContainerDoubleClick(Event_t *ev);
  87. Bool_t HandleContainerConfigure(Event_t *ev);
  88. Bool_t HandleContainerKey(Event_t *ev);
  89. Bool_t HandleContainerMotion(Event_t *ev);
  90. Bool_t HandleContainerExpose(Event_t *ev);
  91. Bool_t HandleContainerCrossing(Event_t *ev);
  92. Bool_t HandleDNDDrop(TDNDData *data);
  93. Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action,
  94. Int_t xroot, Int_t yroot);
  95. Atom_t HandleDNDEnter(Atom_t * typelist);
  96. Bool_t HandleDNDLeave();
  97. public:
  98. TRootCanvas(TCanvas *c = 0, const char *name = "ROOT Canvas", UInt_t width = 500, UInt_t height = 300);
  99. TRootCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
  100. virtual ~TRootCanvas();
  101. void AdjustSize();
  102. void Close();
  103. void ForceUpdate() { Layout(); }
  104. void FitCanvas();
  105. void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
  106. UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h);
  107. UInt_t GetCwidth() const;
  108. UInt_t GetCheight() const;
  109. void Iconify() { IconifyWindow(); }
  110. Int_t InitWindow();
  111. void PrintCanvas();
  112. void RaiseWindow();
  113. void SetWindowPosition(Int_t x, Int_t y);
  114. void SetWindowSize(UInt_t w, UInt_t h);
  115. void SetWindowTitle(const char *newTitle);
  116. void SetCanvasSize(UInt_t w, UInt_t h);
  117. void SetStatusText(const char *txt = 0, Int_t partidx = 0);
  118. void Show() { MapRaised(); }
  119. void ShowMenuBar(Bool_t show = kTRUE);
  120. void ShowStatusBar(Bool_t show = kTRUE);
  121. void ShowEditor(Bool_t show = kTRUE);
  122. void ShowToolBar(Bool_t show = kTRUE);
  123. void ShowToolTips(Bool_t show = kTRUE);
  124. Bool_t HasEditor() const;
  125. Bool_t HasMenuBar() const;
  126. Bool_t HasStatusBar() const;
  127. Bool_t HasToolBar() const;
  128. Bool_t HasToolTips() const;
  129. TGMenuBar *GetMenuBar() const { return fMenuBar; }
  130. TGLayoutHints *GetMenuBarItemLayout() const { return fMenuBarItemLayout; }
  131. TGStatusBar *GetStatusBar() const { return fStatusBar; }
  132. TGDockableFrame *GetToolDock() const { return fToolDock; }
  133. // overridden from TGMainFrame
  134. void CloseWindow();
  135. Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
  136. void ReallyDelete();
  137. ClassDef(TRootCanvas,0) //ROOT native GUI version of main window with menubar and drawing area
  138. };
  139. #endif