wxmdiparentframean mdi (multiple document interface) parent frame is a window which can contain mdi child frames in its own 'desktop'. it is a convenient way to avoid window clutter, and is used in many popular windows applications, such as microsoft word(tm). derived from
wxframe include files <wx/mdi.h> remarks there may be multiple mdi parent frames in a single application, but this probably only makes sense within programming development environments. child frames may be of class wxmdichildframe (contained within the parent frame) or wxframe (shown as a top-level frame). an mdi parent frame always has a wxmdiclientwindow associated with it, which is the parent for mdi child frames. this client window may be resized to accommodate non-mdi windows, as seen in microsoft visual c++ (tm) and microsoft publisher (tm), where a documentation window is placed to one side of the workspace. mdi remains popular despite dire warnings from microsoft itself that mdi is an obsolete user interface style. the implementation is native in windows, and simulated under motif. under motif, the child window frames will often have a different appearance from other frames because the window decorations are simulated. window styles
see also window styles overview. see also wxmdichildframe, wxmdiclientwindow, wxframe, wxdialog members
wxmdiparentframe::wxmdiparentframe
wxmdiparentframe::wxmdiparentframewxmdiparentframe() default constructor. wxmdiparentframe(wxwindow* parent, wxwindowid id, const wxstring& title, const wxpoint& pos = wxdefaultposition, const wxsize& size = wxdefaultsize, long style = wxdefault_frame_style | wxvscroll | wxhscroll, const wxstring& name = "frame") constructor, creating the window. parameters parent
id
title
pos
size
style
name
remarks during the construction of the frame, the client window will be created. to use a different class from wxmdiclientwindow, override wxmdiparentframe::oncreateclient. under windows 95, the client window will automatically have a sunken border style when the active child is not maximized, and no border style when a child is maximized. see also wxmdiparentframe::create, wxmdiparentframe::oncreateclient
wxmdiparentframe::~wxmdiparentframe~wxmdiparentframe() destructor. destroys all child windows and menu bar if present.
wxmdiparentframe::activatenextvoid activatenext() activates the mdi child following the currently active one. see also wxmdiparentframe::activateprevious
wxmdiparentframe::activatepreviousvoid activateprevious() activates the mdi child preceding the currently active one. see also wxmdiparentframe::activatenext
wxmdiparentframe::arrangeiconsvoid arrangeicons() arranges any iconized (minimized) mdi child windows. see also wxmdiparentframe::cascade, wxmdiparentframe::tile
wxmdiparentframe::cascadevoid cascade() arranges the mdi child windows in a cascade. see also wxmdiparentframe::tile, wxmdiparentframe::arrangeicons
wxmdiparentframe::createbool create(wxwindow* parent, wxwindowid id, const wxstring& title, const wxpoint& pos = wxdefaultposition, const wxsize& size = wxdefaultsize, long style = wxdefault_frame_style | wxvscroll | wxhscroll, const wxstring& name = "frame") used in two-step frame construction. see wxmdiparentframe::wxmdiparentframe for further details.
wxmdiparentframe::getclientsizevirtual void getclientsize(int* width, int* height) const this gets the size of the frame 'client area' in pixels. parameters width
height
remarks the client area is the area which may be drawn on by the programmer, excluding title bar, border, status bar, and toolbar if present. if you wish to manage your own toolbar (or perhaps you have more than one), provide an onsize event handler. call getclientsize to find how much space there is for your windows and don't forget to set the size and position of the mdi client window as well as your toolbar and other windows (but not the status bar). if you have set a toolbar with wxmdiparentframe::settoolbar, the client size returned will have subtracted the toolbar height. however, the available positions for the client window and other windows of the frame do not start at zero - you must add the toolbar height. the position and size of the status bar and toolbar (if known to the frame) are always managed by wxmdiparentframe, regardless of what behaviour is defined in your onsize event handler. however, the client window position and size are always set in onsize, so if you override this event handler, make sure you deal with the client window. you do not have to manage the size and position of mdi child windows, since they are managed automatically by the client window. see also wxmdiparentframe::gettoolbar, wxmdiparentframe::settoolbar, wxmdiclientwindow wxpython note: the wxpython version of this method takes no arguments and returns a tuple containing width and height.
wxmdiparentframe::getactivechildwxmdichildframe* getactivechild() const returns a pointer to the active mdi child, if there is one.
wxmdiparentframe::getclientwindowwxmdiclientwindow* getclientwindow() const returns a pointer to the client window. see also wxmdiparentframe::oncreateclient
wxmdiparentframe::gettoolbarvirtual wxwindow* gettoolbar() const returns the window being used as the toolbar for this frame. see also
wxmdiparentframe::getwindowmenuwxmenu* getwindowmenu() const returns the current window menu (added by wxwidgets to the menubar). this function is available under windows only.
wxmdiparentframe::oncreateclientvirtual wxmdiclientwindow* oncreateclient() override this to return a different kind of client window. if you override this function, you must create your parent frame in two stages, or your function will never be called, due to the way c++ treats virtual functions called from constructors. for example:
frame = new myparentframe; frame->create(parent, myparentframeid, wxt("my parent frame"));remarks you might wish to derive from wxmdiclientwindow in order to implement different erase behaviour, for example, such as painting a bitmap on the background. note that it is probably impossible to have a client window that scrolls as well as painting a bitmap or pattern, since in onscroll, the scrollbar positions always return zero. (solutions to: julian.smart@btopenworld.com). see also wxmdiparentframe::getclientwindow, wxmdiclientwindow
wxmdiparentframe::settoolbarvirtual void settoolbar(wxwindow* toolbar) sets the window to be used as a toolbar for this mdi parent window. it saves the application having to manage the positioning of the toolbar mdi client window. parameters toolbar
remarks when the frame is resized, the toolbar is resized to be the width of the frame client area, and the toolbar height is kept the same. the parent of the toolbar must be this frame. if you wish to manage your own toolbar (or perhaps you have more than one), don't call this function, and instead manage your subwindows and the mdi client window by providing an onsize event handler. call wxmdiparentframe::getclientsize to find how much space there is for your windows. note that sdi (normal) frames and mdi child windows must always have their toolbars managed by the application. see also wxmdiparentframe::gettoolbar, wxmdiparentframe::getclientsize
wxmdiparentframe::setwindowmenuvoid setwindowmenu(wxmenu* menu) call this to change the current window menu. ownership of the menu object passes to the frame when you call this function. this call is available under windows only. to remove the window completely, use the wxframe_no_window_menu window style.
wxmdiparentframe::tilevoid tile(wxorientation orient = wxhorizontal) tiles the mdi child windows either horizontally or vertically depending on whether orient is wxhorizontal or wxvertical. currently only implemented for msw, does nothing under the other platforms. see also wxmdiparentframe::cascade, wxmdiparentframe::arrangeicons
|