"""
This module implements python classes which inherit from
and extend the functionality of the ROOT canvas classes.
"""

import ROOT
from ..core import Object

class PadMixin(object):

    def Clear(self, *args, **kwargs):

        self.members = []
        self.__class__.__bases__[-1].Clear(self, *args, **kwargs)
    
    def OwnMembers(self):

        for thing in self.GetListOfPrimitives():
            if thing not in self.members:
                self.members.append(thing)

class Pad(Object, PadMixin, ROOT.TPad):

    def __init__(self, *args, **kwargs):

        ROOT.TPad.__init__(self, *args, **kwargs)
        self.members = []
    
class Canvas(Object, PadMixin, ROOT.TCanvas):

    def __init__(self, name=None, title=None, xpos=0, ypos=0, width=800, height=600):
         
        Object.__init__(self, name, title, xpos, ypos, width, height)
        self.members = []
 

@@ -311,20 +311,16 @@
 kwargs)%0A
-    
 %0A    def
@@ -633,21 +633,17 @@
 rs = %5B%5D%0A
-    
 %0A
+
 class Ca
@@ -708,80 +708,71 @@
 lf, 
-name=None, title=None, xpos=0, ypos=0, width=800, height=600):%0A         
+width=800, height=600, xpos=0, ypos=0, name=None, title=None):%0A
 %0A   
@@ -838,16 +838,16 @@
 height)%0A
+
         
@@ -868,6 +868,4 @@
  %5B%5D%0A
- %0A

reorder canvas init args