subclassing CXTPStatusBarThemeOffice203 |
Post Reply |
Author | |
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
Posted: 17 October 2018 at 3:48pm |
I want to draw a gripper in the status bar. The CXTPStatusBarThemeOffice2013 DrawStatusBarGripper method does nothing. But, I see the method is virtual. So I subclassed from CXTPStatusBarThemeOffice2013 and implemented code to draw the gripper. CJ calls the method and I have a gripper. But, my destructor is never called. CJ directly calls new on the CJ CXTPStatusBarThemeOffice2013 class in the paint manager code. And it calls delete too. The destructor in CXTPStatusBarThemeOffice2013 is not virtual so making mine virtual doesn't get the job done - my destructor is never called. I finally resorted to not declaring any instance data in the class and keeping static data around (I draw a transparent bitmap in DrawStatusBarGripper that I create one time). So why have virtual methods if there is not an easy way to get CJ to use my subclass properly? I had to override SetTheme in our command bars subclass, call the CJ method and then delete m_pPaintManger->m_pStatusBarPaintManager (as it is always CXTPStatusBarThemeOffice2013 instance when the theme is xtpThemeOffice2013) Then I allocate my class and set the m_pStatusBarPaintManager pointer to an instance of my derived class. The CXTPStatusBarThemeOffice2013 class doesn't do the implement dynamic nor even make the destructor virtual. But, I am assuming that just because I didn't see a more direct route to get my class instance in place doesn't mean there isn't one. Am I missing something? Or will it take, at the very least, CJ making the destructor for XTPStatusBarThemeOffice2013 virtual? I hesitate to modify the CJ class as that is something I have to track and do with each update.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |