.TH "KMainWindow" 3 "28 Jan 2004" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KMainWindow \- Top level widget that provides toolbars, a status line and a frame. \fBKDE\fP top level main window.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kmainwindow.h>\fP
.PP
Inherits \fBQMainWindow\fP, \fBKXMLGUIBuilder\fP, and \fBKXMLGUIClient\fP.
.PP
Inherited by \fBKDockMainWindow\fP, and \fBUIServer\fP.
.PP
.SS "Public Slots"

.in +1c
.ti -1c
.RI "virtual void \fBsetCaption\fP (const  \fBQString\fP &caption)"
.br
.RI "\fIMakes a \fBKDE\fP compliant caption. \fP"
.ti -1c
.RI "virtual void \fBsetCaption\fP (const  \fBQString\fP &caption, bool modified)"
.br
.RI "\fIMakes a \fBKDE\fP compliant caption. \fP"
.ti -1c
.RI "virtual void \fBsetPlainCaption\fP (const  \fBQString\fP &caption)"
.br
.RI "\fIMake a plain caption without any modifications. \fP"
.ti -1c
.RI "void \fBappHelpActivated\fP (void)"
.br
.RI "\fIOpen the help page for the application. \fP"
.ti -1c
.RI "virtual void \fBslotStateChanged\fP (const  \fBQString\fP &newstate)"
.br
.RI "\fIApply a state change. \fP"
.ti -1c
.RI "void \fBslotStateChanged\fP (const  \fBQString\fP &newstate, KXMLGUIClient::ReverseStateChange)"
.br
.RI "\fIApply a state change. \fP"
.ti -1c
.RI "void \fBsetSettingsDirty\fP ()"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKMainWindow\fP (\fBQWidget\fP *parent=0, const  char *name=0, WFlags f=WType_TopLevel|WDestructiveClose)"
.br
.RI "\fIConstruct a main window. \fP"
.ti -1c
.RI "virtual \fB~KMainWindow\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "\fBKPopupMenu\fP * \fBhelpMenu\fP (const  \fBQString\fP &aboutAppText=QString::null, bool showWhatsThis=TRUE)"
.br
.RI "\fIRetrieve the standard help menu. \fP"
.ti -1c
.RI "\fBKPopupMenu\fP * \fBcustomHelpMenu\fP (bool showWhatsThis=TRUE)"
.br
.RI "\fIReturns the help menu. \fP"
.ti -1c
.RI "bool \fBrestore\fP (int number, bool show=TRUE)"
.br
.RI "\fIRestore the session specified by \fCnumber\fP. \fP"
.ti -1c
.RI "virtual \fBKXMLGUIFactory\fP * \fBguiFactory\fP ()"
.br
.ti -1c
.RI "void \fBcreateGUI\fP (const  \fBQString\fP &xmlfile=QString::null, bool _conserveMemory=TRUE)"
.br
.RI "\fICreate a GUI given a local XML file. \fP"
.ti -1c
.RI "void \fBsetHelpMenuEnabled\fP (bool showHelpMenu=true)"
.br
.RI "\fIEnables the build of a standard help menu when calling \fBcreateGUI()\fP. \fP"
.ti -1c
.RI "bool \fBisHelpMenuEnabled\fP ()"
.br
.RI "\fIReturn \fCtrue\fP when the help menu is enabled. \fP"
.ti -1c
.RI "bool \fBhasMenuBar\fP ()"
.br
.RI "\fIReturns true, if there is a menubar 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
\fP"
.ti -1c
.RI "\fBKMenuBar\fP * \fBmenuBar\fP ()"
.br
.RI "\fIReturns a pointer to the menu bar. \fP"
.ti -1c
.RI "\fBKStatusBar\fP * \fBstatusBar\fP ()"
.br
.RI "\fIReturns a pointer to the status bar. \fP"
.ti -1c
.RI "\fBKToolBar\fP * \fBtoolBar\fP (const  char *name=0)"
.br
.RI "\fIReturns a pointer to the toolbar with the specified name. \fP"
.ti -1c
.RI "\fBQPtrListIterator\fP< \fBKToolBar\fP > \fBtoolBarIterator\fP ()"
.br
.ti -1c
.RI "\fBKAccel\fP * \fBaccel\fP ()"
.br
.ti -1c
.RI "void \fBsetFrameBorderWidth\fP (int)"
.br
.ti -1c
.RI "void \fBsetAutoSaveSettings\fP (const  \fBQString\fP &groupName=\fBQString::fromLatin1\fP('MainWindow'), bool saveWindowSize=true)"
.br
.RI "\fICall this to enable 'auto-save' of toolbar/menubar/statusbar settings (and optionally window size). \fP"
.ti -1c
.RI "void \fBresetAutoSaveSettings\fP ()"
.br
.RI "\fIDisable the auto-save-settings feature. \fP"
.ti -1c
.RI "bool \fBautoSaveSettings\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBautoSaveGroup\fP () const "
.br
.ti -1c
.RI "void \fBapplyMainWindowSettings\fP (\fBKConfig\fP *config, const  \fBQString\fP &groupName=QString::null)"
.br
.RI "\fIRead settings for statusbar, menubar and toolbar from their respective groups in the config file and apply them. \fP"
.ti -1c
.RI "void \fBsaveMainWindowSettings\fP (\fBKConfig\fP *config, const  \fBQString\fP &groupName=QString::null)"
.br
.RI "\fISave settings for statusbar, menubar and toolbar to their respective groups in the config file \fCconfig\fP. \fP"
.ti -1c
.RI "void \fBsetStandardToolBarMenuEnabled\fP (bool enable)"
.br
.RI "\fISets whether KMainWindow should provide a menu that allows showing/hiding the available toolbars ( using \fBKToggleToolBarAction\fP ) . \fP"
.ti -1c
.RI "bool \fBisStandardToolBarMenuEnabled\fP () const "
.br
.RI "\fI\fBSince:\fP
.RS 4
3.1 
.RE
.PP
\fP"
.ti -1c
.RI "\fBKAction\fP * \fBtoolBarMenuAction\fP ()"
.br
.RI "\fIReturns a pointer to the mainwindows action responsible for the toolbars menu 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
\fP"
.ti -1c
.RI "virtual void \fBfinalizeGUI\fP (\fBKXMLGUIClient\fP *client)"
.br
.RI "\fI\fBSince:\fP
.RS 4
3.1 
.RE
.PP
\fP"
.ti -1c
.RI "void \fBfinalizeGUI\fP (bool force)"
.br
.ti -1c
.RI "bool \fBinitialGeometrySet\fP () const "
.br
.ti -1c
.RI "\fBQSize\fP \fBsizeForCentralWidgetSize\fP (\fBQSize\fP size)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "bool \fBcanBeRestored\fP (int number)"
.br
.ti -1c
.RI "const  \fBQString\fP \fBclassNameOfToplevel\fP (int number)"
.br
.RI "\fIReturns the \fBclassName\fP() of the \fCnumber\fP of the toplevel window which should be restored. \fP"
.in -1c
.SS "Static Public Attributes"

