wxAuiManager Class Reference

#include <framemanager.h>

List of all members.

Public Member Functions

 wxAuiManager (wxWindow *managed_wnd=NULL, unsigned int flags=wxAUI_MGR_DEFAULT)
virtual ~wxAuiManager ()
void UnInit ()
void SetFlags (unsigned int flags)
unsigned int GetFlags () const
void SetManagedWindow (wxWindow *managed_wnd)
wxWindow * GetManagedWindow () const
void SetArtProvider (wxAuiDockArt *art_provider)
wxAuiDockArtGetArtProvider () const
wxAuiPaneInfoGetPane (wxWindow *window)
wxAuiPaneInfoGetPane (const wxString &name)
wxAuiPaneInfoArray & GetAllPanes ()
bool AddPane (wxWindow *window, const wxAuiPaneInfo &pane_info)
bool AddPane (wxWindow *window, const wxAuiPaneInfo &pane_info, const wxPoint &drop_pos)
bool AddPane (wxWindow *window, int direction=wxLEFT, const wxString &caption=wxEmptyString)
bool InsertPane (wxWindow *window, const wxAuiPaneInfo &insert_location, int insert_level=wxAUI_INSERT_PANE)
bool DetachPane (wxWindow *window)
wxString SavePaneInfo (wxAuiPaneInfo &pane)
void LoadPaneInfo (wxString pane_part, wxAuiPaneInfo &pane)
wxString SavePerspective ()
bool LoadPerspective (const wxString &perspective, bool update=true)
void Update ()
void DrawHintRect (wxWindow *pane_window, const wxPoint &pt, const wxPoint &offset)
virtual void ShowHint (const wxRect &rect)
virtual void HideHint ()
 wxDEPRECATED (void SetFrame(wxFrame *frame))
 wxDEPRECATED (wxFrame *GetFrame() const )
void OnRender (wxAuiManagerEvent &evt)
void OnPaneButton (wxAuiManagerEvent &evt)

Protected Types

enum  {
  actionNone = 0, actionResize, actionClickButton, actionClickCaption,
  actionDragToolbarPane, actionDragFloatingPane
}

Protected Member Functions

void DoFrameLayout ()
void LayoutAddPane (wxSizer *container, wxAuiDockInfo &dock, wxAuiPaneInfo &pane, wxAuiDockUIPartArray &uiparts, bool spacer_only)
void LayoutAddDock (wxSizer *container, wxAuiDockInfo &dock, wxAuiDockUIPartArray &uiparts, bool spacer_only)
wxSizer * LayoutAll (wxAuiPaneInfoArray &panes, wxAuiDockInfoArray &docks, wxAuiDockUIPartArray &uiparts, bool spacer_only=false)
virtual bool ProcessDockResult (wxAuiPaneInfo &target, const wxAuiPaneInfo &new_pos)
bool DoDrop (wxAuiDockInfoArray &docks, wxAuiPaneInfoArray &panes, wxAuiPaneInfo &drop, const wxPoint &pt, const wxPoint &action_offset=wxPoint(0, 0))
wxAuiPaneInfoLookupPane (wxWindow *window)
wxAuiPaneInfoLookupPane (const wxString &name)
wxAuiDockUIPartHitTest (int x, int y)
wxAuiDockUIPartGetPanePart (wxWindow *pane)
int GetDockPixelOffset (wxAuiPaneInfo &test)
void OnFloatingPaneMoveStart (wxWindow *window)
void OnFloatingPaneMoving (wxWindow *window)
void OnFloatingPaneMoved (wxWindow *window)
void OnFloatingPaneActivated (wxWindow *window)
void OnFloatingPaneClosed (wxWindow *window, wxCloseEvent &evt)
void OnFloatingPaneResized (wxWindow *window, const wxSize &size)
void Render (wxDC *dc)
void Repaint (wxDC *dc=NULL)
void ProcessMgrEvent (wxAuiManagerEvent &event)
void UpdateButtonOnScreen (wxAuiDockUIPart *button_ui_part, const wxMouseEvent &event)
void GetPanePositionsAndSizes (wxAuiDockInfo &dock, wxArrayInt &positions, wxArrayInt &sizes)
void OnPaint (wxPaintEvent &evt)
void OnEraseBackground (wxEraseEvent &evt)
void OnSize (wxSizeEvent &evt)
void OnSetCursor (wxSetCursorEvent &evt)
void OnLeftDown (wxMouseEvent &evt)
void OnLeftUp (wxMouseEvent &evt)
void OnMotion (wxMouseEvent &evt)
void OnLeaveWindow (wxMouseEvent &evt)
void OnChildFocus (wxChildFocusEvent &evt)
void OnHintFadeTimer (wxTimerEvent &evt)

