kmainwindow.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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);
00530
00531
00539
00540
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.