The scenario is this. I need to simulate pressing the X button of a pane. I need to do it whether it is floating or not. Currently, clicking the X as a floating pane calls OnClose. However, when the X is clicked while docked, the button press is emulated and handled through OnPaneButton. Since the two are completely different code paths, how does one click with X button without actually using the mouse?
A couple possibilities exist:
- Pass a reference of the wxFrameManager into the child window, build a wxFrameManagerEvent event, and pass it to the parent. This also requires a wxFrameManagerEvent event handler inside wxFloatingPanel so Destroy can be called properly.
- Create a different event type that can be sent without populating a wxPaneInfo member (similar to how DetachPane works with a wxWindow *). Add a wxClosePaneEvent (or whatever) to both wxFrameManager and wxFloatingPane and redesign ProcessMgrEvent to handle more events than just wxFrameManagerEvents. A message could then be sent to the parent like normal.
- Pass a reference of wxFrameManager into the child window and call into a function like DetachPane, except it will be DestroyPane or ClosePane. This merely bypasses dealing with events.
I don't see a way to do it currently so I will be building something to handle it. If there is a way to do it, forgive me (and let me know how).
-Jon