/***************************************************************************
                            KDockMainWindow.h -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#ifndef KDOCKMAINWINDOW_H
#define KDOCKMAINWINDOW_H

#include <Foundation/NSObject.h>
#include <Foundation/NSString.h>
#include <kdeobjc/KMainWindow.h>

/**

 A special kind of @ref KMainWindow that is able to have dockwidget child widgets (and member of the dockwidget class set).

 The main widget should be a @ref KDockWidget where other @ref KDockWidget can be docked to
 the left, right, top, bottom or to the middle.
 Note: dock to the middle means to drop on a dockwidget and to unite them to a new widget, a tab control.

 Furthermore, the KDockMainWindow has got the @ref KDockManager and some data about the dock states.

 If you've got some dockwidgets, you can dock them to the dockmainwindow to initialize a start scene:
 Here an example:
 <PRE>
 -[DockApplication DockApplication]( const char* name) : KDockMainWindow( name)
 {
   ...
   KDockWidget* mainDock;
   mainDock = createDockWidget( "Falk's MainDockWidget", mainPixmap, 0L, "main_dock_widget");
   AnyContentsWidget* cw = new AnyContentsWidget( mainDock);
   -[mainDock setWidget]( cw);
   // allow others to dock to the 4 sides
   -[mainDock setDockSite](-[KDockWidget DockCorner]);
   // forbit docking abilities of mainDock itself
   -[mainDock setEnableDocking](-[KDockWidget DockNone]);
   setView( mainDock); // central widget in a KDE mainwindow
   setMainDockWidget( mainDock); // master dockwidget
   ...
   KDockWidget* dockLeft;
   dockLeft = createDockWidget( "Intially left one", anyOtherPixmap, 0L, i18n("The left dockwidget"));
   AnotherWidget* aw = new AnotherWidget( dockLeft);
   -[dockLeft setWidget]( aw);
   -[dockLeft manualDock]( mainDock,              // dock target
                         -[KDockWidget DockLeft], // dock site
                         20 );                  // relation target/this (in percent)
   ...
 </PRE>

 Docking is fully dynamical at runtime. That means you can always move dockwidgets via drag and drop.

 And last but not least you can use the popupmenu for showing or hiding any controlled dockwidget
 of this class and insert it to your main menu bar or anywhere else.

 @author Max Judin (documentation: Falk Brettschneider).
 
 @short 
 A special kind of @ref KMainWindow that is able to have dockwidget child widgets (and member of the dockwidget class set).
*/

@class KDockManager;
@class KDockWidget;

@interface KDockMainWindow : KMainWindow 

/** 
 Constructs a dockmainwindow. It calls its base class constructor and does additional things concerning
 to the dock stuff:

*/
- initWithWidget: (QWidget *)parent name: (NSString *)name f: (int)f;
- init;

/** 
 Destructs a dockmainwindow.
   
*/
- (void) dealloc;

/** 
 Returns the dockmanager of this. (see @ref KDockManager)

*/
- (KDockManager*) manager;

/** 
 Sets a new main dockwidget.
 Additionally, the toolbar is re-initialized.

*/
- setMainDockWidget: (KDockWidget*)arg1;

/** 
 Returns the main dockwidget.

*/
- (KDockWidget*) getMainDockWidget;

/** 
 This is one of the most important methods!
 The KDockMainWindow creates a new dockwidget object here that usually should encapsulate the user's widget.
 The new dockwidget is automatically taken under control by the dockmanager of the dockmainwindow.

*/
- (KDockWidget*) createDockWidget: (NSString *)name pixmap: (QPixmap *)pixmap parent: (QWidget *)parent strCaption: (NSString *)strCaption strTabPageLabel: (NSString *)strTabPageLabel;
- (KDockWidget*) createDockWidget: (NSString *)name pixmap: (QPixmap *)pixmap ;

/** 
 Saves the current dock window layout into a DOM tree below the given element.
   
*/
- writeDockConfig: (QDomElement*)base;

/** 
 Reads the current dock window layout from a DOM tree below the given element.
   
*/
- readDockConfig: (QDomElement*)base;

/** 
 It writes the current dock state in the given section of KConfig.

*/
- writeDockConfig: (KConfig*)c group: (NSString *)group;
- writeDockConfig;

/** 
 It reads the current dock state from the given section of KConfig.

*/
- readDockConfig: (KConfig*)c group: (NSString *)group;
- readDockConfig;

/** 
 It runs through all dockwidgets which are under control of the dockmanager and calls -show for every
 encapsulated widget and -show for the dockwidget itself if it is not in tab mode.
 Additionally, if the main dockwidget is not a QDialog, it will be shown.
   
*/
- activateDock;

/** 
 Returns a popup menu that contains entries for all controlled dockwidgets making hiding and showing
 them possible.

*/
- (QPopupMenu*) dockHideShowMenu;

/** 
 This method shows the given dockwidget.
 The clue is that it also considers the dockwidget could be a tab page
 and must set to be the activate one.

*/
- makeDockVisible: (KDockWidget*)dock;

/** 
 This method hides the given dockwidget.

*/
- makeDockInvisible: (KDockWidget*)dock;

/** 
 This is an overloaded member function, provided for convenience.
 It differs from the above function only in what argument(s) it accepts.
   
*/
- makeWidgetDockVisible: (QWidget *)widget;

/** 
 This method calls the base class method.
 If the given widget inherits KDockWidget, applyToWidget(this) is called.

*/
- setView: (QWidget *)arg1;

/** 
 Called whenever one of the dockwidgets of this has been undocked.
  
*/
- slotDockWidgetUndocked;
@end

/** Override these methods in subclasses of KDockMainWindow to customise event handling behaviour */
@protocol KDockMainWindowEventHandling
- keyPressEvent:(QKeyEvent*) arg1;
- keyReleaseEvent:(QKeyEvent*) arg1;
- focusOutEvent:(QFocusEvent*) arg1;
- childEvent:(QChildEvent*) e;
- dragMoveEvent:(QDragMoveEvent*) arg1;
- leaveEvent:(QEvent*) arg1;
- tabletEvent:(QTabletEvent*) arg1;
- showEvent:(QShowEvent*) arg1;
- contextMenuEvent:(QContextMenuEvent*) arg1;
- mousePressEvent:(QMouseEvent*) arg1;
- imComposeEvent:(QIMEvent*) arg1;
- customEvent:(QCustomEvent*) arg1;
- mouseReleaseEvent:(QMouseEvent*) arg1;
- mouseDoubleClickEvent:(QMouseEvent*) arg1;
- dragLeaveEvent:(QDragLeaveEvent*) arg1;
- enterEvent:(QEvent*) arg1;
- focusInEvent:(QFocusEvent*) arg1;
- imEndEvent:(QIMEvent*) arg1;
- dropEvent:(QDropEvent*) arg1;
- dragEnterEvent:(QDragEnterEvent*) arg1;
- mouseMoveEvent:(QMouseEvent*) arg1;
- moveEvent:(QMoveEvent*) arg1;
- wheelEvent:(QWheelEvent*) arg1;
- hideEvent:(QHideEvent*) arg1;
- imStartEvent:(QIMEvent*) arg1;

/** 
 Reimplemented to call the -queryClose and -queryExit handlers.

 We recommend that you reimplement the handlers rather than @ref -closeEvent.
 If you do it anyway, ensure to call the base implementation to keep
 @ref -queryExit running.
     
*/
- closeEvent:(QCloseEvent*) arg1;
- paintEvent:(QPaintEvent*) e;
- timerEvent:(QTimerEvent*) arg1;
- resizeEvent:(QResizeEvent*) e;
@end


#endif
