1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.MDIParentFrame:
==========================================================================================================================================
|phoenix_title| **wx.MDIParentFrame**
==========================================================================================================================================
An MDI (Multiple Document Interface) parent frame is a window which can contain MDI child frames in its client area which emulates the full desktop.
MDI is a user-interface model in which all the window reside inside the single parent window as opposed to being separate from each other. It remains popular despite dire warnings from Microsoft itself (which popularized this model in the first model) that MDI is obsolete.
An MDI parent frame always has a :ref:`wx.MDIClientWindow` associated with it, which is the parent for MDI child frames. In the simplest case, the client window takes up the entire parent frame area but it is also possible to resize it to be smaller in order to have other windows in the frame, a typical example is using a sidebar along one of the window edges.
The appearance of MDI applications differs between different ports. The classic MDI model, with child windows which can be independently moved, resized etc, is only available under MSW, which provides native support for it. In Mac ports, multiple top level windows are used for the MDI children too and the MDI parent frame itself is invisible, to accommodate the native look and feel requirements. In all the other ports, a tab-based MDI implementation (sometimes called TDI) is used and so at most one MDI child is visible at any moment (child frames are always maximized).
Although it is possible to have multiple MDI parent frames, a typical MDI application has a single MDI parent frame window inside which multiple MDI child frames, i.e. objects of class :ref:`wx.MDIChildFrame`, can be created.
.. _MDIParentFrame-styles:
|styles| Window Styles
================================
This class supports the following styles:
There are no special styles for this class, all :ref:`wx.Frame` styles apply to it in the usual way. The only exception is that ``wx.HSCROLL`` and ``wx.VSCROLL`` styles apply not to the frame itself but to the client window, so that using them enables horizontal and vertical scrollbars for this window and not the frame.
.. seealso:: :ref:`wx.MDIChildFrame`, :ref:`wx.MDIClientWindow`, :ref:`wx.Frame`, :ref:`wx.Dialog`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>MDIParentFrame</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.MDIParentFrame_inheritance.png" alt="Inheritance diagram of MDIParentFrame" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Frame.html" title="wx.Frame" alt="" coords="63,392,144,421"/> <area shape="rect" id="node6" href="wx.MDIParentFrame.html" title="wx.MDIParentFrame" alt="" coords="31,469,177,499"/> <area shape="rect" id="node2" href="wx.TopLevelWindow.html" title="wx.TopLevelWindow" alt="" coords="33,315,175,344"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,87,35"/> <area shape="rect" id="node7" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="48,83,159,112"/> <area shape="rect" id="node4" href="wx.NonOwnedWindow.html" title="wx.NonOwnedWindow" alt="" coords="25,237,183,267"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="59,160,148,189"/> <area shape="rect" id="node8" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="112,5,213,35"/> </map>
</p>
|
|sub_classes| Known Subclasses
==============================
:ref:`DocMDIParentFrame`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.MDIParentFrame.__init__` Default constructor.
:meth:`~wx.MDIParentFrame.ActivateNext` Activates the MDI child following the currently active one.
:meth:`~wx.MDIParentFrame.ActivatePrevious` Activates the MDI child preceding the currently active one.
:meth:`~wx.MDIParentFrame.ArrangeIcons` Arranges any iconized (minimized) MDI child windows.
:meth:`~wx.MDIParentFrame.Cascade` Arranges the MDI child windows in a cascade.
:meth:`~wx.MDIParentFrame.Create` Used in two-step frame construction.
:meth:`~wx.MDIParentFrame.GetActiveChild` Returns a pointer to the active MDI child, if there is one.
:meth:`~wx.MDIParentFrame.GetClientWindow` Returns a pointer to the client window.
:meth:`~wx.MDIParentFrame.GetWindowMenu` Returns the current MDI Window menu.
:meth:`~wx.MDIParentFrame.IsTDI` Returns whether the MDI implementation is tab-based.
:meth:`~wx.MDIParentFrame.OnCreateClient` Override this to return a different kind of client window.
:meth:`~wx.MDIParentFrame.SetWindowMenu` Replace the current MDI Window menu.
:meth:`~wx.MDIParentFrame.Tile` Tiles the MDI child windows either horizontally or vertically depending on whether `orient` is ``HORIZONTAL`` or ``VERTICAL`` .
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.MDIParentFrame.ActiveChild` See :meth:`~wx.MDIParentFrame.GetActiveChild`
:attr:`~wx.MDIParentFrame.ClientWindow` See :meth:`~wx.MDIParentFrame.GetClientWindow`
:attr:`~wx.MDIParentFrame.WindowMenu` See :meth:`~wx.MDIParentFrame.GetWindowMenu` and :meth:`~wx.MDIParentFrame.SetWindowMenu`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.MDIParentFrame(Frame)
**Possible constructors**::
MDIParentFrame()
MDIParentFrame(parent, id=ID_ANY, title=EmptyString,
pos=DefaultPosition, size=DefaultSize,
style=DEFAULT_FRAME_STYLE|VSCROLL|HSCROLL, name=FrameNameStr)
An MDI (Multiple Document Interface) parent frame is a window which
can contain MDI child frames in its client area which emulates the
full desktop.
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self)`
Default constructor.
Use :meth:`Create` for the objects created using this constructor.
**~~~**
**__init__** `(self, parent, id=ID_ANY, title=EmptyString, pos=DefaultPosition, size=DefaultSize, style=DEFAULT_FRAME_STYLE|VSCROLL|HSCROLL, name=FrameNameStr)`
Constructor, creating the window.
Notice that if you override virtual :meth:`OnCreateClient` method you shouldn't be using this constructor but the default constructor and :meth:`Create` as otherwise your overridden method is never going to be called because of the usual C++ virtual call resolution rules.
:param `parent`: The window parent. Usually is ``None``.
:type `parent`: wx.Window
:param `id`: The window identifier. It may take a value of ``ID_ANY`` to indicate a default value.
:type `id`: wx.WindowID
:param `title`: The caption to be displayed on the frame's title bar.
:type `title`: string
:param `pos`: The window position. The value :ref:`wx.DefaultPosition` indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
:type `pos`: wx.Point
:param `size`: The window size. The value :ref:`wx.DefaultSize` indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform.
:type `size`: wx.Size
:param `style`: The window style. Default value includes ``wx.HSCROLL`` and ``wx.VSCROLL`` styles.
:type `style`: long
:param `name`: The name of the window. This parameter is used to associate a name with the item, allowing the application user to set Motif resource values for individual windows.
:type `name`: string
Under wxMSW, 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.
.. seealso:: :meth:`Create` , :meth:`OnCreateClient`
**~~~**
.. method:: ActivateNext(self)
Activates the MDI child following the currently active one.
The MDI children are maintained in an ordered list and this function switches to the next element in this list, wrapping around the end of it if the currently active child is the last one.
.. seealso:: :meth:`ActivatePrevious`
.. method:: ActivatePrevious(self)
Activates the MDI child preceding the currently active one.
.. seealso:: :meth:`ActivateNext`
.. method:: ArrangeIcons(self)
Arranges any iconized (minimized) MDI child windows.
This method is only implemented in MSW MDI implementation and does nothing under the other platforms.
.. seealso:: :meth:`Cascade` , :meth:`Tile`
.. method:: Cascade(self)
Arranges the MDI child windows in a cascade.
This method is only implemented in MSW MDI implementation and does nothing under the other platforms.
.. seealso:: :meth:`Tile` , :meth:`ArrangeIcons`
.. method:: Create(self, parent, id=ID_ANY, title=EmptyString, pos=DefaultPosition, size=DefaultSize, style=DEFAULT_FRAME_STYLE|VSCROLL|HSCROLL, name=FrameNameStr)
Used in two-step frame construction.
See :ref:`wx.MDIParentFrame` for further details.
:param `parent`:
:type `parent`: wx.Window
:param `id`:
:type `id`: wx.WindowID
:param `title`:
:type `title`: string
:param `pos`:
:type `pos`: wx.Point
:param `size`:
:type `size`: wx.Size
:param `style`:
:type `style`: long
:param `name`:
:type `name`: string
:rtype: `bool`
.. method:: GetActiveChild(self)
Returns a pointer to the active MDI child, if there is one.
If there are any children at all this function returns a non-NULL pointer.
:rtype: :ref:`wx.MDIChildFrame`
.. method:: GetClientWindow(self)
Returns a pointer to the client window.
:rtype: :ref:`wx.MDIClientWindow`
.. seealso:: :meth:`OnCreateClient`
.. method:: GetWindowMenu(self)
Returns the current MDI Window menu.
Unless ``wx.FRAME_NO_WINDOW_MENU`` style was used, a default menu listing all the currently active children and providing the usual operations (tile, cascade, ...) on them is created automatically by the library and this function can be used to retrieve it. Notice that the default menu can be replaced by calling :meth:`SetWindowMenu` .
This function is currently not available under OS X.
:rtype: :ref:`wx.Menu`
:returns:
The current Window menu or ``None``.
.. staticmethod:: IsTDI()
Returns whether the MDI implementation is tab-based.
Currently only the MSW port uses the real MDI. In Mac ports the usual SDI is used, as common under this platforms, and all the other ports use TDI implementation.
TDI-based MDI applications have different appearance and functionality (e.g. child frames can't be minimized and only one of them is visible at any given time) so the application may need to adapt its interface somewhat depending on the return value of this function.
:rtype: `bool`
.. method:: OnCreateClient(self)
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 = MyParentFrame()
frame.Create(parent, myParentFrameId, "My Parent Frame")
You might wish to derive from :ref:`wx.MDIClientWindow` 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.
:rtype: :ref:`wx.MDIClientWindow`
.. seealso:: :meth:`GetClientWindow` , :ref:`wx.MDIClientWindow`
.. method:: SetWindowMenu(self, menu)
Replace the current MDI Window menu.
Ownership of the menu object passes to the frame when you call this function, i.e. the menu will be deleted by it when it's no longer needed (usually when the frame itself is deleted or when :meth:`SetWindowMenu` is called again).
To remove the window completely, you can use the ``wx.FRAME_NO_WINDOW_MENU`` window style but this function also allows to do it by passing ``None`` pointer as `menu`.
The menu may include the items with the following standard identifiers (but may use arbitrary text and help strings and bitmaps for them):
- ``ID_MDI_WINDOW_CASCADE``
- ``ID_MDI_WINDOW_TILE_HORZ``
- ``ID_MDI_WINDOW_TILE_VERT``
- ``ID_MDI_WINDOW_ARRANGE_ICONS``
- ``ID_MDI_WINDOW_PREV``
- ``ID_MDI_WINDOW_NEXT`` All of which are handled by :ref:`wx.MDIParentFrame` itself. If any other commands are used in the menu, the derived frame should handle them.
This function is currently not available under OS X.
:param `menu`: The menu to be used instead of the standard MDI Window menu or ``None``.
:type `menu`: wx.Menu
.. method:: Tile(self, orient=HORIZONTAL)
Tiles the MDI child windows either horizontally or vertically depending on whether `orient` is ``HORIZONTAL`` or ``VERTICAL`` .
This method is only implemented in MSW MDI implementation and does nothing under the other platforms.
:param `orient`:
:type `orient`: wx.Orientation
.. attribute:: ActiveChild
See :meth:`~wx.MDIParentFrame.GetActiveChild`
.. attribute:: ClientWindow
See :meth:`~wx.MDIParentFrame.GetClientWindow`
.. attribute:: WindowMenu
See :meth:`~wx.MDIParentFrame.GetWindowMenu` and :meth:`~wx.MDIParentFrame.SetWindowMenu`
|