.in +1c
.ti -1c
.RI "\fBQPtrList\fP< \fBKMainWindow\fP > * \fBmemberList\fP = 0L"
.br
.RI "\fIList of members of KMainWindow class. \fP"
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "virtual void \fBshowAboutApplication\fP ()"
.br
.RI "\fIThis slot does nothing. \fP"
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "void \fBpaintEvent\fP (\fBQPaintEvent\fP *e)"
.br
.ti -1c
.RI "void \fBchildEvent\fP (\fBQChildEvent\fP *e)"
.br
.ti -1c
.RI "void \fBresizeEvent\fP (\fBQResizeEvent\fP *e)"
.br
.ti -1c
.RI "virtual void \fBcloseEvent\fP (\fBQCloseEvent\fP *)"
.br
.RI "\fIReimplemented to call the \fBqueryClose()\fP and \fBqueryExit()\fP handlers. \fP"
.ti -1c
.RI "virtual bool \fBqueryExit\fP ()"
.br
.RI "\fICalled before the very last window is closed, either by the user or indirectly by the session manager. \fP"
.ti -1c
.RI "virtual bool \fBqueryClose\fP ()"
.br
.RI "\fICalled before the window is closed, either by the user or indirectly by the session manager. \fP"
.ti -1c
.RI "virtual void \fBsaveProperties\fP (\fBKConfig\fP *)"
.br
.RI "\fISave your instance-specific properties. \fP"
.ti -1c
.RI "virtual void \fBreadProperties\fP (\fBKConfig\fP *)"
.br
.RI "\fIRead your instance-specific properties. \fP"
.ti -1c
.RI "virtual void \fBsaveGlobalProperties\fP (\fBKConfig\fP *sessionConfig)"
.br
.RI "\fISave your application-wide properties. \fP"
.ti -1c
.RI "virtual void \fBreadGlobalProperties\fP (\fBKConfig\fP *sessionConfig)"
.br
.RI "\fIThe counterpart of \fBsaveGlobalProperties\fP(). \fP"
.ti -1c
.RI "void \fBsavePropertiesInternal\fP (\fBKConfig\fP *, int)"
.br
.ti -1c
.RI "bool \fBreadPropertiesInternal\fP (\fBKConfig\fP *, int)"
.br
.ti -1c
.RI "bool \fBsettingsDirty\fP () const "
.br
.RI "\fIFor inherited classes. \fP"
.ti -1c
.RI "\fBQString\fP \fBsettingsGroup\fP () const "
.br
.RI "\fIFor inherited classes. \fP"
.ti -1c
.RI "void \fBsaveWindowSize\fP (\fBKConfig\fP *config) const "
.br
.RI "\fIFor inherited classes Note that the group must be set before calling. \fP"
.ti -1c
.RI "void \fBrestoreWindowSize\fP (\fBKConfig\fP *config)"
.br
.RI "\fIFor inherited classes Note that the group must be set before calling, and that a -geometry on the command line has priority. \fP"
.ti -1c
.RI "void \fBparseGeometry\fP (bool parsewidth)"
.br
.RI "\fIparse the geometry from the geometry command line argument \fP"
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKMWSessionManaged\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
Top level widget that provides toolbars, a status line and a frame. \fBKDE\fP top level main window. 

