21 #ifndef TDEMAINWINDOW_H
22 #define TDEMAINWINDOW_H
24 #include "kxmlguifactory.h"
25 #include "kxmlguiclient.h"
26 #include "kxmlguibuilder.h"
27 #include <tqmainwindow.h>
28 #include <tqmetaobject.h>
29 #include <tdetoolbar.h>
38 class KMWSessionManaged;
39 class TDEMainWindowPrivate;
41 class TDEToolBarMenuAction;
44 #define KDE_DEFAULT_WINDOWFLAGS WType_TopLevel | WDestructiveClose
100 friend class KMWSessionManaged;
137 TDEMainWindow( TQWidget* parent = 0,
const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
139 TDEMainWindow( TQWidget* parent = 0,
const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
164 TDEMainWindow(
int cflags, TQWidget* parent = 0,
const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose );
166 TDEMainWindow(
int cflags, TQWidget* parent = 0,
const char *name = 0, WFlags f = (WFlags)(WType_TopLevel | WDestructiveClose) );
201 TDEPopupMenu* helpMenu(
const TQString &aboutAppText = TQString::null,
202 bool showWhatsThis =
true );
226 TDEPopupMenu* customHelpMenu(
bool showWhatsThis =
true );
294 static bool canBeRestored(
int number );
304 static const TQString classNameOfToplevel(
int number );
326 bool restore(
int number,
bool show =
true );
349 void createGUI(
const TQString &xmlfile = TQString::null,
bool _conserveMemory =
true );
357 void setHelpMenuEnabled(
bool showHelpMenu =
true);
362 bool isHelpMenuEnabled();
401 static TQPtrList<TDEMainWindow>* getMemberList();
418 TQPtrListIterator<TDEToolBar> toolBarIterator();
426 void setFrameBorderWidth(
int ) {}
459 void setAutoSaveSettings(
const TQString & groupName = TQString::fromLatin1(
"MainWindow"),
460 bool saveWindowSize =
true );
466 void resetAutoSaveSettings();
473 bool autoSaveSettings()
const;
482 TQString autoSaveGroup()
const;
493 void applyMainWindowSettings(
TDEConfig *config,
const TQString &groupName,
bool force);
495 void applyMainWindowSettings(
TDEConfig *config,
const TQString &groupName = TQString::null);
505 void saveMainWindowSettings(
TDEConfig *config,
const TQString &groupName = TQString::null);
525 void setStandardToolBarMenuEnabled(
bool enable );
527 bool isStandardToolBarMenuEnabled()
const;
550 void createStandardStatusBarAction();
605 void setupGUI(
int options = ToolBar | Keys | StatusBar | Save | Create,
const TQString& xmlfile = TQString::null );
620 void setupGUI( TQSize defaultSize,
int options = ToolBar | Keys | StatusBar | Save | Create,
const TQString& xmlfile = TQString::null );
632 void setupToolbarMenuActions();
641 void finalizeGUI(
bool force );
647 bool initialGeometrySet()
const;
653 void ignoreInitialGeometry();
671 TQSize sizeForCentralWidgetSize(TQSize size) TDE_DEPRECATED;
677 virtual void setIcon(
const TQPixmap & );
692 int configureToolbars();
701 virtual void setCaption(
const TQString &caption );
711 virtual void setCaption(
const TQString &caption,
bool modified );
719 virtual void setPlainCaption(
const TQString &caption );
742 void appHelpActivated(
void );
750 virtual void slotStateChanged(
const TQString &newstate);
760 void slotStateChanged(
const TQString &newstate,
761 KXMLGUIClient::ReverseStateChange);
781 void setSettingsDirty();
784 void paintEvent( TQPaintEvent* e );
785 void childEvent( TQChildEvent* e);
786 void resizeEvent( TQResizeEvent* e);
794 virtual void closeEvent ( TQCloseEvent *);
834 virtual bool queryExit();
870 virtual bool queryClose();
908 virtual void saveGlobalProperties(
TDEConfig* sessionConfig );
915 virtual void readGlobalProperties(
TDEConfig* sessionConfig );
916 void savePropertiesInternal(
TDEConfig*,
int );
917 bool readPropertiesInternal(
TDEConfig*,
int );
922 bool settingsDirty()
const;
926 TQString settingsGroup()
const;
931 void saveWindowSize(
TDEConfig * config )
const;
937 void restoreWindowSize(
TDEConfig * config );
940 void parseGeometry(
bool parsewidth);
947 void saveNewToolbarConfig();
973 virtual void showAboutApplication();
998 void saveAutoSaveSettings();
1004 void shuttingDown();
1011 TQPtrList<TDEToolBar> toolbarList;
1013 virtual void virtual_hook(
int id,
void* data );
1015 TDEMainWindowPrivate *d;
1016 void initTDEMainWindow(
const char *name,
int cflags);
1019 #define RESTORE(type) { int n = 1;\
1020 while (TDEMainWindow::canBeRestored(n)){\
1021 (new type)->restore(n);\
1024 #define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS 3
1036 template <
typename T>
1037 inline void kRestoreMainWindows() {
1040 if ( className == TQString::fromLatin1( T::staticMetaObject()->className() ) )
1041 (
new T)->restore( n );
1045 template <
typename T0,
typename T1>
1046 inline void kRestoreMainWindows() {
1047 const char * classNames[2];
1048 classNames[0] = T0::staticMetaObject()->className();
1049 classNames[1] = T1::staticMetaObject()->className();
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 );
1059 template <
typename T0,
typename T1,
typename T2>
1060 inline 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();
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 );