Protected Attributes

wxWindow * m_frame
wxAuiDockArtm_art
unsigned int m_flags
wxAuiPaneInfoArray m_panes
wxAuiDockInfoArray m_docks
wxAuiDockUIPartArray m_uiparts
int m_action
wxPoint m_action_start
wxPoint m_action_offset
wxAuiDockUIPartm_action_part
wxWindow * m_action_window
wxRect m_action_hintrect
wxAuiDockUIPartm_hover_button
wxRect m_last_hint
wxPoint m_last_mouse_move
wxFrame * m_hint_wnd
wxTimer m_hint_fadetimer
wxByte m_hint_fadeamt
wxByte m_hint_fademax

Friends

class wxAuiFloatingFrame


Detailed Description

Definition at line 393 of file framemanager.h.


Member Enumeration Documentation

anonymous enum [protected]
 

Enumerator:
actionNone 
actionResize 
actionClickButton 
actionClickCaption 
actionDragToolbarPane 
actionDragFloatingPane 

Definition at line 538 of file framemanager.h.

00539     {
00540         actionNone = 0,
00541         actionResize,
00542         actionClickButton,
00543         actionClickCaption,
00544         actionDragToolbarPane,
00545         actionDragFloatingPane
00546     };


Constructor & Destructor Documentation

wxAuiManager::wxAuiManager wxWindow *  managed_wnd = NULL,
unsigned int  flags = wxAUI_MGR_DEFAULT
 

wxAuiManager::~wxAuiManager  )  [virtual]
 

Definition at line 452 of file framemanager.cpp.

00453 {
00454     delete m_art;
00455 }


Member Function Documentation

bool wxAuiManager::AddPane wxWindow *  window,
int  direction = wxLEFT,
const wxString &  caption = wxEmptyString
 

Definition at line 765 of file framemanager.cpp.

00768 {
00769     wxAuiPaneInfo pinfo;
00770     pinfo.Caption(caption);
00771     switch (direction)
00772     {
00773         case wxTOP:    pinfo.Top(); break;
00774         case wxBOTTOM: pinfo.Bottom(); break;
00775         case wxLEFT:   pinfo.Left(); break;
00776         case wxRIGHT:  pinfo.Right(); break;
00777         case wxCENTER: pinfo.CenterPane(); break;
00778     }
00779     return AddPane(window, pinfo);
00780 }

bool wxAuiManager::AddPane wxWindow *  window,
const wxAuiPaneInfo pane_info,
const wxPoint &  drop_pos
 

Definition at line 782 of file framemanager.cpp.

00785 {
00786     if (!AddPane(window, pane_info))
00787         return false;
00788 
00789     wxAuiPaneInfo& pane = GetPane(window);
00790 
00791     DoDrop(m_docks, m_panes, pane, drop_pos, wxPoint(0,0));
00792 
00793     return true;
00794 }

bool wxAuiManager::AddPane wxWindow *  window,
const wxAuiPaneInfo pane_info
 

Definition at line 690 of file framemanager.cpp.

00691 {
00692     // check if the pane has a valid window
00693     if (!window)
00694         return false;
00695 
00696     // check if the pane already exists
00697     if (GetPane(pane_info.window).IsOk())
00698         return false;
00699 
00700     m_panes.Add(pane_info);
00701 
00702     wxAuiPaneInfo& pinfo = m_panes.Last();
00703 
00704     // set the pane window
00705     pinfo.window = window;
00706 
00707     // if the pane's name identifier is blank, create a random string
00708     if (pinfo.name.empty())
00709     {
00710         pinfo.name.Printf(wxT("%08lx%08x%08x%08lx"),
00711              ((unsigned long)pinfo.window) & 0xffffffff,
00712              (unsigned int)time(NULL),
00713 #ifdef __WXWINCE__
00714              (unsigned int)GetTickCount(),
00715 #else
00716              (unsigned int)clock(),
00717 #endif
00718              (unsigned long)m_panes.GetCount());
00719     }
00720 
00721     // set initial proportion (if not already set)
00722     if (pinfo.dock_proportion == 0)
00723         pinfo.dock_proportion = 100000;
00724 
00725     if (pinfo.HasCloseButton() &&
00726         pinfo.buttons.size() == 0)
00727     {
00728         wxAuiPaneButton button;
00729         button.button_id = wxAuiPaneInfo::buttonClose;
00730         pinfo.buttons.Add(button);
00731     }
00732 
00733     if (pinfo.best_size == wxDefaultSize &&
00734         pinfo.window)
00735     {
00736         pinfo.best_size = pinfo.window->GetClientSize();
00737 
00738         if (pinfo.window->IsKindOf(CLASSINFO(wxToolBar)))
00739         {
00740             // GetClientSize() doesn't get the best size for
00741             // a toolbar under some newer versions of wxWidgets,
00742             // so use GetBestSize()
00743             pinfo.best_size = pinfo.window->GetBestSize();
00744 
00745             // for some reason, wxToolBar::GetBestSize() is returning
00746             // a size that is a pixel shy of the correct amount.
00747             // I believe this to be the correct action, until
00748             // wxToolBar::GetBestSize() is fixed.  Is this assumption
00749             // correct?
00750             pinfo.best_size.y++;
00751         }
00752 
00753         if (pinfo.min_size != wxDefaultSize)
00754         {
00755             if (pinfo.best_size.x < pinfo.min_size.x)
00756                 pinfo.best_size.x = pinfo.min_size.x;
00757             if (pinfo.best_size.y < pinfo.min_size.y)
00758                 pinfo.best_size.y = pinfo.min_size.y;
00759         }
00760     }
00761 
00762     return true;
00763 }