It should be used as a top level (parent-less) widget. It manages the geometry for all its children, including your main widget.
.PP
Normally, you will inherit from KMainWindow, then construct (or use some existing) widget as your main view. You can set only one main view.
.PP
You can add as many toolbars as you like. There can be only one menubar and only one statusbar.
.PP
The toolbars, menubar, and statusbar can be created by the KMainWindow and - unlike the old KMainWindow - may, but do not have to, be deleted by you. KMainWindow will handle that internally.
.PP
Height and width can be operated independently from each other. Simply define the minimum/maximum height/width of your main widget and KMainWindow will take this into account. For fixed size windows set your main widget to a fixed size.
.PP
Fixed aspect ratios (heightForWidth()) and fixed width widgets are not supported.
.PP
KMainWindow will set icon, mini icon and caption, which it gets from \fBKApplication\fP. It provides full session management, and will save its position, geometry and positions of toolbars and menubar on logout. If you want to save additional data, reimplement \fBsaveProperties\fP() and (to read them again on next login) \fBreadProperties\fP(). To save special data about your data, reimplement \fBsaveGlobalProperties\fP(). To warn user that application or windows have unsaved data on close or logout, reimplement \fBqueryClose\fP() and/or \fBqueryExit\fP().
.PP
There is also a macro RESTORE which can restore all your windows on next login.
.PP
Note that a KMainWindow per-default is created with the WDestructiveClose flag, i.e. it is automatically destroyed when the window is closed. If you do not want this behavior, specify 0 as widget flag in the constructor.
.PP
\fBSee also:\fP
.RS 4
\fBKApplication\fP 
.RE
.PP
\fBAuthor:\fP
.RS 4
Reginald Stadlbauer (reggie@kde.org) Stephan Kulow (coolo@kde.org), Matthias Ettrich (ettrich@kde.org), Chris Schlaeger (cs@kde.org), Sven Radej (radej@kde.org). Maintained by Sven Radej (radej@kde.org) 
.RE
.PP

