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

kdeui

  • kdeui
kmainwindow.h
1 /*
2  This file is part of the KDE libraries
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 
18 
19 */
20 
21 #ifndef KMAINWINDOW_H
22 #define KMAINWINDOW_H
23 
24 #include "kxmlguifactory.h"
25 #include "kxmlguiclient.h"
26 #include "kxmlguibuilder.h"
27 #include <tqmainwindow.h>
28 #include <tqmetaobject.h>
29 #include <ktoolbar.h>
30 
31 class KPopupMenu;
32 class KXMLGUIFactory;
33 class KConfig;
34 class KHelpMenu;
35 class KStatusBar;
36 class TQStatusBar;
37 class KMenuBar;
38 class KMWSessionManaged;
39 class KMainWindowPrivate;
40 class KAccel;
41 class KToolBarMenuAction;
42 class DCOPObject;
43 
44 #define KDE_DEFAULT_WINDOWFLAGS WType_TopLevel | WDestructiveClose
45 
46 
98 class KDEUI_EXPORT KMainWindow : public TQMainWindow, public KXMLGUIBuilder, virtual public KXMLGUIClient
99 {
100  friend class KMWSessionManaged;
101  Q_OBJECT
102 
103 public:
136 #ifdef qdoc
137  KMainWindow( TQWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
138 #else
139  KMainWindow( TQWidget* parent = 0, const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
140 #endif
141 
152  enum CreationFlags
153  {
154  NoDCOPObject = 1
155  };
156 
162 #ifdef qdoc
163  KMainWindow( int cflags, TQWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
164 #else
165  KMainWindow( int cflags, TQWidget* parent = 0, const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
166 #endif
167 
174  virtual ~KMainWindow();
175 
200  KPopupMenu* helpMenu( const TQString &aboutAppText = TQString::null,
201  bool showWhatsThis = true );
202 
225  KPopupMenu* customHelpMenu( bool showWhatsThis = true );
226 
293  static bool canBeRestored( int number );
294 
302  // KDE 4 return TQCString - TQObject::className() returns const char*
303  static const TQString classNameOfToplevel( int number );
304 
308  // KDE4 remove this method if this has been fixed in Qt
309  virtual void show();
310 
314  // KDE4 remove this method if this has been fixed in Qt
315  virtual void hide();
316 
325  bool restore( int number, bool show = true );
326 
327  virtual KXMLGUIFactory *guiFactory();
328 
348  void createGUI( const TQString &xmlfile = TQString::null, bool _conserveMemory = true );
349 
356  void setHelpMenuEnabled(bool showHelpMenu = true);
357 
361  bool isHelpMenuEnabled();
362 
363 
368  bool hasMenuBar();
369 
375  KMenuBar *menuBar();
376 
388  KStatusBar *statusBar();
389 
393  static TQPtrList<KMainWindow>* memberList;
394 
395  //KDE4: replace with memberList() and make memberList member private
400  static TQPtrList<KMainWindow>* getMemberList();
401 
412  KToolBar *toolBar( const char *name=0 );
413 
417  TQPtrListIterator<KToolBar> toolBarIterator();
418 
423  KAccel *accel();
424 
425  void setFrameBorderWidth( int ) {}
426 
458  void setAutoSaveSettings( const TQString & groupName = TQString::fromLatin1("MainWindow"),
459  bool saveWindowSize = true );
460 
465  void resetAutoSaveSettings();
466 
472  bool autoSaveSettings() const;
473 
481  TQString autoSaveGroup() const;
482 
492  void applyMainWindowSettings(KConfig *config, const TQString &groupName, bool force);
493  // KDE4 merge with force=false
494  void applyMainWindowSettings(KConfig *config, const TQString &groupName = TQString::null);
495 
504  void saveMainWindowSettings(KConfig *config, const TQString &groupName = TQString::null);
505 
524  void setStandardToolBarMenuEnabled( bool enable );
526  bool isStandardToolBarMenuEnabled() const;
527 
528 
549  void createStandardStatusBarAction();
550 
554  enum StandardWindowOptions
555  {
561  ToolBar = 1,
562 
566  Keys = 2,
567 
572  StatusBar = 4,
573 
584  Save = 8,
585 
590  Create = 16
591  };
592 
604  void setupGUI( int options = ToolBar | Keys | StatusBar | Save | Create, const TQString& xmlfile = TQString::null );
605 
619  void setupGUI( TQSize defaultSize, int options = ToolBar | Keys | StatusBar | Save | Create, const TQString& xmlfile = TQString::null );
620 
625  KAction *toolBarMenuAction();
626 
631  void setupToolbarMenuActions();
632 
633  // why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI;
635  virtual void finalizeGUI( KXMLGUIClient *client );
636 
640  void finalizeGUI( bool force );
641 
646  bool initialGeometrySet() const;
647 
652  void ignoreInitialGeometry();
653 
669  // KDE4 to be removed
670  TQSize sizeForCentralWidgetSize(TQSize size) KDE_DEPRECATED;
671 
675  // KDE4 remove
676  virtual void setIcon( const TQPixmap & );
677 
678 public slots:
691  int configureToolbars(); // TODO KDE4: make virtual and reimplement in KParts::MainWindow
692 
700  virtual void setCaption( const TQString &caption );
710  virtual void setCaption( const TQString &caption, bool modified );
711 
718  virtual void setPlainCaption( const TQString &caption );
719 
741  void appHelpActivated( void );
742 
749  virtual void slotStateChanged(const TQString &newstate);
750 
759  void slotStateChanged(const TQString &newstate,
760  KXMLGUIClient::ReverseStateChange); // KDE 4.0: remove this
761 
762 
770 // void slotStateChanged(const TQString &newstate,
771 // bool reverse); // KDE 4.0: enable this
772 
780  void setSettingsDirty();
781 
782 protected:
783  void paintEvent( TQPaintEvent* e );
784  void childEvent( TQChildEvent* e);
785  void resizeEvent( TQResizeEvent* e);
793  virtual void closeEvent ( TQCloseEvent *);
794 
795  // KDE4 This seems to be flawed to me. Either the app has only one
796  // mainwindow, so queryClose() is enough, or if it can have more of them,
797  // then the windows should take care of themselves, and queryExit()
798  // would be useful only for the annoying 'really quit' dialog, which
799  // also doesn't make sense in apps with multiple mainwindows.
800  // And saving configuration in something called queryExit()? IMHO
801  // one can e.g. use KApplication::shutDown(), which if nothing else
802  // has at least better fitting name.
803  // See also KApplication::sessionSaving().
804  // This stuff should get changed somehow, so that it at least doesn't
805  // mess with session management.
833  virtual bool queryExit();
834 
869  virtual bool queryClose();
870 
884  virtual void saveProperties( KConfig* ) {}
885 
889  virtual void readProperties( KConfig* ) {}
890 
907  virtual void saveGlobalProperties( KConfig* sessionConfig );
908 
914  virtual void readGlobalProperties( KConfig* sessionConfig );
915  void savePropertiesInternal( KConfig*, int );
916  bool readPropertiesInternal( KConfig*, int );
917 
921  bool settingsDirty() const;
925  TQString settingsGroup() const;
930  void saveWindowSize( KConfig * config ) const;
936  void restoreWindowSize( KConfig * config );
937 
939  void parseGeometry(bool parsewidth);
940 
941 protected slots:
946  void saveNewToolbarConfig(); // TODO KDE4: make virtual and reimplement in KParts::MainWindow
947 
972  virtual void showAboutApplication();
973 
997  void saveAutoSaveSettings();
998 
999 private slots:
1003  void shuttingDown();
1004 
1005 private:
1006  KMenuBar *internalMenuBar();
1007  KStatusBar *internalStatusBar();
1008  KHelpMenu *mHelpMenu, *helpMenu2;
1009  KXMLGUIFactory *factory_;
1010  TQPtrList<KToolBar> toolbarList;
1011 protected:
1012  virtual void virtual_hook( int id, void* data );
1013 private:
1014  KMainWindowPrivate *d;
1015  void initKMainWindow(const char *name, int cflags);
1016 };
1017 
1018 #define RESTORE(type) { int n = 1;\
1019  while (KMainWindow::canBeRestored(n)){\
1020  (new type)->restore(n);\
1021  n++;}}
1022 
1023 #define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS 3
1024 
1035 template <typename T>
1036 inline void kRestoreMainWindows() {
1037  for ( int n = 1 ; KMainWindow::canBeRestored( n ) ; ++n ) {
1038  const TQString className = KMainWindow::classNameOfToplevel( n );
1039  if ( className == TQString::fromLatin1( T::staticMetaObject()->className() ) )
1040  (new T)->restore( n );
1041  }
1042 }
1043 
1044 template <typename T0, typename T1>
1045 inline void kRestoreMainWindows() {
1046  const char * classNames[2];
1047  classNames[0] = T0::staticMetaObject()->className();
1048  classNames[1] = T1::staticMetaObject()->className();
1049  for ( int n = 1 ; KMainWindow::canBeRestored( n ) ; ++n ) {
1050  const TQString className = KMainWindow::classNameOfToplevel( n );
1051  if ( className == TQString::fromLatin1( classNames[0] ) )
1052  (new T0)->restore( n );
1053  else if ( className == TQString::fromLatin1( classNames[1] ) )
1054  (new T1)->restore( n );
1055  }
1056 }
1057 
1058 template <typename T0, typename T1, typename T2>
1059 inline void kRestoreMainWindows() {
1060  const char * classNames[3];
1061  classNames[0] = T0::staticMetaObject()->className();
1062  classNames[1] = T1::staticMetaObject()->className();
1063  classNames[2] = T2::staticMetaObject()->className();
1064  for ( int n = 1 ; KMainWindow::canBeRestored( n ) ; ++n ) {
1065  const TQString className = KMainWindow::classNameOfToplevel( n );
1066  if ( className == TQString::fromLatin1( classNames[0] ) )
1067  (new T0)->restore( n );
1068  else if ( className == TQString::fromLatin1( classNames[1] ) )
1069  (new T1)->restore( n );
1070  else if ( className == TQString::fromLatin1( classNames[2] ) )
1071  (new T2)->restore( n );
1072  }
1073 }
1074 
1075 #endif
1076 
KAccel
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:43
KMainWindow::classNameOfToplevel
static const TQString classNameOfToplevel(int number)
Returns the className() of the number of the toplevel window which should be restored.
Definition: kmainwindow.cpp:364
KPopupMenu
A menu with title items.
Definition: kpopupmenu.h:123
KMenuBar
KDE Style-able menubar.
Definition: kmenubar.h:42
KMainWindow::saveProperties
virtual void saveProperties(KConfig *)
Save your instance-specific properties.
Definition: kmainwindow.h:884
KStatusBar
KDE statusbar widget
Definition: kstatusbar.h:87
KHelpMenu
Standard KDE help menu with dialog boxes.
Definition: khelpmenu.h:131
KMainWindow::CreationFlags
CreationFlags
Flags that can be passed in an argument to the constructor to change the behavior.
Definition: kmainwindow.h:152
KMainWindow
KDE top level main window
Definition: kmainwindow.h:98
KXMLGUIBuilder
Abstract interface for a "GUI builder", used by the GUIFactory This interface is implemented by KMain...
Definition: kxmlguibuilder.h:39
KMainWindow::canBeRestored
static bool canBeRestored(int number)
Session Management
Definition: kmainwindow.cpp:352
KMainWindow::memberList
static TQPtrList< KMainWindow > * memberList
List of members of KMainWindow class.
Definition: kmainwindow.h:393
KXMLGUIFactory
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
Definition: kxmlguifactory.h:62
KConfig
KToolBar
Floatable toolbar with auto resize.
Definition: ktoolbar.h:104
KMainWindow::readProperties
virtual void readProperties(KConfig *)
Read your instance-specific properties.
Definition: kmainwindow.h:889
KAction
Class to encapsulate user-driven action or event.
Definition: kaction.h:202
KMainWindow::StandardWindowOptions
StandardWindowOptions
Definition: kmainwindow.h:554
DCOPObject

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.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |