On this question I have been attempting to capture a AUI pane configuration so that it can be restored if any panes have been closed. The docs are somewhat limited for wxPHP, and upstream for wxWidgets, so I am largely feeling my way around.
I have realised that SavePaneInfo
will help me capture the state of a pane - it outputs a perspective string that represents the position and options for a pane at a given moment. All I need to do therefore is to capture when the pane changes and update my internal representation of it.
For the sake of interest, a perspective looks like this:
name=auiPane3;caption=Caption 3;state=2099196;dir=3;layer=0;row=0;pos=1;prop=100000;bestw=90;besth=25;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1
However, capturing a move/dock event is not proving to be trivial. I can see six events connected with AUI:
wxEVT_AUI_FIND_MANAGER
wxEVT_AUI_PANE_BUTTON
wxEVT_AUI_PANE_CLOSE
wxEVT_AUI_PANE_MAXIMISE
wxEVT_AUI_PANE_RESTORE
wxEVT_AUI_PANE_RENDER
I have been able to capture the restore and close events, and the find_manager doesn't seem to do anything. I've tried wxEVT_ANY
on this window, which also does not seem to capture anything. I've also tried it on individual panes too, to no avail (nothing is called as far as I can tell):
$managedWindow->getWindowByIndex(0)->Connect(wxEVT_ANY, array($this, "onAny"));
The docs for the upstream library wxWidgets mention this event:
EVT_AUI_PANE_ACTIVATED
However that does not seem to be implemented in wxPHP - is that what I want? It does not quite sound right, but if I can access it without the constant I would certainly try it.
I guess I could use wxAuiManager::SetArtProvider
with the standard art provider object, modified to capture pane state, but that feels like a sledgehammer to crack a nut. I could also capture the close event and change the perspective string returned so the 'closed' bit is not set, but that too is not particularly elegant.
What I want to do feels really trivial, and would be in keeping with other parts of wxWidgets, but it is not so. Any suggestions for things to try?