.PP
Definition at line 97 of file kmainwindow.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KMainWindow::KMainWindow (\fBQWidget\fP * parent = 0, const char * name = 0, WFlags f = WType_TopLevel|WDestructiveClose)"
.PP
Construct a main window. \fBParameters:\fP
.RS 4
\fIparent\fP The widget parent. This is usually 0 but it may also be the window group leader. In that case, the KMainWindow becomes sort of a secondary window.
.br
\fIname\fP The object name. For session management and window management to work properly, all main windows in the application should have a different name. When passing 0 (the default), KMainWindow will create a unique name, but it's recommended to explicitly pass a window name that will also describe the type of the window. If there can be several windows of the same type, append '#' (hash) to the name, and KMainWindow will append numbers to make the names unique. For example, for a mail client which has one main window showing the mails and folders, and which can also have one or more windows for composing mails, the name for the folders window should be e.g. 'mainwindow' and for the composer windows 'composer#'.
.br
\fIf\fP Specify the widget flags. The default is WType_TopLevel and WDestructiveClose. TopLevel indicates that a main window is a toplevel window, regardless of whether it has a parent or not. DestructiveClose indicates that a main window is automatically destroyed when its window is closed. Pass 0 if you do not want this behavior.
.RE
.PP
KMainWindows must be created on the heap with 'new', like: 
.PP
.nf
 KMainWindow *kmw = new KMainWindow (...
.PP
 Definition at line 158 of file kmainwindow.cpp.
.PP
References KStdAccel::name().
.SS "KMainWindow::~\fBKMainWindow\fP ()\fC [virtual]\fP"
.PP
Destructor. Will also destroy the toolbars, and menubar if needed. Definition at line 288 of file kmainwindow.cpp.
.PP
References memberList, and QPtrList< KMainWindow >::remove().
.SH "Member Function Documentation"
.PP 
.SS "\fBKPopupMenu\fP * KMainWindow::helpMenu (const \fBQString\fP & aboutAppText = QString::null, bool showWhatsThis = TRUE)"
.PP
Retrieve the standard help menu. It contains entires for the help system (activated by F1), an optional 'What's This?' entry (activated by Shift F1), an application specific dialog box, and an 'About KDE' dialog box.
.PP
Example (adding a standard help menu to your application): 
.PP
.nf

 \fBKPopupMenu\fP *help = helpMenu( <myTextString> );
 \fBmenuBar()\fP->insertItem( i18n('&Help'), help );
 
.PP
.PP
\fBParameters:\fP
.RS 4
\fIaboutAppText\fP The string that is used in the application specific dialog box. If you leave this string empty the information in the global \fBKAboutData\fP of the application will be used to make a standard dialog box.
.br
\fIshowWhatsThis\fP Set this to false if you do not want to include the 'What's This' menu entry.
.RE
.PP
\fBReturns:\fP
.RS 4
A standard help menu. 
.RE
.PP
Definition at line 298 of file kmainwindow.cpp.
.PP
References KXMLGUIClient::instance(), QString::isEmpty(), KHelpMenu::menu(), and showAboutApplication().
.SS "\fBKPopupMenu\fP * KMainWindow::customHelpMenu (bool showWhatsThis = TRUE)"
.PP
Returns the help menu. Creates a standard help menu if none exists yet.
.PP
It contains entries for the help system (activated by F1), an optional 'What's This?' entry (activated by Shift F1), an application specific dialog box, and an 'About KDE' dialog box. You must create the application specific dialog box yourself. When the 'About application' menu entry is activated, a signal will trigger the \fBshowAboutApplication\fP slot. See \fBshowAboutApplication\fP for more information.
.PP
Example (adding a help menu to your application): 
.PP
.nf

 \fBmenuBar()\fP->insertItem( i18n('&Help'), \fBcustomHelpMenu()\fP );
 
.PP
.PP
\fBParameters:\fP
.RS 4
\fIshowWhatsThis\fP Set this to \fCfalse\fP if you do not want to include the 'What's This' menu entry.
.RE
.PP
\fBReturns:\fP
.RS 4
A standard help menu. 
.RE
.PP
Definition at line 315 of file kmainwindow.cpp.
.PP
References KHelpMenu::menu(), and showAboutApplication().
.SS "bool KMainWindow::canBeRestored (int number)\fC [static]\fP"
.PP
\fB Session Management\fP
.PP
\fB Try to restore the toplevel widget as defined by the number (1..X).\fP
.PP
\fB If the session did not contain so high a number, the configuration is not changed and \fCfalse\fP returned.\fP
.PP
\fB That means clients could simply do the following: 
.PP
.nf

 if (kapp->isRestored()){
   int n = 1;
   while (KMainWindow::canBeRestored(n)){
     (new childMW)->restore(n);
     n++;
   }
 } else {
 // create default application as usual
 }
 
.PP
 Note that \fBQWidget::show\fP() is called implicitly in restore.\fP
.PP
\fB With this you can easily restore all toplevel windows of your application.\fP
.PP
\fB If your application uses different kinds of toplevel windows, then you can use \fBKMainWindow::classNameOfToplevel\fP(n) to determine the exact type before calling the childMW constructor in the example from above.\fP
.PP
\fB If your client has only one kind of toplevel widgets (which should be pretty usual) then you should use the RESTORE-macro:\fP
.PP
\fB 
.PP
.nf

 if (kapp->isRestored())
   RESTORE(childMW)
 else {
 // create default application as usual
 }
 
.PP
\fP
.PP
\fB The macro expands to the term above but is easier to use and less code to write.\fP
.PP
\fB 
.PP
\fBSee also:\fP
.RS 4
\fBrestore()\fP 
.PP
\fBclassNameOfToplevel()\fP 
.RE
.PP
\fPDefinition at line 326 of file kmainwindow.cpp.
.PP
References QString::fromLatin1(), KIO::number(), KConfigBase::readNumEntry(), and KConfigBase::setGroup().
.PP
Referenced by restore().
.SS "const  \fBQString\fP KMainWindow::classNameOfToplevel (int number)\fC [static]\fP"
.PP
Returns the \fBclassName\fP() of the \fCnumber\fP of the toplevel window which should be restored. This is only useful if your application uses different kinds of toplevel windows. Definition at line 338 of file kmainwindow.cpp.
.PP
References QString::fromLatin1(), KConfigBase::hasKey(), KIO::number(), QString::prepend(), KConfigBase::readEntry(), KConfigBase::setGroup(), and QString::setNum().
.SS "bool KMainWindow::restore (int number, bool show = TRUE)"
.PP
Restore the session specified by \fCnumber\fP. Returns \fCfalse\fP if this fails, otherwise returns \fCtrue\fP and shows the window. You should call \fBcanBeRestored\fP() first. If \fCshow\fP is true (default), this widget will be shown automatically. Definition at line 355 of file kmainwindow.cpp.
.PP
References canBeRestored(), and KIO::number().
.SS "void KMainWindow::createGUI (const \fBQString\fP & xmlfile = QString::null, bool _conserveMemory = TRUE)"
.PP
Create a GUI given a local XML file. If \fCxmlfile\fP is NULL, then it will try to construct a local XML filename like appnameui.rc where 'appname' is your app's name. If that file does not exist, then the XML UI code will only use the global (standard) XML file for the layout purposes.
.PP
Note that when passing true for the conserveMemory argument subsequent calls to guiFactory()->addClient/removeClient may not work as expected. Also retrieving references to containers like popup menus or toolbars using the container method will not work.
.PP
\fBParameters:\fP
.RS 4
\fIxmlfile\fP The local xmlfile (relative or absolute) 
.br
\fI_conserveMemory\fP Specify whether \fBcreateGUI()\fP should call \fBKXMLGuiClient::conserveMemory\fP() to free all memory allocated by the \fBQDomDocument\fP and by the \fBKXMLGUIFactory\fP. 
.RE
.PP
Definition at line 375 of file kmainwindow.cpp.
.PP
References KXMLGUIClient::actionCollection(), KXMLGUIFactory::addClient(), QDomElement::attribute(), QPtrList< KToolBar >::clear(), QMenuBar::clear(), KXMLGUIClient::conserveMemory(), QDomDocument::documentElement(), KXMLGUIClient::domDocument(), KXMLGUIClient::instance(), QString::isNull(), locate(), KXMLGUIFactory::removeClient(), KXMLGUIFactory::resetContainer(), QPtrList< KToolBar >::setAutoDelete(), KXMLGUIClient::setXMLFile(), QDomElement::tagName(), and toolBarIterator().
.SS "void KMainWindow::setHelpMenuEnabled (bool showHelpMenu = true)"
.PP
Enables the build of a standard help menu when calling \fBcreateGUI()\fP. The default behavior is to build one, you must call this function to disable it Definition at line 452 of file kmainwindow.cpp.
.SS "bool KMainWindow::isHelpMenuEnabled ()"
.PP
Return \fCtrue\fP when the help menu is enabled. Definition at line 457 of file kmainwindow.cpp.
.SS "bool KMainWindow::hasMenuBar ()"
.PP
Returns true, if there is a menubar 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
Definition at line 885 of file kmainwindow.cpp.
.SS "\fBKMenuBar\fP * KMainWindow::menuBar ()"
.PP
Returns a pointer to the menu bar. If there is no menu bar yet one will be created. Definition at line 890 of file kmainwindow.cpp.
.PP
References QMainWindow::menuBar().
.PP
Referenced by sizeForCentralWidgetSize().
.SS "\fBKStatusBar\fP * KMainWindow::statusBar ()"
.PP
Returns a pointer to the status bar. If there is no status bar yet one will be created. Definition at line 902 of file kmainwindow.cpp.
.PP
References QMainWindow::statusBar().
.PP
Referenced by KXMLGUIBuilder::createContainer().
.SS "\fBKToolBar\fP * KMainWindow::toolBar (const char * name = 0)"
.PP
Returns a pointer to the toolbar with the specified name. This refers to toolbars created dynamically from the XML UI framework. If the toolbar does not exist one will be created.
.PP
\fBParameters:\fP
.RS 4
\fIname\fP The internal name of the toolbar. If no name is specified 'mainToolBar' is assumed.
.RE
.PP
\fBReturns:\fP
.RS 4
A pointer to the toolbar or \fC0L\fP if it doesn't exist 
.RE
.PP
Definition at line 960 of file kmainwindow.cpp.
.PP
References KStdAccel::name().
.PP
Referenced by KToggleToolBarAction::plug(), and sizeForCentralWidgetSize().
.SS "\fBQPtrListIterator\fP< \fBKToolBar\fP > KMainWindow::toolBarIterator ()"
.PP
\fBReturns:\fP
.RS 4
An iterator over the list of all toolbars for this window. 
.RE
.PP
Definition at line 975 of file kmainwindow.cpp.
.PP
References QPtrList< KToolBar >::append(), QPtrList< KToolBar >::clear(), QPtrList::first(), QPtrList::next(), and QMainWindow::toolBars().
.PP
Referenced by applyMainWindowSettings(), createGUI(), and saveMainWindowSettings().
.SS "\fBKAccel\fP * KMainWindow::accel ()"
.PP
\fBReturns:\fP
.RS 4
A \fBKAccel\fP instance bound to this mainwindow. Used automatically by \fBKAction\fP to make keybindings work in all cases. 
.RE
.PP
Definition at line 990 of file kmainwindow.cpp.
.SS "void KMainWindow::setAutoSaveSettings (const \fBQString\fP & groupName = \fBQString::fromLatin1\fP('MainWindow'), bool saveWindowSize = true)"
.PP
Call this to enable 'auto-save' of toolbar/menubar/statusbar settings (and optionally window size). If the *bars were moved around/shown/hidden when the window is closed, saveMainWindowSettings( \fBKGlobal::config()\fP, groupName ) will be called.
.PP
\fBParameters:\fP
.RS 4
\fIgroupName\fP a name that identifies this 'type of window'. You can have several types of window in the same application.
.br
\fIsaveWindowSize\fP set it to true to include the window size when saving.
.RE
.PP
Typically, you will call \fBsetAutoSaveSettings()\fP in your KMainWindow-inherited class constructor, and it will take care of restoring and saving automatically. Make sure you call this _after all_ your *bars have been created. Definition at line 839 of file kmainwindow.cpp.
.PP
References applyMainWindowSettings(), KGlobal::config(), and QMainWindow::dockWindowPositionChanged().
.SS "void KMainWindow::resetAutoSaveSettings ()"
.PP
Disable the auto-save-settings feature. You don't normally need to call this, ever. Definition at line 851 of file kmainwindow.cpp.
.SS "bool KMainWindow::autoSaveSettings () const"
.PP
\fBReturns:\fP
.RS 4
the current autosave setting, i.e. true if \fBsetAutoSaveSettings()\fP was called, false by default or if \fBresetAutoSaveSettings()\fP was called. 
.RE
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 858 of file kmainwindow.cpp.
.SS "\fBQString\fP KMainWindow::autoSaveGroup () const"
.PP
\fBReturns:\fP
.RS 4
the group used for setting-autosaving. Only meaningful if \fBsetAutoSaveSettings()\fP was called. This can be useful for forcing a save or an apply, e.g. before and after using \fBKEditToolbar\fP. 
.RE
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 863 of file kmainwindow.cpp.
.SS "void KMainWindow::applyMainWindowSettings (\fBKConfig\fP * config, const \fBQString\fP & groupName = QString::null)"
.PP
Read settings for statusbar, menubar and toolbar from their respective groups in the config file and apply them. \fBParameters:\fP
.RS 4
\fIconfig\fP Config file to read the settings from. 
.br
\fIgroupName\fP Group name to use. If not specified, the last used group name is used. 
.RE
.PP
Definition at line 700 of file kmainwindow.cpp.
.PP
References KToolBar::applySettings(), QPtrListIterator::current(), finalizeGUI(), QString::fromLatin1(), QMenuBar::hide(), QString::isEmpty(), QString::number(), QString::prepend(), KConfigBase::readListEntry(), restoreWindowSize(), KConfigBase::setGroup(), QMenuBar::show(), and toolBarIterator().
.PP
Referenced by setAutoSaveSettings().
.SS "void KMainWindow::saveMainWindowSettings (\fBKConfig\fP * config, const \fBQString\fP & groupName = QString::null)"
.PP
Save settings for statusbar, menubar and toolbar to their respective groups in the config file \fCconfig\fP. \fBParameters:\fP
.RS 4
\fIconfig\fP Config file to save the settings to. 
.br
\fIgroupName\fP Group name to use. If not specified, the last used group name is used 
.RE
.PP
Definition at line 596 of file kmainwindow.cpp.
.PP
References QPtrListIterator::current(), QString::fromLatin1(), QString::isEmpty(), QString::number(), QString::prepend(), KToolBar::saveSettings(), saveWindowSize(), KConfigBase::setGroup(), toolBarIterator(), and KConfigBase::writeEntry().
.SS "void KMainWindow::setStandardToolBarMenuEnabled (bool enable)"
.PP
Sets whether KMainWindow should provide a menu that allows showing/hiding the available toolbars ( using \fBKToggleToolBarAction\fP ) . In case there is only one toolbar configured a simple 'Show ' menu item is shown.
.PP
The menu / menu item is implemented using xmlgui. It will be inserted in your menu structure in the 'Settings' menu.
.PP
If your application uses a non-standard xmlgui resource file then you can specify the exact position of the menu / menu item by adding a <Merge name='StandardToolBarMenuHandler' /> line to the settings menu section of your resource file ( usually appname.rc ).
.PP
Note that you should enable this feature before calling \fBcreateGUI()\fP ( or similar ) . You enable/disable it anytime if you pass false to the conserveMemory argument of createGUI. 
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 649 of file kmainwindow.cpp.
.PP
References KXMLGUIFactory::addClient(), KXMLGUIClient::factory(), and KXMLGUIFactory::removeClient().
.SS "bool KMainWindow::isStandardToolBarMenuEnabled () const"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 671 of file kmainwindow.cpp.
.SS "\fBKAction\fP * KMainWindow::toolBarMenuAction ()"
.PP
Returns a pointer to the mainwindows action responsible for the toolbars menu 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
Definition at line 244 of file kmainwindow.cpp.
.SS "void KMainWindow::finalizeGUI (\fBKXMLGUIClient\fP * client)\fC [virtual]\fP"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Reimplemented from \fBKXMLGUIBuilder\fP.
.PP
Definition at line 1040 of file kmainwindow.cpp.
.PP
Referenced by applyMainWindowSettings().
.SS "bool KMainWindow::initialGeometrySet () const"
.PP
\fBReturns:\fP
.RS 4
true if a -geometry argument was given on the command line, and this is the first window created (the one on which this option applies) 
.RE
.PP
Definition at line 807 of file kmainwindow.cpp.
.SS "\fBQSize\fP KMainWindow::sizeForCentralWidgetSize (\fBQSize\fP size)"
.PP
\fBReturns:\fP
.RS 4
the size the mainwindow should have so that the central widget will be of \fCsize\fP. 
.RE
.PP
Definition at line 1002 of file kmainwindow.cpp.
.PP
References KToolBar::barPos(), QMainWindow::dockWindowsMovable(), QSize::height(), QMenuBar::heightForWidth(), menuBar(), KToolBar::sizeHint(), toolBar(), and QSize::width().
.SS "void KMainWindow::setCaption (const \fBQString\fP & caption)\fC [virtual, slot]\fP"
.PP
Makes a \fBKDE\fP compliant caption. \fBParameters:\fP
.RS 4
\fIcaption\fP Your caption. \fIDo\fP \fInot\fP include the application name in this string. It will be added automatically according to the \fBKDE\fP standard. 
.RE
.PP
Definition at line 462 of file kmainwindow.cpp.
.PP
References setPlainCaption().
.SS "void KMainWindow::setCaption (const \fBQString\fP & caption, bool modified)\fC [virtual, slot]\fP"
.PP
Makes a \fBKDE\fP compliant caption. \fBParameters:\fP
.RS 4
\fIcaption\fP Your caption. \fIDo\fP \fInot\fP include the application name in this string. It will be added automatically according to the \fBKDE\fP standard. 
.br
\fImodified\fP Specify whether the document is modified. This displays an additional sign in the title bar, usually '**'. 
.RE
.PP
Definition at line 467 of file kmainwindow.cpp.
.PP
References setPlainCaption().
.SS "void KMainWindow::setPlainCaption (const \fBQString\fP & caption)\fC [virtual, slot]\fP"
.PP
Make a plain caption without any modifications. \fBParameters:\fP
.RS 4
\fIcaption\fP Your caption. This is the string that will be displayed in the window title. 
.RE
.PP
Definition at line 472 of file kmainwindow.cpp.
.PP
References QString::utf8().
.PP
Referenced by setCaption().
.SS "void KMainWindow::appHelpActivated (void)\fC [slot]\fP"
.PP
Open the help page for the application. The application name is used as a key to determine what to display and the system will attempt to open /index.html.
.PP
This method is intended for use by a help button in the toolbar or components outside the regular help menu. Use \fBhelpMenu\fP() when you want to provide access to the help system from the help menu.
.PP
Example (adding a help button to the first toolbar):
.PP
.PP
.nf

 \fBKIconLoader\fP &loader = *KGlobal::iconLoader();
 \fBQPixmap\fP pixmap = loader.loadIcon( 'help' );
 toolBar(0)->insertButton( pixmap, 0, SIGNAL(clicked()),
   this, SLOT(\fBappHelpActivated()\fP), true, i18n('Help') );
 
.PP
 Definition at line 481 of file kmainwindow.cpp.
.PP
References KHelpMenu::appHelpActivated().
.SS "void KMainWindow::slotStateChanged (const \fBQString\fP & newstate)\fC [virtual, slot]\fP"
.PP
Apply a state change. Enable and disable actions as defined in the XML rc file 
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 491 of file kmainwindow.cpp.
.PP
References KXMLGUIClient::stateChanged().
.SS "void KMainWindow::slotStateChanged (const \fBQString\fP & newstate, KXMLGUIClient::ReverseStateChange)\fC [slot]\fP"
.PP
Apply a state change. Enable and disable actions as defined in the XML rc file, can 'reverse' the state (disable the actions which should be enabled, and vice-versa) if specified. 
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 499 of file kmainwindow.cpp.
.PP
References KXMLGUIClient::stateChanged().
.SS "void KMainWindow::closeEvent (\fBQCloseEvent\fP *)\fC [protected, virtual]\fP"
.PP
Reimplemented to call the \fBqueryClose()\fP and \fBqueryExit()\fP handlers. We recommend that you reimplement the handlers rather than \fBcloseEvent\fP(). If you do it anyway, ensure to call the base implementation to keep \fBqueryExit\fP() running. Reimplemented in \fBUIServer\fP.
.PP
Definition at line 515 of file kmainwindow.cpp.
.PP
References QCloseEvent::accept(), QPtrListIterator::current(), QCloseEvent::ignore(), memberList, queryClose(), queryExit(), and QPtrListIterator::toFirst().
.SS "bool KMainWindow::queryExit ()\fC [protected, virtual]\fP"
.PP
Called before the very last window is closed, either by the user or indirectly by the session manager. It is not recommended to do any user interaction in this function other than indicating severe errors. Better ask the user on \fBqueryClose\fP() (see below).
.PP
However, \fBqueryExit\fP() is useful to do some final cleanups. A typical example would be to write configuration data back.
.PP
Note that the application may continue to run after \fBqueryExit\fP() (the user may have cancelled a shutdown). The purpose of \fBqueryExit\fP() is purely to prepare the application (with possible user interaction) so it can safely be closed later (without user interaction).
.PP
If you need to do serious things on exit (like shutting a dial-up connection down), connect to the signal \fBKApplication::shutDown\fP().
.PP
Default implementation returns \fCtrue\fP. Returning \fCfalse\fP will cancel the exiting. In the latter case, the last window will remain visible. If \fBKApplication::sessionSaving()\fP is true, refusing the exit will also cancel \fBKDE\fP logout.
.PP
\fBSee also:\fP
.RS 4
\fBqueryClose()\fP 
.PP
\fBKApplication::sessionSaving()\fP 
.RE
.PP
Definition at line 544 of file kmainwindow.cpp.
.PP
Referenced by closeEvent().
.SS "bool KMainWindow::queryClose ()\fC [protected, virtual]\fP"
.PP
Called before the window is closed, either by the user or indirectly by the session manager. The purpose of this function is to prepare the window in a way that it is safe to close it, i.e. without the user losing some data.
.PP
Default implementation returns true. Returning \fCfalse\fP will cancel the closing, and, if \fBKApplication::sessionSaving()\fP is true, it will also cancel \fBKDE\fP logout.
.PP
Reimplement this function to prevent the user from losing data. Example: 
.PP
.nf

.PP
.PP
.PP
.nf
           switch ( \fBKMessageBox::warningYesNoCancel\fP( this,
				   i18n('Save changes to Document Foo?')) ) {
           case KMessageBox::Yes :
             // save document here. If saving fails, return FALSE;
             return TRUE;
           case KMessageBox::No :
             return TRUE;
           default: // cancel
             return FALSE;
.PP
.PP
.PP
.nf
    
.PP
.PP
\fBSee also:\fP
.RS 4
\fBqueryExit()\fP 
.PP
\fBKApplication::sessionSaving()\fP 
.RE
.PP
Definition at line 549 of file kmainwindow.cpp.
.PP
Referenced by closeEvent().
.SS "virtual void KMainWindow::saveProperties (\fBKConfig\fP *)\fC [inline, protected, virtual]\fP"
.PP
Save your instance-specific properties. The function is invoked when the session manager requests your application to save its state.
.PP
You \fImust\fP \fInot\fP change the group of the \fCkconfig\fP object, since KMainWindow uses one group for each window. Please reimplement these function in childclasses.
.PP
Note: No user interaction is allowed in this function! Definition at line 635 of file kmainwindow.h.
.SS "virtual void KMainWindow::readProperties (\fBKConfig\fP *)\fC [inline, protected, virtual]\fP"
.PP
Read your instance-specific properties. Definition at line 640 of file kmainwindow.h.
.SS "void KMainWindow::saveGlobalProperties (\fBKConfig\fP * sessionConfig)\fC [protected, virtual]\fP"
.PP
Save your application-wide properties. The function is invoked when the session manager requests your application to save its state.
.PP
This function is similar to \fBsaveProperties\fP() but is only called for the very first main window, regardless how many main window are open.
.PP
Override it if you need to save other data about your documents on session end. sessionConfig is a config to which that data should be saved. Normally, you don't need this function. But if you want to save data about your documents that are not in opened windows you might need it.
.PP
Default implementation does nothing. Definition at line 554 of file kmainwindow.cpp.
.SS "void KMainWindow::readGlobalProperties (\fBKConfig\fP * sessionConfig)\fC [protected, virtual]\fP"
.PP
The counterpart of \fBsaveGlobalProperties\fP(). Read the application-specific properties in again. Definition at line 558 of file kmainwindow.cpp.
.SS "bool KMainWindow::settingsDirty () const\fC [protected]\fP"
.PP
For inherited classes. Definition at line 829 of file kmainwindow.cpp.
.SS "\fBQString\fP KMainWindow::settingsGroup () const\fC [protected]\fP"
.PP
For inherited classes. Definition at line 834 of file kmainwindow.cpp.
.SS "void KMainWindow::saveWindowSize (\fBKConfig\fP * config) const\fC [protected]\fP"
.PP
For inherited classes Note that the group must be set before calling. Definition at line 774 of file kmainwindow.cpp.
.PP
References QApplication::desktop(), QString::fromLatin1(), QRect::height(), QRect::width(), and KConfigBase::writeEntry().
.PP
Referenced by saveMainWindowSettings().
.SS "void KMainWindow::restoreWindowSize (\fBKConfig\fP * config)\fC [protected]\fP"
.PP
For inherited classes Note that the group must be set before calling, and that a -geometry on the command line has priority. Definition at line 782 of file kmainwindow.cpp.
.PP
References QApplication::desktop(), QString::fromLatin1(), QRect::height(), QSize::isEmpty(), parseGeometry(), KConfigBase::readNumEntry(), QRect::width(), and KConfigBase::writeEntry().
.PP
Referenced by applyMainWindowSettings().
.SS "void KMainWindow::parseGeometry (bool parsewidth)\fC [protected]\fP"
.PP
parse the geometry from the geometry command line argument Definition at line 252 of file kmainwindow.cpp.
.PP
References QApplication::desktop(), QSize::height(), KIO::move(), and QSize::width().
.PP
Referenced by restoreWindowSize().
.SS "void KMainWindow::showAboutApplication ()\fC [protected, virtual, slot]\fP"
.PP
This slot does nothing. It must be reimplemented if you want to use a custom About Application dialog box. This slot is connected to the About Application entry in the menu returned by \fBcustomHelpMenu\fP.
.PP
Example: 
.PP
.nf

.PP
.PP
.PP
.nf
 void MyMainLevel::setupInterface()
 {
   ..
   \fBmenuBar()\fP->insertItem( i18n('&Help'), \fBcustomHelpMenu()\fP );
   ..
 }
.PP
.PP
.PP
.nf
 void MyMainLevel::showAboutApplication()
 {
   
 }
 
.PP
 Definition at line 568 of file kmainwindow.cpp.
.PP
Referenced by customHelpMenu(), and helpMenu().
.SH "Member Data Documentation"
.PP 
.SS "\fBQPtrList\fP< \fBKMainWindow\fP > * \fBKMainWindow::memberList\fP = 0L\fC [static]\fP"
.PP
List of members of KMainWindow class. Definition at line 70 of file kmainwindow.cpp.
.PP
Referenced by closeEvent(), and ~KMainWindow().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
