From 6834ea96ccfde13656f9b95e666bb4cb6c43bbc6 Mon Sep 17 00:00:00 2001
From: Axel Naumann <Axel.Naumann@cern.ch>
Date: Wed, 4 Oct 2017 12:39:22 +0200
Subject: [PATCH] Add GetCanvas(), GetParent().

---
 graf2d/gpad/v7/inc/ROOT/TPad.hxx | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/graf2d/gpad/v7/inc/ROOT/TPad.hxx b/graf2d/gpad/v7/inc/ROOT/TPad.hxx
index 347bf2ba35b..8083225db13 100644
--- a/graf2d/gpad/v7/inc/ROOT/TPad.hxx
+++ b/graf2d/gpad/v7/inc/ROOT/TPad.hxx
@@ -112,6 +112,12 @@ public:
    /// Convert a `Pixel` position to Canvas-normalized positions.
    virtual std::array<TPadCoord::Normal, 2> PixelsToNormal(const std::array<TPadCoord::Pixel, 2> &pos) const = 0;
 
+   /// Access to the top-most canvas, if any (const version).
+   virtual const TCanvas &GetCanvas() const = 0;
+
+   /// Access to the top-most canvas, if any (non-const version).
+   virtual TCanvas &GetCanvas() = 0;
+
    /// Convert user coordinates to normal coordinates.
    std::array<TPadCoord::Normal, 2> UserToNormal(const std::array<TPadCoord::User, 2> &pos) const
    {
@@ -173,6 +179,18 @@ public:
    /// Destructor to have a vtable.
    virtual ~TPad();
 
+   /// Access to the parent pad (const version).
+   const TPadBase &GetParent() const { return *fParent; }
+
+   /// Access to the parent pad (non-const version).
+   TPadBase &GetParent() { return *fParent; }
+
+   /// Access to the top-most canvas (const version).
+   const TCanvas &GetCanvas() const override { return fParent->GetCanvas(); }
+
+   /// Access to the top-most canvas (non-const version).
+   TCanvas &GetCanvas() override { return fParent->GetCanvas(); }
+
    /// Get the size of the pad in parent (!) coordinates.
    const TPadExtent &GetSize() const { return fSize; }
 
-- 
GitLab