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

tdeui

  • tdeui
tdemainwindow.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 TDEMAINWINDOW_H
22#define TDEMAINWINDOW_H
23
24#include "kxmlguifactory.h"
25#include "kxmlguiclient.h"
26#include "kxmlguibuilder.h"
27#include <tqmainwindow.h>
28#include <tqmetaobject.h>
29#include <tdetoolbar.h>
30
31class TDEPopupMenu;
32class KXMLGUIFactory;
33class TDEConfig;
34class KHelpMenu;
35class KStatusBar;
36class TQStatusBar;
37class KMenuBar;
38class KMWSessionManaged;
39class TDEMainWindowPrivate;
40class TDEAccel;
41class TDEToolBarMenuAction;
42class DCOPObject;
43
44#define KDE_DEFAULT_WINDOWFLAGS WType_TopLevel | WDestructiveClose
45
46
98class TDEUI_EXPORT TDEMainWindow : public TQMainWindow, public KXMLGUIBuilder, virtual public KXMLGUIClient
99{
100 friend class KMWSessionManaged;
101 TQ_OBJECT
102
103public:
136#ifdef qdoc
137 TDEMainWindow( TQWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
138#else
139 TDEMainWindow( TQWidget* parent = 0, const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
140#endif
141
152 enum CreationFlags
153 {
154 NoDCOPObject = 1,
155 NewRefCountMode = 2
156 };
157
163#ifdef qdoc
164 TDEMainWindow( int cflags, TQWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
165#else
166 TDEMainWindow( int cflags, TQWidget* parent = 0, const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
167#endif
168
175 virtual ~TDEMainWindow();
176
201 TDEPopupMenu* helpMenu( const TQString &aboutAppText = TQString::null,
202 bool showWhatsThis = true );
203
226 TDEPopupMenu* customHelpMenu( bool showWhatsThis = true );
227
294 static bool canBeRestored( int number );
295
303 // KDE 4 return TQCString - TQObject::className() returns const char*
304 static const TQString classNameOfToplevel( int number );
305
309 // KDE4 remove this method if this has been fixed in Qt
310 virtual void show();
311
315 // KDE4 remove this method if this has been fixed in Qt
316 virtual void hide();
317
326 bool restore( int number, bool show = true );
327
328 virtual KXMLGUIFactory *guiFactory();
329
349 void createGUI( const TQString &xmlfile = TQString::null, bool _conserveMemory = true );
350
357 void setHelpMenuEnabled(bool showHelpMenu = true);
358
362 bool isHelpMenuEnabled();
363
364
369 bool hasMenuBar();
370
376 KMenuBar *menuBar();
377
389 KStatusBar *statusBar();
390
394 static TQPtrList<TDEMainWindow>* memberList;
395
396 //KDE4: replace with memberList() and make memberList member private
401 static TQPtrList<TDEMainWindow>* getMemberList();
402
413 TDEToolBar *toolBar( const char *name=0 );
414
418 TQPtrListIterator<TDEToolBar> toolBarIterator();
419
424 TDEAccel *accel();
425
426 void setFrameBorderWidth( int ) {}
427
459 void setAutoSaveSettings( const TQString & groupName = TQString::fromLatin1("MainWindow"),
460 bool saveWindowSize = true );
461
466 void resetAutoSaveSettings();
467
473 bool autoSaveSettings() const;
474
482 TQString autoSaveGroup() const;
483
493 void applyMainWindowSettings(TDEConfig *config, const TQString &groupName, bool force);
494 // KDE4 merge with force=false
495 void applyMainWindowSettings(TDEConfig *config, const TQString &groupName = TQString::null);
496
505 void saveMainWindowSettings(TDEConfig *config, const TQString &groupName = TQString::null);
506
525 void setStandardToolBarMenuEnabled( bool enable );
527 bool isStandardToolBarMenuEnabled() const;
528
529
550 void createStandardStatusBarAction();
551
555 enum StandardWindowOptions
556 {
562 ToolBar = 1,
563
567 Keys = 2,
568
573 StatusBar = 4,
574
585 Save = 8,
586
591 Create = 16
592 };
593
605 void setupGUI( int options = ToolBar | Keys | StatusBar | Save | Create, const TQString& xmlfile = TQString::null );
606
620 void setupGUI( TQSize defaultSize, int options = ToolBar | Keys | StatusBar | Save | Create, const TQString& xmlfile = TQString::null );
621
626 TDEAction *toolBarMenuAction();
627
632 void setupToolbarMenuActions();
633
634 // why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI;
636 virtual void finalizeGUI( KXMLGUIClient *client );
637
641 void finalizeGUI( bool force );
642
647 bool initialGeometrySet() const;
648
653 void ignoreInitialGeometry();
654
670 // KDE4 to be removed
671 TQSize sizeForCentralWidgetSize(TQSize size) TDE_DEPRECATED;
672
676 // KDE4 remove
677 virtual void setIcon( const TQPixmap & );
678
679public slots:
692 int configureToolbars(); // TODO KDE4: make virtual and reimplement in KParts::MainWindow
693
701 virtual void setCaption( const TQString &caption );
711 virtual void setCaption( const TQString &caption, bool modified );
712
719 virtual void setPlainCaption( const TQString &caption );
720
742 void appHelpActivated( void );
743
750 virtual void slotStateChanged(const TQString &newstate);
751
760 void slotStateChanged(const TQString &newstate,
761 KXMLGUIClient::ReverseStateChange); // KDE 4.0: remove this
762
763
771// void slotStateChanged(const TQString &newstate,
772// bool reverse); // KDE 4.0: enable this
773
781 void setSettingsDirty();
782
783protected:
784 void paintEvent( TQPaintEvent* e );
785 void childEvent( TQChildEvent* e);
786 void resizeEvent( TQResizeEvent* e);
794 virtual void closeEvent ( TQCloseEvent *);
795
796 // KDE4 This seems to be flawed to me. Either the app has only one
797 // mainwindow, so queryClose() is enough, or if it can have more of them,
798 // then the windows should take care of themselves, and queryExit()
799 // would be useful only for the annoying 'really quit' dialog, which
800 // also doesn't make sense in apps with multiple mainwindows.
801 // And saving configuration in something called queryExit()? IMHO
802 // one can e.g. use TDEApplication::shutDown(), which if nothing else
803 // has at least better fitting name.
804 // See also TDEApplication::sessionSaving().
805 // This stuff should get changed somehow, so that it at least doesn't
806 // mess with session management.
834 virtual bool queryExit();
835
870 virtual bool queryClose();
871
885 virtual void saveProperties( TDEConfig* ) {}
886
890 virtual void readProperties( TDEConfig* ) {}
891
908 virtual void saveGlobalProperties( TDEConfig* sessionConfig );
909
915 virtual void readGlobalProperties( TDEConfig* sessionConfig );
916 void savePropertiesInternal( TDEConfig*, int );
917 bool readPropertiesInternal( TDEConfig*, int );
918
922 bool settingsDirty() const;
926 TQString settingsGroup() const;
931 void saveWindowSize( TDEConfig * config ) const;
937 void restoreWindowSize( TDEConfig * config );
938
940 void parseGeometry(bool parsewidth);
941
942protected slots:
947 void saveNewToolbarConfig(); // TODO KDE4: make virtual and reimplement in KParts::MainWindow
948
973 virtual void showAboutApplication();
974
998 void saveAutoSaveSettings();
999
1000private slots:
1004 void shuttingDown();
1005
1006private:
1007 KMenuBar *internalMenuBar();
1008 KStatusBar *internalStatusBar();
1009 KHelpMenu *mHelpMenu, *helpMenu2;
1010 KXMLGUIFactory *factory_;
1011 TQPtrList<TDEToolBar> toolbarList;
1012protected:
1013 virtual void virtual_hook( int id, void* data );
1014private:
1015 TDEMainWindowPrivate *d;
1016 void initTDEMainWindow(const char *name, int cflags);
1017};
1018
1019#define RESTORE(type) { int n = 1;\
1020 while (TDEMainWindow::canBeRestored(n)){\
1021 (new type)->restore(n);\
1022 n++;}}
1023
1024#define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS 3
1025
1036template <typename T>
1037inline void kRestoreMainWindows() {
1038 for ( int n = 1 ; TDEMainWindow::canBeRestored( n ) ; ++n ) {
1039 const TQString className = TDEMainWindow::classNameOfToplevel( n );
1040 if ( className == TQString::fromLatin1( T::staticMetaObject()->className() ) )
1041 (new T)->restore( n );
1042 }
1043}
1044
1045template <typename T0, typename T1>
1046inline void kRestoreMainWindows() {
1047 const char * classNames[2];
1048 classNames[0] = T0::staticMetaObject()->className();
1049 classNames[1] = T1::staticMetaObject()->className();
1050 for ( int n = 1 ; TDEMainWindow::canBeRestored( n ) ; ++n ) {
1051 const TQString className = TDEMainWindow::classNameOfToplevel( n );
1052 if ( className == TQString::fromLatin1( classNames[0] ) )
1053 (new T0)->restore( n );
1054 else if ( className == TQString::fromLatin1( classNames[1] ) )
1055 (new T1)->restore( n );
1056 }
1057}
1058
1059template <typename T0, typename T1, typename T2>
1060inline void kRestoreMainWindows() {
1061 const char * classNames[3];
1062 classNames[0] = T0::staticMetaObject()->className();
1063 classNames[1] = T1::staticMetaObject()->className();
1064 classNames[2] = T2::staticMetaObject()->className();
1065 for ( int n = 1 ; TDEMainWindow::canBeRestored( n ) ; ++n ) {
1066 const TQString className = TDEMainWindow::classNameOfToplevel( n );
1067 if ( className == TQString::fromLatin1( classNames[0] ) )
1068 (new T0)->restore( n );
1069 else if ( className == TQString::fromLatin1( classNames[1] ) )
1070 (new T1)->restore( n );
1071 else if ( className == TQString::fromLatin1( classNames[2] ) )
1072 (new T2)->restore( n );
1073 }
1074}
1075
1076#endif
1077
DCOPObject
KHelpMenu
Standard KDE help menu with dialog boxes.
Definition: khelpmenu.h:132
KMenuBar
KDE Style-able menubar.
Definition: tdemenubar.h:43
KStatusBar
KDE statusbar widget
Definition: kstatusbar.h:88
KXMLGUIBuilder
Abstract interface for a "GUI builder", used by the GUIFactory This interface is implemented by TDEMa...
Definition: kxmlguibuilder.h:40
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
Definition: kxmlguiclient.h:44
KXMLGUIFactory
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
Definition: kxmlguifactory.h:62
TDEAccel
TDEAction
Class to encapsulate user-driven action or event.
Definition: tdeaction.h:203
TDEConfig
TDEMainWindow
KDE top level main window
Definition: tdemainwindow.h:99
TDEMainWindow::readProperties
virtual void readProperties(TDEConfig *)
Read your instance-specific properties.
Definition: tdemainwindow.h:890
TDEMainWindow::CreationFlags
CreationFlags
Flags that can be passed in an argument to the constructor to change the behavior.
Definition: tdemainwindow.h:153
TDEMainWindow::classNameOfToplevel
static const TQString classNameOfToplevel(int number)
Returns the className() of the number of the toplevel window which should be restored.
Definition: tdemainwindow.cpp:373
TDEMainWindow::canBeRestored
static bool canBeRestored(int number)
Session Management
Definition: tdemainwindow.cpp:361
TDEMainWindow::StandardWindowOptions
StandardWindowOptions
Definition: tdemainwindow.h:556
TDEMainWindow::memberList
static TQPtrList< TDEMainWindow > * memberList
List of members of TDEMainWindow class.
Definition: tdemainwindow.h:394
TDEMainWindow::saveProperties
virtual void saveProperties(TDEConfig *)
Save your instance-specific properties.
Definition: tdemainwindow.h:885
TDEPopupMenu
A menu with title items.
Definition: tdepopupmenu.h:123
TDEToolBar
Floatable toolbar with auto resize.
Definition: tdetoolbar.h:105

tdeui

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

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.