bool wxAuiManager::DetachPane wxWindow *  window  ) 
 

Definition at line 854 of file framemanager.cpp.

00855 {
00856     int i, count;
00857     for (i = 0, count = m_panes.GetCount(); i < count; ++i)
00858     {
00859         wxAuiPaneInfo& p = m_panes.Item(i);
00860         if (p.window == window)
00861         {
00862             if (p.frame)
00863             {
00864                 // we have a floating frame which is being detached. We need to
00865                 // reparent it to m_frame and destroy the floating frame
00866 
00867                 // reduce flicker
00868                 p.window->SetSize(1,1);
00869                 p.frame->Show(false);
00870 
00871                 // reparent to m_frame and destroy the pane
00872                 p.window->Reparent(m_frame);
00873                 p.frame->SetSizer(NULL);
00874                 p.frame->Destroy();
00875                 p.frame = NULL;
00876             }
00877 
00878             // make sure there are no references to this pane in our uiparts,
00879             // just in case the caller doesn't call Update() immediately after
00880             // the DetachPane() call.  This prevets obscure crashes which would
00881             // happen at window repaint if the caller forgets to call Update()
00882             int pi, part_count;
00883             for (pi = 0, part_count = (int)m_uiparts.GetCount(); pi < part_count; ++pi)
00884             {
00885                 wxAuiDockUIPart& part = m_uiparts.Item(pi);
00886                 if (part.pane == &p)
00887                 {
00888                     m_uiparts.RemoveAt(pi);
00889                     part_count--;
00890                     pi--;
00891                     continue;
00892                 }
00893             }
00894 
00895             m_panes.RemoveAt(i);
00896             return true;
00897         }
00898     }
00899     return false;
00900 }

bool wxAuiManager::DoDrop wxAuiDockInfoArray &  docks,
wxAuiPaneInfoArray &  panes,
wxAuiPaneInfo drop,
const wxPoint &  pt,
const wxPoint &  action_offset = wxPoint(0, 0)
[protected]
 

Definition at line 2249 of file framemanager.cpp.

