kmainwindow.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kmainwindow.h

    00001 /*
    00002     This file is part of the KDE libraries
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License version 2 as published by the Free Software Foundation.
    00007
    00008     This library is distributed in the hope that it will be useful,
    00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00011     Library General Public License for more details.
    00012
    00013     You should have received a copy of the GNU Library General Public License
    00014     along with this library; see the file COPYING.LIB.  If not, write to
    00015     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00016     Boston, MA 02111-1307, USA.
    00017
    00018     $Id: kmainwindow.h,v 1.58.2.4 2003/03/03 14:39:42 lunakl Exp $
    00019
    00020 */
    00021
    00022 #ifndef KMAINWINDOW_H
    00023 #define KMAINWINDOW_H
    00024
    00025 #include "kxmlguifactory.h"
    00026 #include "kxmlguiclient.h"
    00027 #include "kxmlguibuilder.h"
    00028 #include <qmainwindow.h>
    00029 #include <ktoolbar.h>
    00030
    00031 class KPopupMenu;
    00032 class KXMLGUIFactory;
    00033 class KConfig;
    00034 class KHelpMenu;
    00035 class KStatusBar;
    00036 class QStatusBar;
    00037 class KMenuBar;
    00038 class KMWSessionManaged;
    00039 class KMainWindowPrivate;
    00040 class KAccel;
    00041 class KToolBarMenuAction;
    00042
    00043
    00044 #define KDE_DEFAULT_WINDOWFLAGS WType_TopLevel | WDestructiveClose
    00045
    00046
    00097 class KMainWindow : public QMainWindow, public KXMLGUIBuilder, virtual public KXMLGUIClient
    00098 {
    00099     friend class KMWSessionManaged;
    00100     Q_OBJECT
    00101
    00102 public:
    00131     KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
    00132
    00133
    00140     virtual ~KMainWindow();
    00141
    00166     KPopupMenu* helpMenu( const QString &aboutAppText = QString::null,
    00167                           bool showWhatsThis = TRUE );
    00168
    00191     KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE );
    00192
    00241     static bool canBeRestored( int number );
    00242
    00250     static const QString classNameOfToplevel( int number );
    00251
    00260     bool restore( int number, bool show = TRUE );
    00261
    00262     virtual KXMLGUIFactory *guiFactory();
    00263
    00283     void createGUI( const QString &xmlfile = QString::null, bool _conserveMemory = TRUE );
    00284
    00291     void setHelpMenuEnabled(bool showHelpMenu = true);
    00292
    00296     bool isHelpMenuEnabled();
    00297
    00298
    00303      bool hasMenuBar();
    00304
    00310     KMenuBar *menuBar();
    00311
    00318     KStatusBar *statusBar();
    00319
    00323     static QPtrList<KMainWindow>* memberList;
    00324
    00335     KToolBar *toolBar( const char *name=0 );
    00336
    00340     QPtrListIterator<KToolBar> toolBarIterator();
    00341
    00346     KAccel *accel();
    00347
    00348     void setFrameBorderWidth( int ) {}
    00349
    00367     void setAutoSaveSettings( const QString & groupName = QString::fromLatin1("MainWindow"),
    00368                               bool saveWindowSize = true );
    00369
    00374     void resetAutoSaveSettings();
    00375
    00381     bool autoSaveSettings() const;
    00382
    00390     QString autoSaveGroup() const;
    00391
    00400     void applyMainWindowSettings(KConfig *config, const QString &groupName = QString::null);
    00401
    00410     void saveMainWindowSettings(KConfig *config, const QString &groupName = QString::null);
    00411
    00430     void setStandardToolBarMenuEnabled( bool enable );
    00432     bool isStandardToolBarMenuEnabled() const;
    00433
    00438     KAction *toolBarMenuAction();
    00439
    00440     // why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI;
    00442     virtual void finalizeGUI( KXMLGUIClient *client );
    00443
    00447     void finalizeGUI( bool force );
    00448
    00453     bool initialGeometrySet() const;
    00454
    00459     QSize sizeForCentralWidgetSize(QSize size);
    00460
    00461 public slots:
    00469     virtual void setCaption( const QString &caption );
    00479     virtual void setCaption( const QString &caption, bool modified );
    00480
    00487     virtual void setPlainCaption( const QString &caption );
    00488
    00510     void appHelpActivated( void );
    00511
    00518     virtual void slotStateChanged(const QString &newstate);
    00519
    00528     void slotStateChanged(const QString &newstate,
    00529                           KXMLGUIClient::ReverseStateChange); // KDE 4.0: remove this
    00530
    00531
    00539 //     void slotStateChanged(const QString &newstate,
    00540 //                           bool reverse); // KDE 4.0: enable this
    00541
    00545     void setSettingsDirty();
    00546
    00547 protected:
    00548     void paintEvent( QPaintEvent* e );
    00549     void childEvent( QChildEvent* e);
    00550     void resizeEvent( QResizeEvent* e);
    00558     virtual void closeEvent ( QCloseEvent *);
    00588     virtual bool queryExit();
    00589
    00621     virtual bool queryClose();
    00635     virtual void saveProperties( KConfig* ) {}
    00636
    00640     virtual void readProperties( KConfig* ) {}
    00641
    00658     virtual void saveGlobalProperties( KConfig* sessionConfig );
    00659
    00665     virtual void readGlobalProperties( KConfig* sessionConfig );
    00666     void savePropertiesInternal( KConfig*, int );
    00667     bool readPropertiesInternal( KConfig*, int );
    00668
    00672     bool settingsDirty() const;
    00676     QString settingsGroup() const;
    00681     void saveWindowSize( KConfig * config ) const;
    00687     void restoreWindowSize( KConfig * config );
    00688
    00690     void parseGeometry(bool parsewidth);
    00691
    00692 protected slots:
    00693
    00718     virtual void showAboutApplication();
    00719
    00720 private slots:
    00724     void shuttingDown();
    00725
    00726     void saveAutoSaveSettings();
    00727
    00728 private:
    00729     KMenuBar *internalMenuBar();
    00730     KStatusBar *internalStatusBar();
    00731     KHelpMenu *mHelpMenu, *helpMenu2;
    00732     KXMLGUIFactory *factory_;
    00733     QPtrList<KToolBar> toolbarList;
    00734 protected:
    00735     virtual void virtual_hook( int id, void* data );
    00736 private:
    00737     KMainWindowPrivate *d;
    00738     void initKMainWindow(const char *name);
    00739 };
    00740
    00741 #define RESTORE(type) { int n = 1;\
    00742     while (KMainWindow::canBeRestored(n)){\
    00743       (new type)->restore(n);\
    00744       n++;}}
    00745
    00746
    00747 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:20 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001