home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kmdichildarea.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  8.6 KB  |  305 lines

  1. //----------------------------------------------------------------------------
  2. //    filename             : kmdichildarea.h
  3. //----------------------------------------------------------------------------
  4. //    Project              : KDE MDI extension
  5. //
  6. //    begin                : 07/1999       by Szymon Stefanek as part of kvirc
  7. //                                         (an IRC application)
  8. //    changes              : 09/1999       by Falk Brettschneider to create an
  9. //                           - 06/2000     stand-alone Qt extension set of
  10. //                                         classes and a Qt-based library
  11. //                           2000-2003     maintained by the KDevelop project
  12. //
  13. //    copyright            : (C) 1999-2003 by Falk Brettschneider
  14. //                                         and
  15. //                                         Szymon Stefanek (stefanek@tin.it)
  16. //    email                :  falkbr@kdevelop.org (Falk Brettschneider)
  17. //----------------------------------------------------------------------------
  18. //
  19. //----------------------------------------------------------------------------
  20. //
  21. //    This program is free software; you can redistribute it and/or modify
  22. //    it under the terms of the GNU Library General Public License as
  23. //    published by the Free Software Foundation; either version 2 of the
  24. //    License, or (at your option) any later version.
  25. //
  26. //----------------------------------------------------------------------------
  27.  
  28. #ifndef _KMDI_CHILD_AREA_H_
  29. #define _KMDI_CHILD_AREA_H_
  30.  
  31. #include <qframe.h>
  32. #include <qptrlist.h>
  33.  
  34. #include "kmdichildfrm.h"
  35. #include "kmdichildview.h"
  36.  
  37. class KMdiChildAreaPrivate;
  38.  
  39. /**
  40.   * @short Internal class.
  41.   *
  42.   * The main frame widget KMdiMainFrm consists of 2 child widgets. One is this class.
  43.   * It's the widget where the child frames (emulated toplevel MDI views) live in.
  44.   * This class is the manager for the child frame widgets because it controls the
  45.   * Z-order widget stack of KMdiChildFrm's.
  46.   * It provides all placing and positioning algorithms for docked (attached) MDI views.
  47.   *
  48.   * KMdiChildArea doesn't know anything about the actual MDI views. It only knows
  49.   * and manages the frame widgets of attached MDI views.
  50.   * All actions and stuff concerning only to childframes are handled here.
  51.   */
  52. class KMDI_EXPORT KMdiChildArea : public QFrame
  53. {
  54.     friend class KMdiChildFrmCaption;
  55.     friend class KMdiChildFrm;
  56.  
  57. Q_OBJECT
  58.  
  59.     // attributes
  60. public:
  61.     /**
  62.      * Z Order stack of KMdiChildFrm childframe windows (top=last)
  63.      */
  64.     QPtrList<KMdiChildFrm> *m_pZ; //Auto delete enabled
  65.  
  66.     /**
  67.      * the default size of an newly created childframe
  68.      */
  69.     QSize m_defaultChildFrmSize;
  70. protected:
  71.     /**
  72.      * The MDI childframe window caption font
  73.      */
  74.     QFont m_captionFont;
  75.  
  76.     /**
  77.      * The foreground color of the active MDI childframe window caption
  78.      */
  79.     QColor m_captionActiveBackColor;
  80.  
  81.     /**
  82.      * The background color of the active MDI childframe window captions
  83.      */
  84.     QColor m_captionActiveForeColor;
  85.  
  86.     /**
  87.      * The foreground color of inactive MDI childframe window captions
  88.      */
  89.     QColor m_captionInactiveBackColor;
  90.  
  91.     /**
  92.      * The background color of inactive MDI childframe window captions
  93.      */
  94.     QColor m_captionInactiveForeColor;
  95.  
  96.     int m_captionFontLineSpacing;
  97.  
  98.     // methods
  99. public:
  100.  
  101.     /**
  102.      * Consruction. Note: This class needn't to know about KMdiMainFrm .
  103.      */
  104.     KMdiChildArea( QWidget *parent );
  105.  
  106.     /**
  107.      * Destructor : THERE should be no child windows anymore...
  108.      * Howewer it simply deletes all the child widgets :)
  109.      */
  110.     ~KMdiChildArea();
  111.  
  112.     /**
  113.      * Appends a new KMdiChildFrm to this manager.
  114.      * The child is shown,raised and gets focus if this window has it.
  115.      */
  116.     void manageChild( KMdiChildFrm *lpC, bool bShow = true, bool bCascade = true );
  117.  
  118.     /**
  119.      * Destroys a managed KMdiChildFrm
  120.      * Also deletes the client attached to this child.
  121.      */
  122.     void destroyChild( KMdiChildFrm* child, bool focusTopChild = true );
  123.  
  124.     /**
  125.      * Destroys a managed KMdiChildFrm
  126.      * Clients attached to the KMdiChildFrm are not deleted.
  127.      */
  128.     void destroyChildButNotItsView( KMdiChildFrm *lpC, bool bFocusTopChild = true );
  129.  
  130.     /**
  131.      * Brings the child to the top of the stack
  132.      * The child is focused if setFocus is true. If setFocus is false, the
  133.      * child is just raised.
  134.      */
  135.     void setTopChild( KMdiChildFrm* child, bool setFocus = false );
  136.  
  137.     /**
  138.      * Returns the topmost child (the active one) or 0 if there are no children.
  139.      * Note that the topmost child may be also hidded , if ALL the windows are minimized.
  140.      */
  141.     inline KMdiChildFrm * topChild() const { return m_pZ->last(); }
  142.  
  143.     /**
  144.      * Returns the number of visible children
  145.      */
  146.     int getVisibleChildCount() const;
  147.  
  148.     /**
  149.      * Calculates the cascade point for the given index. If index is -1
  150.      * the cascade point is calculated for the window following the last window
  151.      * @param indexOfWindow the index of the window in relation the z-ordered window list
  152.      */
  153.     QPoint getCascadePoint( int indexOfWindow = -1 );
  154.  
  155.     /**
  156.      * Sets the MDI childframe window caption font
  157.      * A relayout does not occur when using this function
  158.      */
  159.     void setMdiCaptionFont( const QFont &fnt );
  160.  
  161.     /**
  162.      * Sets the foreground color of the active MDI childframe window caption
  163.      * A relayout does not occur when using this function
  164.      */
  165.     void setMdiCaptionActiveForeColor( const QColor &clr );
  166.  
  167.     /**
  168.      * Sets the background color of the active MDI childframe window captions
  169.      * A relayout does not occur when using this function
  170.      */
  171.     void setMdiCaptionActiveBackColor( const QColor &clr );
  172.  
  173.     /**
  174.      * Sets the foreground color of inactive MDI childframe window captions
  175.      * A relayout does not occur when using this function
  176.      */
  177.     void setMdiCaptionInactiveForeColor( const QColor &clr );
  178.  
  179.     /**
  180.      * Sets the background color of inactive MDI childframe window captions
  181.      * A relayout does not occur when using this function
  182.      */
  183.     void setMdiCaptionInactiveBackColor( const QColor &clr );
  184.  
  185.     /**
  186.      * Gets all caption colors, consistent with current WM settings
  187.      * (or other Desktop settings e.g. system settings for win32)
  188.      * This method is useful not only for KMDI child windows.
  189.      * Colors are returned via activeBG, activeFG, inactiveBG, inactiveFG references.
  190.      *
  191.      * @deprecated Use KGlobalSettings::activeTitleColor(), KGlobalSettings::activeTextColor(),
  192.      * KGlobalSettings::inactiveTitleColor() and KGlobalSettings::inactiveTextColor() instead.
  193.      */
  194.     static void getCaptionColors( const QPalette &pal, QColor &activeBG, QColor &activeFG,
  195.                                   QColor &inactiveBG, QColor &inactiveFG ) KDE_DEPRECATED;
  196.  
  197. public slots:
  198.     /**
  199.      * Cascades all windows resizing them to the minimum size.
  200.      */
  201.     void cascadeWindows();
  202.  
  203.     /**
  204.      * Cascades all windows resizing them to the maximum available size.
  205.      */
  206.     void cascadeMaximized();
  207.  
  208.     /**
  209.      * Maximize all windows but only in vertical direction
  210.      */
  211.     void expandVertical();
  212.  
  213.     /**
  214.      * Maximize all windows but only in horizontal direction
  215.      */
  216.     void expandHorizontal();
  217.  
  218.     /**
  219.      * Gives focus to the topmost child if it doesn't get focus
  220.      * automatically or you want to wait to give it focus
  221.      */
  222.     void focusTopChild();
  223.  
  224.     /**
  225.      * Tile Pragma
  226.      */
  227.     void tilePragma();
  228.  
  229.     /**
  230.      * Tile Anodine
  231.      */
  232.     void tileAnodine();
  233.  
  234.     /**
  235.      * Tile all the windows in the child area vertically
  236.      */
  237.     void tileVertically();
  238.  
  239.     /**
  240.      * Position and layout the minimized child frames
  241.      */
  242.     void layoutMinimizedChildren();
  243.  
  244. protected:
  245.  
  246.     /**
  247.      * Internally used for the tile algorithm
  248.      */
  249.     void tileAllInternal( int maxWnds );
  250.  
  251.     /**
  252.      * Automatically resizes a maximized MDI view and layouts the positions of minimized MDI views.
  253.      */
  254.     virtual void resizeEvent( QResizeEvent * );
  255.  
  256.     /**
  257.      * Shows the 'Window' popup menu on right mouse button click
  258.      */
  259.     void mousePressEvent( QMouseEvent *e );
  260.  
  261.     /**
  262.      * Internally used. Actions that are necessary when an MDI view gets minimized
  263.      */
  264.     void childMinimized( KMdiChildFrm *lpC, bool bWasMaximized );
  265.  
  266. signals:
  267.     /**
  268.      * Signals that there aren't maximized child frames any more
  269.      */
  270.     void noMaximizedChildFrmLeft( KMdiChildFrm* );
  271.  
  272.     /**
  273.      * Signals that the child frames are maximized now
  274.      */
  275.     void nowMaximized( bool );
  276.  
  277.     /**
  278.      * Signals a KMdiMainFrm that the signal/slot connections of the system buttons in the
  279.      * menubar (only in Maximize mode) must be updated to another MDI view because the focused
  280.      * MDI view has changed
  281.      * @internal
  282.      */
  283.     void sysButtonConnectionsMustChange( KMdiChildFrm*, KMdiChildFrm* );
  284.  
  285.     /**
  286.      * Signals a KMdiMainFrm that the 'Window' popup menu must be shown
  287.      * @internal
  288.      */
  289.     void popupWindowMenu( QPoint );
  290.  
  291.     /**
  292.      * Signals that the last attached (docked) MDI view has been closed.
  293.      * Note: Detached MDI views can remain.
  294.      */
  295.     void lastChildFrmClosed();
  296.  
  297. private:
  298.  
  299.     KMdiChildAreaPrivate *d;
  300. };
  301.  
  302. #endif   // _KMDICHILDAREA_H_
  303.  
  304. // kate: indent-mode csands; tab-width 4; auto-insert-doxygen on;
  305.