02254 {
02255     wxSize cli_size = m_frame->GetClientSize();
02256 
02257     wxAuiPaneInfo drop = target;
02258 
02259 
02260     // The result should always be shown
02261     drop.Show();
02262 
02263 
02264     // Check to see if the pane has been dragged outside of the window
02265     // (or near to the outside of the window), if so, dock it along the edge
02266 
02267 
02268     int layer_insert_offset = auiLayerInsertOffset;
02269     if (target.IsToolbar())
02270         layer_insert_offset = 0;
02271 
02272     if (pt.x < layer_insert_offset &&
02273         pt.x > layer_insert_offset-auiLayerInsertPixels)
02274     {
02275         int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_LEFT),
02276                                     GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)),
02277                                     GetMaxLayer(docks, wxAUI_DOCK_TOP)) + 1;
02278         drop.Dock().Left().
02279              Layer(new_layer).
02280              Row(0).
02281              Position(pt.y - GetDockPixelOffset(drop) - offset.y);
02282         return ProcessDockResult(target, drop);
02283     }
02284     else if (pt.y < layer_insert_offset &&
02285              pt.y > layer_insert_offset-auiLayerInsertPixels)
02286     {
02287         int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_TOP),
02288                                     GetMaxLayer(docks, wxAUI_DOCK_LEFT)),
02289                                     GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1;
02290         drop.Dock().Top().
02291              Layer(new_layer).
02292              Row(0).
02293              Position(pt.x - GetDockPixelOffset(drop) - offset.x);
02294         return ProcessDockResult(target, drop);
02295     }
02296     else if (pt.x >= cli_size.x - layer_insert_offset &&
02297              pt.x < cli_size.x - layer_insert_offset + auiLayerInsertPixels)
02298     {
02299         int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_RIGHT),
02300                                     GetMaxLayer(docks, wxAUI_DOCK_TOP)),
02301                                     GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)) + 1;
02302         drop.Dock().Right().
02303              Layer(new_layer).
02304              Row(0).
02305              Position(pt.y - GetDockPixelOffset(drop) - offset.y);
02306         return ProcessDockResult(target, drop);
02307     }
02308     else if (pt.y >= cli_size.y - layer_insert_offset &&
02309              pt.y < cli_size.y - layer_insert_offset + auiLayerInsertPixels)
02310     {
02311         int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_BOTTOM),
02312                                     GetMaxLayer(docks, wxAUI_DOCK_LEFT)),
02313                                     GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1;
02314         drop.Dock().Bottom().
02315              Layer(new_layer).
02316              Row(0).
02317              Position(pt.x - GetDockPixelOffset(drop) - offset.x);
02318         return ProcessDockResult(target, drop);
02319     }
02320 
02321 
02322     wxAuiDockUIPart* part = HitTest(pt.x, pt.y);
02323 
02324 
02325     if (drop.IsToolbar())
02326     {
02327         if (!part || !part->dock)
02328             return false;
02329 
02330 
02331         // calculate the offset from where the dock begins
02332         // to the point where the user dropped the pane
02333         int dock_drop_offset = 0;
02334         if (part->dock->IsHorizontal())
02335             dock_drop_offset = pt.x - part->dock->rect.x - offset.x;
02336              else
02337             dock_drop_offset = pt.y - part->dock->rect.y - offset.y;
02338 
02339 
02340         // toolbars may only be moved in and to fixed-pane docks,
02341         // otherwise we will try to float the pane.  Also, the pane
02342         // should float if being dragged over center pane windows
02343         if (!part->dock->fixed || part->dock->dock_direction == wxAUI_DOCK_CENTER)
02344         {
02345             if ((m_flags & wxAUI_MGR_ALLOW_FLOATING) &&
02346                    (drop.IsFloatable() ||
02347                     (part->dock->dock_direction != wxAUI_DOCK_CENTER &&
02348                      part->dock->dock_direction != wxAUI_DOCK_NONE)))
02349             {
02350                 drop.Float();
02351             }
02352 
02353             return ProcessDockResult(target, drop);
02354         }
02355 
02356         drop.Dock().
02357              Direction(part->dock->dock_direction).
02358              Layer(part->dock->dock_layer).
02359              Row(part->dock->dock_row).
02360              Position(dock_drop_offset);
02361 
02362         if ((
02363             ((pt.y < part->dock->rect.y + 2) && part->dock->IsHorizontal()) ||
02364             ((pt.x < part->dock->rect.x + 2) && part->dock->IsVertical())
02365             ) && part->dock->panes.GetCount() > 1)
02366         {
02367             int row = drop.dock_row;
02368             DoInsertDockRow(panes, part->dock->dock_direction,
02369                             part->dock->dock_layer,
02370                             part->dock->dock_row);
02371             drop.dock_row = row;
02372         }
02373 
02374         if ((
02375             ((pt.y > part->dock->rect.y + part->dock->rect.height - 2 ) && part->dock->IsHorizontal()) ||
02376             ((pt.x > part->dock->rect.x + part->dock->rect.width - 2 ) && part->dock->IsVertical())
02377             ) && part->dock->panes.GetCount() > 1)
02378         {
02379             DoInsertDockRow(panes, part->dock->dock_direction,
02380                             part->dock->dock_layer,
02381                             part->dock->dock_row+1);
02382             drop.dock_row = part->dock->dock_row+1;
02383         }
02384 
02385         return ProcessDockResult(target, drop);
02386     }
02387 
02388 
02389 
02390 
02391     if (!part)
02392         return false;
02393 
02394     if (part->type == wxAuiDockUIPart::typePaneBorder ||
02395         part->type == wxAuiDockUIPart::typeCaption ||
02396         part->type == wxAuiDockUIPart::typeGripper ||
02397         part->type == wxAuiDockUIPart::typePaneButton ||
02398         part->type == wxAuiDockUIPart::typePane ||
02399         part->type == wxAuiDockUIPart::typePaneSizer ||
02400         part->type == wxAuiDockUIPart::typeDockSizer ||
02401         part->type == wxAuiDockUIPart::typeBackground)
02402     {
02403         if (part->type == wxAuiDockUIPart::typeDockSizer)
02404         {
02405             if (part->dock->panes.GetCount() != 1)
02406                 return false;
02407             part = GetPanePart(part->dock->panes.Item(0)->window);
02408             if (!part)
02409                 return false;
02410         }
02411 
02412 
02413 
02414         // If a normal frame is being dragged over a toolbar, insert it
02415         // along the edge under the toolbar, but over all other panes.
02416         // (this could be done much better, but somehow factoring this
02417         // calculation with the one at the beginning of this function)
02418         if (part->dock && part->dock->toolbar)
02419         {
02420             int layer = 0;
02421 
02422             switch (part->dock->dock_direction)
02423             {
02424                 case wxAUI_DOCK_LEFT:
02425                     layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_LEFT),
02426                                       GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)),
02427                                       GetMaxLayer(docks, wxAUI_DOCK_TOP));
02428                     break;
02429                 case wxAUI_DOCK_TOP:
02430                     layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_TOP),
02431                                       GetMaxLayer(docks, wxAUI_DOCK_LEFT)),
02432                                       GetMaxLayer(docks, wxAUI_DOCK_RIGHT));
02433                     break;
02434                 case wxAUI_DOCK_RIGHT:
02435                     layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_RIGHT),
02436                                       GetMaxLayer(docks, wxAUI_DOCK_TOP)),
02437                                       GetMaxLayer(docks, wxAUI_DOCK_BOTTOM));
02438                     break;
02439                 case wxAUI_DOCK_BOTTOM:
02440                     layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_BOTTOM),
02441                                       GetMaxLayer(docks, wxAUI_DOCK_LEFT)),
02442                                       GetMaxLayer(docks, wxAUI_DOCK_RIGHT));
02443                     break;
02444             }
02445 
02446             DoInsertDockRow(panes, part->dock->dock_direction,
02447                             layer, 0);
02448             drop.Dock().
02449                  Direction(part->dock->dock_direction).
02450                  Layer(layer).Row(0).Position(0);
02451             return ProcessDockResult(target, drop);
02452         }
02453 
02454 
02455         if (!part->pane)
02456             return false;
02457 
02458         part = GetPanePart(part->pane->window);
02459         if (!part)
02460             return false;
02461 
02462         bool insert_dock_row = false;
02463         int insert_row = part->pane->dock_row;
02464         int insert_dir = part->pane->dock_direction;
02465         int insert_layer = part->pane->dock_layer;
02466 
02467         switch (part->pane->dock_direction)
02468         {
02469             case wxAUI_DOCK_TOP:
02470                 if (pt.y >= part->rect.y &&
02471                     pt.y < part->rect.y+auiInsertRowPixels)
02472                         insert_dock_row = true;
02473                 break;
02474             case wxAUI_DOCK_BOTTOM:
02475                 if (pt.y > part->rect.y+part->rect.height-auiInsertRowPixels &&
02476                     pt.y <= part->rect.y + part->rect.height)
02477                         insert_dock_row = true;
02478                 break;
02479             case wxAUI_DOCK_LEFT:
02480                 if (pt.x >= part->rect.x &&
02481                     pt.x < part->rect.x+auiInsertRowPixels)
02482                         insert_dock_row = true;
02483                 break;
02484             case wxAUI_DOCK_RIGHT:
02485                 if (pt.x > part->rect.x+part->rect.width-auiInsertRowPixels &&
02486                     pt.x <= part->rect.x+part->rect.width)
02487                         insert_dock_row = true;
02488                 break;
02489             case wxAUI_DOCK_CENTER:
02490             {
02491                 // "new row pixels" will be set to the default, but
02492                 // must never exceed 20% of the window size
02493                 int new_row_pixels_x = auiNewRowPixels;
02494                 int new_row_pixels_y = auiNewRowPixels;
02495 
02496                 if (new_row_pixels_x > (part->rect.width*20)/100)
02497                     new_row_pixels_x = (part->rect.width*20)/100;
02498 
02499                 if (new_row_pixels_y > (part->rect.height*20)/100)
02500                     new_row_pixels_y = (part->rect.height*20)/100;
02501 
02502 
02503                 // determine if the mouse pointer is in a location that
02504                 // will cause a new row to be inserted.  The hot spot positions
02505                 // are along the borders of the center pane
02506 
02507                 insert_layer = 0;
02508                 insert_dock_row = true;
02509                 if (pt.x >= part->rect.x &&
02510                     pt.x < part->rect.x+new_row_pixels_x)
02511                         insert_dir = wxAUI_DOCK_LEFT;
02512                  else
02513                 if (pt.y >= part->rect.y &&
02514                     pt.y < part->rect.y+new_row_pixels_y)
02515                         insert_dir = wxAUI_DOCK_TOP;
02516                  else
02517                 if (pt.x >= part->rect.x + part->rect.width-new_row_pixels_x &&
02518                     pt.x < part->rect.x + part->rect.width)
02519                         insert_dir = wxAUI_DOCK_RIGHT;
02520                  else
02521                 if (pt.y >= part->rect.y+ part->rect.height-new_row_pixels_y &&
02522                     pt.y < part->rect.y + part->rect.height)
02523                         insert_dir = wxAUI_DOCK_BOTTOM;
02524                  else
02525                 return false;
02526 
02527                 insert_row = GetMaxRow(panes, insert_dir, insert_layer) + 1;
02528             }
02529         }
02530 
02531         if (insert_dock_row)
02532         {
02533             DoInsertDockRow(panes, insert_dir, insert_layer, insert_row);
02534             drop.Dock().Direction(insert_dir).
02535                         Layer(insert_layer).
02536                         Row(insert_row).
02537                         Position(0);
02538             return ProcessDockResult(target, drop);
02539         }
02540 
02541         // determine the mouse offset and the pane size, both in the
02542         // direction of the dock itself, and perpendicular to the dock
02543 
02544         int offset, size;
02545 
02546         if (part->orientation == wxVERTICAL)
02547         {
02548             offset = pt.y - part->rect.y;
02549             size = part->rect.GetHeight();
02550         }
02551          else
02552         {
02553             offset = pt.x - part->rect.x;
02554             size = part->rect.GetWidth();
02555         }
02556 
02557         int drop_position = part->pane->dock_pos;
02558 
02559         // if we are in the top/left part of the pane,
02560         // insert the pane before the pane being hovered over
02561         if (offset <= size/2)
02562         {
02563             drop_position = part->pane->dock_pos;
02564             DoInsertPane(panes,
02565                          part->pane->dock_direction,
02566                          part->pane->dock_layer,
02567                          part->pane->dock_row,
02568                          part->pane->dock_pos);
02569         }
02570 
02571         // if we are in the bottom/right part of the pane,
02572         // insert the pane before the pane being hovered over
02573         if (offset > size/2)
02574         {
02575             drop_position = part->pane->dock_pos+1;
02576             DoInsertPane(panes,
02577                          part->pane->dock_direction,
02578                          part->pane->dock_layer,
02579                          part->pane->dock_row,
02580                          part->pane->dock_pos+1);
02581         }
02582 
02583         drop.Dock().
02584              Direction(part->dock->dock_direction).
02585              Layer(part->dock->dock_layer).
02586              Row(part->dock->dock_row).
02587              Position(drop_position);
02588         return ProcessDockResult(target, drop);
02589     }
02590 
02591     return false;
02592 }

void wxAuiManager::DoFrameLayout  )  [protected]
 

Definition at line 2087 of file framemanager.cpp.

02088 {
02089     m_frame->Layout();
02090 
02091     int i, part_count;
02092     for (i = 0, part_count = m_uiparts.GetCount(); i < part_count; ++i)
02093     {
02094         wxAuiDockUIPart& part = m_uiparts.Item(i);
02095 
02096         // get the rectangle of the UI part
02097         // originally, this code looked like this:
02098         //    part.rect = wxRect(part.sizer_item->GetPosition(),
02099         //                       part.sizer_item->GetSize());
02100         // this worked quite well, with one exception: the mdi
02101         // client window had a "deferred" size variable
02102         // that returned the wrong size.  It looks like
02103         // a bug in wx, because the former size of the window
02104         // was being returned.  So, we will retrieve the part's
02105         // rectangle via other means
02106 
02107 
02108         part.rect = part.sizer_item->GetRect();
02109         int flag = part.sizer_item->GetFlag();
02110         int border = part.sizer_item->GetBorder();
02111         if (flag & wxTOP)
02112         {
02113             part.rect.y -= border;
02114             part.rect.height += border;
02115         }
02116         if (flag & wxLEFT)
02117         {
02118             part.rect.x -= border;
02119             part.rect.width += border;
02120         }
02121         if (flag & wxBOTTOM)
02122             part.rect.height += border;
02123         if (flag & wxRIGHT)
02124             part.rect.width += border;
02125 
02126 
02127         if (part.type == wxAuiDockUIPart::typeDock)
02128             part.dock->rect = part.rect;
02129         if (part.type == wxAuiDockUIPart::typePane)
02130             part.pane->rect = part.rect;
02131     }
02132 }

void wxAuiManager::DrawHintRect wxWindow *  pane_window,
const wxPoint &  pt,
const wxPoint &  offset
 

Definition at line 2746 of file framemanager.cpp.

02749 {
02750     wxRect rect;
02751 
02752     // we need to paint a hint rectangle; to find out the exact hint rectangle,
02753     // we will create a new temporary layout and then measure the resulting
02754     // rectangle; we will create a copy of the docking structures (m_dock)
02755     // so that we don't modify the real thing on screen
02756 
02757     int i, pane_count, part_count;
02758     wxAuiDockInfoArray docks;
02759     wxAuiPaneInfoArray panes;
02760     wxAuiDockUIPartArray uiparts;
02761     wxAuiPaneInfo hint = GetPane(pane_window);
02762     hint.name = wxT("__HINT__");
02763     hint.Show();
02764 
02765     if (!hint.IsOk())
02766         return;
02767 
02768     CopyDocksAndPanes(docks, panes, m_docks, m_panes);
02769 
02770     // remove any pane already there which bears the same window;
02771     // this happens when you are moving a pane around in a dock
02772     for (i = 0, pane_count = panes.GetCount(); i < pane_count; ++i)
02773     {
02774         if (panes.Item(i).window == pane_window)
02775         {
02776             RemovePaneFromDocks(docks, panes.Item(i));
02777             panes.RemoveAt(i);
02778             break;
02779         }
02780     }
02781 
02782     // find out where the new pane would be
02783     if (!DoDrop(docks, panes, hint, pt, offset))
02784     {
02785         HideHint();
02786         return;
02787     }
02788 
02789     panes.Add(hint);
02790 
02791     wxSizer* sizer = LayoutAll(panes, docks, uiparts, true);
02792     wxSize client_size = m_frame->GetClientSize();
02793     sizer->SetDimension(0, 0, client_size.x, client_size.y);
02794     sizer->Layout();
02795 
02796     for (i = 0, part_count = uiparts.GetCount();
02797          i < part_count; ++i)
02798     {
02799         wxAuiDockUIPart& part = uiparts.Item(i);
02800 
02801         if (part.type == wxAuiDockUIPart::typePaneBorder &&
02802             part.pane && part.pane->name == wxT("__HINT__"))
02803         {
02804             rect = wxRect(part.sizer_item->GetPosition(),
02805                           part.sizer_item->GetSize());
02806             break;
02807         }
02808     }
02809 
02810     delete sizer;
02811 
02812     if (rect.IsEmpty())
02813     {
02814         HideHint();
02815         return;
02816     }
02817 
02818     // actually show the hint rectangle on the screen
02819     m_frame->ClientToScreen(&rect.x, &rect.y);
02820     ShowHint(rect);
02821 }

wxAuiPaneInfoArray & wxAuiManager::GetAllPanes  ) 
 

Definition at line 493 of file framemanager.cpp.

00494 {
00495     return m_panes;
00496 }

wxAuiDockArt * wxAuiManager::GetArtProvider  )  const
 

Definition at line 658 of file framemanager.cpp.

00659 {
00660     return m_art;
00661 }

int wxAuiManager::GetDockPixelOffset wxAuiPaneInfo test  )  [protected]
 

Definition at line 2167 of file framemanager.cpp.

02168 {
02169     // the only way to accurately calculate the dock's
02170     // offset is to actually run a theoretical layout
02171 
02172     int i, part_count, dock_count;
02173     wxAuiDockInfoArray docks;
02174     wxAuiPaneInfoArray panes;
02175     wxAuiDockUIPartArray uiparts;
02176     CopyDocksAndPanes(docks, panes, m_docks, m_panes);
02177     panes.Add(test);
02178 
02179     wxSizer* sizer = LayoutAll(panes, docks, uiparts, true);
02180     wxSize client_size = m_frame->GetClientSize();
02181     sizer->SetDimension(0, 0, client_size.x, client_size.y);
02182     sizer->Layout();
02183 
02184     for (i = 0, part_count = uiparts.GetCount(); i < part_count; ++i)
02185     {
02186         wxAuiDockUIPart& part = uiparts.Item(i);
02187         part.rect = wxRect(part.sizer_item->GetPosition(),
02188                            part.sizer_item->GetSize());
02189         if (part.type == wxAuiDockUIPart::typeDock)
02190             part.dock->rect = part.rect;
02191     }
02192 
02193     delete sizer;
02194 
02195     for (i = 0, dock_count = docks.GetCount(); i < dock_count; ++i)
02196     {
02197         wxAuiDockInfo& dock = docks.Item(i);
02198         if (test.dock_direction == dock.dock_direction &&
02199             test.dock_layer==dock.dock_layer && test.dock_row==dock.dock_row)
02200         {
02201             if (dock.IsVertical())
02202                 return dock.rect.y;
02203                  else
02204                 return dock.rect.x;
02205         }
02206     }
02207 
02208     return 0;
02209 }

unsigned int wxAuiManager::GetFlags  )  const
 

Definition at line 540 of file framemanager.cpp.

00541 {
00542     return m_flags;
00543 }

wxWindow * wxAuiManager::GetManagedWindow  )  const
 

Definition at line 653 of file framemanager.cpp.

00654 {
00655     return m_frame;
00656 }

wxAuiPaneInfo & wxAuiManager::GetPane const wxString &  name  ) 
 

Definition at line 480 of file framemanager.cpp.

00481 {
00482     int i, pane_count;
00483     for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
00484     {
00485         wxAuiPaneInfo& p = m_panes.Item(i);
00486         if (p.name == name)
00487             return p;
00488     }
00489     return wxAuiNullPaneInfo;
00490 }

wxAuiPaneInfo & wxAuiManager::GetPane wxWindow *  window  ) 
 

Definition at line 466 of file framemanager.cpp.

00467 {
00468     int i, pane_count;
00469     for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
00470     {
00471         wxAuiPaneInfo& p = m_panes.Item(i);
00472         if (p.window == window)
00473             return p;
00474     }
00475     return wxAuiNullPaneInfo;
00476 }

wxAuiDockUIPart * wxAuiManager::GetPanePart wxWindow *  pane  )  [protected]
 

Definition at line 2139 of file framemanager.cpp.

02140 {
02141     int i, part_count;
02142     for (i = 0, part_count = m_uiparts.GetCount(); i < part_count; ++i)
02143     {
02144         wxAuiDockUIPart& part = m_uiparts.Item(i);
02145         if (part.type == wxAuiDockUIPart::typePaneBorder &&
02146             part.pane && part.pane->window == wnd)
02147                 return &part;
02148     }
02149     for (i = 0, part_count = m_uiparts.GetCount(); i < part_count; ++i)
02150     {
02151         wxAuiDockUIPart& part = m_uiparts.Item(i);
02152         if (part.type == wxAuiDockUIPart::typePane &&
02153             part.pane && part.pane->window == wnd)
02154                 return &part;
02155     }
02156     return NULL;
02157 }

void wxAuiManager::GetPanePositionsAndSizes wxAuiDockInfo dock,
wxArrayInt &  positions,
wxArrayInt &  sizes
[protected]
 

Definition at line 1148 of file framemanager.cpp.

01151 {
01152     int caption_size = m_art->GetMetric(wxAUI_ART_CAPTION_SIZE);
01153     int pane_border_size = m_art->GetMetric(wxAUI_ART_PANE_BORDER_SIZE);
01154     int gripper_size = m_art->GetMetric(wxAUI_ART_GRIPPER_SIZE);
01155 
01156     positions.Empty();
01157     sizes.Empty();
01158 
01159     int offset, action_pane = -1;
01160     int pane_i, pane_count = dock.panes.GetCount();
01161 
01162     // find the pane marked as our action pane
01163     for (pane_i = 0; pane_i < pane_count; ++pane_i)
01164     {
01165         wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i));
01166 
01167         if (pane.state & wxAuiPaneInfo::actionPane)
01168         {
01169             wxASSERT_MSG(action_pane==-1, wxT("Too many fixed action panes"));
01170             action_pane = pane_i;
01171         }
01172     }
01173 
01174     // set up each panes default position, and
01175     // determine the size (width or height, depending
01176     // on the dock's orientation) of each pane
01177     for (pane_i = 0; pane_i < pane_count; ++pane_i)
01178     {
01179         wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i));
01180         positions.Add(pane.dock_pos);
01181         int size = 0;
01182 
01183         if (pane.HasBorder())
01184             size += (pane_border_size*2);
01185 
01186         if (dock.IsHorizontal())
01187         {
01188             if (pane.HasGripper() && !pane.HasGripperTop())
01189                 size += gripper_size;
01190             size += pane.best_size.x;
01191         }
01192          else