<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<!-- THIS FILE IS GENERATED DO NOT EDIT -->


<erlref>
<header>
  <copyright>
    <year>2020</year><year>2021</year>
    <holder>wxWidgets team.</holder></copyright>
  <legalnotice>Licensed under the wxWindows Free Documentation Licence, Version 3
  </legalnotice>
  <title>wxLayoutAlgorithm</title>
</header>
<module>wxLayoutAlgorithm</module>
<modulesummary>Functions for wxLayoutAlgorithm class</modulesummary>
<description><p><seeerl marker="wxLayoutAlgorithm"><c>wxLayoutAlgorithm</c></seeerl> implements layout of subwindows in MDI or SDI frames. It sends a <c>wxCalculateLayoutEvent</c> (not implemented in wx) event to children of the frame, asking them for information about their size. For MDI parent frames, the algorithm allocates the remaining space to the MDI client window (which contains the MDI child frames).
      </p><p>For SDI (normal) frames, a 'main' window is specified as taking up the remaining space.
      </p><p>Because the event system is used, this technique can be applied to any windows, which are not necessarily 'aware' of the layout classes (no virtual functions in <seeerl marker="wxWindow"><c>wxWindow</c></seeerl> refer to <seeerl marker="wxLayoutAlgorithm"><c>wxLayoutAlgorithm</c></seeerl> or its events). However, you may wish to use <seeerl marker="wxSashLayoutWindow"><c>wxSashLayoutWindow</c></seeerl> for your subwindows since this class provides handlers for the required events, and accessors to specify the desired size of the window. The sash behaviour in the base class can be used, optionally, to make the windows user-resizable.
      </p><p><seeerl marker="wxLayoutAlgorithm"><c>wxLayoutAlgorithm</c></seeerl> is typically used in IDE (integrated development environment) applications, where there are several resizable windows in addition to the MDI client window, or other primary editing window. Resizable windows might include toolbars, a project window, and a window for displaying error and warning messages.
      </p><p>When a window receives an OnCalculateLayout event, it should call SetRect in the given event object, to be the old supplied rectangle minus whatever space the window takes up. It should also set its own size accordingly. <c>wxSashLayoutWindow::OnCalculateLayout</c> (not implemented in wx) generates an OnQueryLayoutInfo event which it sends to itself to determine the orientation, alignment and size of the window, which it gets from internal member variables set by the application.
      </p><p>The algorithm works by starting off with a rectangle equal to the whole frame client area. It iterates through the frame children, generating wxLayoutAlgorithm::OnCalculateLayout events which subtract the window size and return the remaining rectangle for the next window to process. It is assumed (by <c>wxSashLayoutWindow::OnCalculateLayout</c> (not implemented in wx)) that a window stretches the full dimension of the frame client, according to the orientation it specifies. For example, a horizontal window will stretch the full width of the remaining portion of the frame client area. In the other orientation, the window will be fixed to whatever size was specified by wxLayoutAlgorithm::OnQueryLayoutInfo. An alignment setting will make the window 'stick' to the left, top, right or bottom of the remaining client area. This scheme implies that order of window creation is important. Say you wish to have an extra toolbar at the top of the frame, a project window to the left of the MDI client window, and an output window above the status bar. You should therefore create the windows in this order: toolbar, output window, project window. This ensures that the toolbar and output window take up space at the top and bottom, and then the remaining height in-between is used for the project window.
      </p><p><seeerl marker="wxLayoutAlgorithm"><c>wxLayoutAlgorithm</c></seeerl> is quite independent of the way in which wxLayoutAlgorithm::OnCalculateLayout chooses to interpret a window's size and alignment. Therefore you could implement a different window class with a new wxLayoutAlgorithm::OnCalculateLayout event handler, that has a more sophisticated way of laying out the windows. It might allow specification of whether stretching occurs in the specified orientation, for example, rather than always assuming stretching. (This could, and probably should, be added to the existing implementation).
      </p><p>Note: <seeerl marker="wxLayoutAlgorithm"><c>wxLayoutAlgorithm</c></seeerl> has nothing to do with <c>wxLayoutConstraints</c> (not implemented in wx). It is an alternative way of specifying layouts for which the normal constraint system is unsuitable.
      </p><p>See: <seeerl marker="wxSashEvent"><c>wxSashEvent</c></seeerl>, <seeerl marker="wxSashLayoutWindow"><c>wxSashLayoutWindow</c></seeerl>, <url href="https://docs.wxwidgets.org/3.1/overview_events.html#overview_events">Overview events</url>
      </p>
  <p>wxWidgets docs: <url href="https://docs.wxwidgets.org/3.1/classwx_layout_algorithm.html">wxLayoutAlgorithm</url></p>
  </description>
<datatypes><datatype><name name="wxLayoutAlgorithm"/></datatype></datatypes>

<funcs>
  <func>
    <name name="new" arity="0" clause_i="1" since=""/>
    <fsummary>Default constructor. </fsummary>
    <desc><p>Default constructor. 
      </p></desc>
  </func>
  
  <func>
    <name name="destroy" arity="1" clause_i="1" since=""/>
    <fsummary>Destructor. </fsummary>
    <desc><p>Destructor. 
      </p></desc>
  </func>
  
  <func>
    <name name="layoutFrame" arity="2" clause_i="1" since=""/>
    <fsummary>See: <c>layoutFrame/3</c></fsummary>
  </func>
  
  <func>
    <name name="layoutFrame" arity="3" clause_i="1" since=""/>
    <fsummary>Lays out the children of a normal frame. </fsummary>
    <desc><p>Lays out the children of a normal frame. 
      </p><p><c>mainWindow</c> is set to occupy the remaining space. This function simply calls <seemfa marker="#layoutWindow/3"><c>layoutWindow/3</c></seemfa>. 
      </p></desc>
  </func>
  
  <func>
    <name name="layoutMDIFrame" arity="2" clause_i="1" since=""/>
    <fsummary>See: <c>layoutMDIFrame/3</c></fsummary>
  </func>
  
  <func>
    <name name="layoutMDIFrame" arity="3" clause_i="1" since=""/>
    <fsummary>Lays out the children of an MDI parent frame. </fsummary>
    <desc><p>Lays out the children of an MDI parent frame. 
      </p><p>If <c>rect</c> is non-NULL, the given rectangle will be used as a starting point instead of the frame's client area. The MDI client window is set to occupy the remaining space. 
      </p></desc>
  </func>
  
  <func>
    <name name="layoutWindow" arity="2" clause_i="1" since=""/>
    <fsummary>See: <c>layoutWindow/3</c></fsummary>
  </func>
  
  <func>
    <name name="layoutWindow" arity="3" clause_i="1" since=""/>
    <fsummary>Lays out the children of a normal frame or other window. </fsummary>
    <desc><p>Lays out the children of a normal frame or other window. 
      </p><p><c>mainWindow</c> is set to occupy the remaining space. If this is not specified, then the last window that responds to a calculate layout event in query mode will get the remaining space (that is, a non-query OnCalculateLayout event will not be sent to this window and the window will be set to the remaining size). 
      </p></desc>
  </func>
  </funcs>
</erlref>
