php - Is there a AUI pane move (or dock) event in wxPHP? -


on this question have been attempting capture aui pane configuration can restored if panes have been closed. docs limited wxphp, , upstream wxwidgets, largely feeling way around.

i have realised savepaneinfo me capture state of pane - outputs perspective string represents position , options pane @ given moment. need therefore capture when pane changes , update internal representation of it.

for sake of interest, perspective looks 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 move/dock event not proving trivial. can see 6 events connected 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 capture restore , close events, , find_manager doesn't seem anything. i've tried wxevt_any on window, not seem capture anything. i've tried on individual panes too, no avail (nothing called far can tell):

$managedwindow->getwindowbyindex(0)->connect(wxevt_any, array($this, "onany")); 

the docs upstream library wxwidgets mention event:

evt_aui_pane_activated 

however not seem implemented in wxphp - want? not quite sound right, if can access without constant try it.

i guess use wxauimanager::setartprovider standard art provider object, modified capture pane state, feels sledgehammer crack nut. capture close event , change perspective string returned 'closed' bit not set, not particularly elegant.

what want feels trivial, , in keeping other parts of wxwidgets, not so. suggestions things try?

i have solution. have liked detect wxauimanagerevent pane closing, record perspective string of pane closes. not seem possible:

  • the reference $event->geteventobject() null - may wxphp bug;
  • the pane returned $event->getpane() not have property or method read name of pane.

i have therefore taken approach of saving perspective strings whenever 1 pane closed.

i discovered perspective strings contain bit represent closed status of pane, when storing these strings make sure bit unset. reassembling perspective strings not elegant thing, works, , better undocking , redocking (see linked question in original post).

here code loops through panes, gets perspective string, unsets closed flag , saves perspective in window list:

public function onpaneclose(wxauimanagerevent $event) {     for($i = 0; $i <= 7; $i++)     {         $pi = $this->getpaneinfobyindex($i);         $persp = $this->getmanagedwindow()->getauimanager()->savepaneinfo($pi);          // split perspective string pieces, second 1 (state)         $items = explode(';', $persp);         $state = $items[2];          // decode bitfield within         $stateitems = explode('=', $state);         $statebitfield = (int) $stateitems[1];          // set bitmask ignore closed state         $bitmask = (-1 ^ 2);          // reset perspective string minus closed state bit         $replacementbitfield = $statebitfield & $bitmask;         $items[2] = "state=" . $replacementbitfield;         $newpersp = implode(';', $items);          // save perspective         $this->windowsaves[$i] = $newpersp;     } } 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -