• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

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., 51 Franklin Street, Fifth Floor,
00016     Boston, MA 02110-1301, USA.
00017 
00018 
00019 */
00020 
00021 #ifndef KMAINWINDOW_H
00022 #define KMAINWINDOW_H
00023 
00024 #include "kxmlguifactory.h"
00025 #include "kxmlguiclient.h"
00026 #include "kxmlguibuilder.h"
00027 #include <tqmainwindow.h>
00028 #include <tqmetaobject.h>
00029 #include <ktoolbar.h>
00030 
00031 class KPopupMenu;
00032 class KXMLGUIFactory;
00033 class KConfig;
00034 class KHelpMenu;
00035 class KStatusBar;
00036 class TQStatusBar;
00037 class KMenuBar;
00038 class KMWSessionManaged;
00039 class KMainWindowPrivate;
00040 class KAccel;
00041 class KToolBarMenuAction;
00042 class DCOPObject;
00043 
00044 #define KDE_DEFAULT_WINDOWFLAGS WType_TopLevel | WDestructiveClose
00045 
00046 
00098 class KDEUI_EXPORT KMainWindow : public TQMainWindow, public KXMLGUIBuilder, virtual public KXMLGUIClient
00099 {
00100     friend class KMWSessionManaged;
00101     Q_OBJECT
00102 
00103 public:
00136 #ifdef qdoc
00137     KMainWindow( TQWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
00138 #else
00139     KMainWindow( TQWidget* parent = 0, const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
00140 #endif
00141 
00152     enum CreationFlags
00153     {
00154         NoDCOPObject = 1
00155     };
00156 
00162 #ifdef qdoc
00163     KMainWindow( int cflags, TQWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
00164 #else
00165     KMainWindow( int cflags, TQWidget* parent = 0, const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
00166 #endif
00167 
00174     virtual ~KMainWindow();
00175 
00200     KPopupMenu* helpMenu( const TQString &aboutAppText = TQString::null,
00201               bool showWhatsThis = true );
00202 
00225     KPopupMenu* customHelpMenu( bool showWhatsThis = true );
00226 
00293     static bool canBeRestored( int number );
00294 
00302     // KDE 4 return TQCString - TQObject::className() returns const char*
00303     static const TQString classNameOfToplevel( int number );
00304 
00308     // KDE4 remove this method if this has been fixed in Qt
00309     virtual void show();
00310 
00314     // KDE4 remove this method if this has been fixed in Qt
00315     virtual void hide();
00316 
00325     bool restore( int number, bool show = true );
00326 
00327     virtual KXMLGUIFactory *guiFactory();
00328 
00348     void createGUI( const TQString &xmlfile = TQString::null, bool _conserveMemory = true );
00349 
00356     void setHelpMenuEnabled(bool showHelpMenu = true);
00357 
00361     bool isHelpMenuEnabled();
00362 
00363 
00368      bool hasMenuBar();
00369 
00375     KMenuBar *menuBar();
00376 
00388     KStatusBar *statusBar();
00389 
00393     static TQPtrList<KMainWindow>* memberList;
00394 
00395     //KDE4: replace with memberList() and make memberList member private
00400     static TQPtrList<KMainWindow>* getMemberList();
00401 
00412     KToolBar *toolBar( const char *name=0 );
00413 
00417     TQPtrListIterator<KToolBar> toolBarIterator();
00418 
00423     KAccel *accel();
00424 
00425     void setFrameBorderWidth( int ) {}
00426 
00458     void setAutoSaveSettings( const TQString & groupName = TQString::fromLatin1("MainWindow"),
00459                               bool saveWindowSize = true );
00460 
00465     void resetAutoSaveSettings();
00466 
00472     bool autoSaveSettings() const;
00473 
00481     TQString autoSaveGroup() const;
00482 
00492     void applyMainWindowSettings(KConfig *config, const TQString &groupName, bool force);
00493     // KDE4 merge with force=false
00494     void applyMainWindowSettings(KConfig *config, const TQString &groupName = TQString::null);
00495 
00504     void saveMainWindowSettings(KConfig *config, const TQString &groupName = TQString::null);
00505 
00524     void setStandardToolBarMenuEnabled( bool enable );
00526     bool isStandardToolBarMenuEnabled() const;
00527 
00528 
00549     void createStandardStatusBarAction();
00550 
00554     enum StandardWindowOptions
00555     {
00561         ToolBar = 1,
00562 
00566         Keys = 2,
00567 
00572         StatusBar = 4,
00573 
00584         Save = 8,
00585 
00590         Create = 16
00591     };
00592 
00604     void setupGUI( int options = ToolBar | Keys | StatusBar | Save | Create, const TQString& xmlfile = TQString::null );
00605 
00619     void setupGUI( TQSize defaultSize, int options = ToolBar | Keys | StatusBar | Save | Create, const TQString& xmlfile = TQString::null );
00620 
00625     KAction *toolBarMenuAction();
00626 
00631     void setupToolbarMenuActions();
00632 
00633     // why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI;
00635     virtual void finalizeGUI( KXMLGUIClient *client );
00636 
00640     void finalizeGUI( bool force );
00641 
00646     bool initialGeometrySet() const;
00647 
00652     void ignoreInitialGeometry();
00653 
00669     // KDE4 to be removed
00670     TQSize sizeForCentralWidgetSize(TQSize size) KDE_DEPRECATED;
00671 
00675     // KDE4 remove
00676     virtual void setIcon( const TQPixmap & );
00677 
00678 public slots:
00691    int configureToolbars(); // TODO KDE4: make virtual and reimplement in KParts::MainWindow
00692 
00700     virtual void setCaption( const TQString &caption );
00710     virtual void setCaption( const TQString &caption, bool modified );
00711 
00718     virtual void setPlainCaption( const TQString &caption );
00719 
00741     void appHelpActivated( void );
00742 
00749     virtual void slotStateChanged(const TQString &newstate);
00750 
00759     void slotStateChanged(const TQString &newstate,
00760                           KXMLGUIClient::ReverseStateChange); // KDE 4.0: remove this
00761 
00762 
00770 //     void slotStateChanged(const TQString &newstate,
00771 //                           bool reverse); // KDE 4.0: enable this
00772 
00780     void setSettingsDirty();
00781 
00782 protected:
00783     void paintEvent( TQPaintEvent* e );
00784     void childEvent( TQChildEvent* e);
00785     void resizeEvent( TQResizeEvent* e);
00793     virtual void closeEvent ( TQCloseEvent *);
00794 
00795     // KDE4 This seems to be flawed to me. Either the app has only one
00796     // mainwindow, so queryClose() is enough, or if it can have more of them,
00797     // then the windows should take care of themselves, and queryExit()
00798     // would be useful only for the annoying 'really quit' dialog, which
00799     // also doesn't make sense in apps with multiple mainwindows.
00800     // And saving configuration in something called queryExit()? IMHO
00801     // one can e.g. use KApplication::shutDown(), which if nothing else
00802     // has at least better fitting name.
00803     // See also KApplication::sessionSaving().
00804     // This stuff should get changed somehow, so that it at least doesn't
00805     // mess with session management.
00833     virtual bool queryExit();
00834 
00869     virtual bool queryClose();
00870 
00884     virtual void saveProperties( KConfig* ) {}
00885 
00889     virtual void readProperties( KConfig* ) {}
00890 
00907     virtual void saveGlobalProperties( KConfig* sessionConfig );
00908 
00914     virtual void readGlobalProperties( KConfig* sessionConfig );
00915     void savePropertiesInternal( KConfig*, int );
00916     bool readPropertiesInternal( KConfig*, int );
00917 
00921     bool settingsDirty() const;
00925     TQString settingsGroup() const;
00930     void saveWindowSize( KConfig * config ) const;
00936     void restoreWindowSize( KConfig * config );
00937 
00939     void parseGeometry(bool parsewidth);
00940 
00941 protected slots:
00946    void saveNewToolbarConfig(); // TODO KDE4: make virtual and reimplement in KParts::MainWindow
00947 
00972     virtual void showAboutApplication();
00973 
00997     void saveAutoSaveSettings();
00998 
00999 private slots:
01003     void shuttingDown();
01004 
01005 private:
01006     KMenuBar *internalMenuBar();
01007     KStatusBar *internalStatusBar();
01008     KHelpMenu *mHelpMenu, *helpMenu2;
01009     KXMLGUIFactory *factory_;
01010     TQPtrList<KToolBar> toolbarList;
01011 protected:
01012     virtual void virtual_hook( int id, void* data );
01013 private:
01014     KMainWindowPrivate *d;
01015     void initKMainWindow(const char *name, int cflags);
01016 };
01017 
01018 #define RESTORE(type) { int n = 1;\
01019     while (KMainWindow::canBeRestored(n)){\
01020       (new type)->restore(n);\
01021       n++;}}
01022 
01023 #define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS 3
01024 
01035 template <typename T>
01036 inline void kRestoreMainWindows() {
01037   for ( int n = 1 ; KMainWindow::canBeRestored( n ) ; ++n ) {
01038     const TQString className = KMainWindow::classNameOfToplevel( n );
01039     if ( className == TQString::fromLatin1( T::staticMetaObject()->className() ) )
01040       (new T)->restore( n );
01041   }
01042 }
01043 
01044 template <typename T0, typename T1>
01045 inline void kRestoreMainWindows() {
01046   const char * classNames[2];
01047   classNames[0] = T0::staticMetaObject()->className();
01048   classNames[1] = T1::staticMetaObject()->className();
01049   for ( int n = 1 ; KMainWindow::canBeRestored( n ) ; ++n ) {
01050     const TQString className = KMainWindow::classNameOfToplevel( n );
01051     if ( className == TQString::fromLatin1( classNames[0] ) )
01052       (new T0)->restore( n );
01053     else if ( className == TQString::fromLatin1( classNames[1] ) )
01054       (new T1)->restore( n );
01055   }
01056 }
01057 
01058 template <typename T0, typename T1, typename T2>
01059 inline void kRestoreMainWindows() {
01060   const char * classNames[3];
01061   classNames[0] = T0::staticMetaObject()->className();
01062   classNames[1] = T1::staticMetaObject()->className();
01063   classNames[2] = T2::staticMetaObject()->className();
01064   for ( int n = 1 ; KMainWindow::canBeRestored( n ) ; ++n ) {
01065     const TQString className = KMainWindow::classNameOfToplevel( n );
01066     if ( className == TQString::fromLatin1( classNames[0] ) )
01067       (new T0)->restore( n );
01068     else if ( className == TQString::fromLatin1( classNames[1] ) )
01069       (new T1)->restore( n );
01070     else if ( className == TQString::fromLatin1( classNames[2] ) )
01071       (new T2)->restore( n );
01072   }
01073 }
01074 
01075 #endif
01076 

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |