00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __desktop_h__
00021 #define __desktop_h__
00022
00023 #include "KDesktopIface.h"
00024
00025 #include <tqwidget.h>
00026 #include <tqstringlist.h>
00027 #include <tqvaluevector.h>
00028
00029 #include <kapplication.h>
00030
00031 class KURL;
00032 class TQCloseEvent;
00033 class TQDropEvent;
00034 class TQPopupMenu;
00035 class KGlobalAccel;
00036 class KWinModule;
00037 class KBackgroundManager;
00038 class TQTimer;
00039 class StartupId;
00040 class KDIconView;
00041 class Minicli;
00042 class KActionCollection;
00043
00044 class KRootWidget : public QObject
00045 {
00046 Q_OBJECT
00047 public:
00048 KRootWidget();
00049 bool eventFilter( TQObject *, TQEvent * e );
00050 signals:
00051 void wheelRolled( int delta );
00052 void colorDropEvent( TQDropEvent* e );
00053 void imageDropEvent( TQDropEvent* e );
00054 void newWallpaper( const KURL& url );
00055 };
00056
00062 class KDesktop : public TQWidget, virtual public KDesktopIface
00063 {
00064 Q_OBJECT
00065
00066 public:
00067
00068 enum WheelDirection { Forward = 0, Reverse };
00069
00070 KDesktop(bool x_root_hack, bool wait_for_kded );
00071 ~KDesktop();
00072
00073
00074 virtual void rearrangeIcons();
00075 virtual void lineupIcons();
00076 virtual void selectAll();
00077 virtual void unselectAll();
00078 virtual void refreshIcons();
00079 virtual void setShowDesktop( bool b );
00080 virtual bool showDesktopState();
00081 virtual void toggleShowDesktop();
00082 virtual TQStringList selectedURLs();
00083
00084 virtual void configure();
00085 virtual void popupExecuteCommand();
00086 virtual void popupExecuteCommand(const TQString& content);
00087 virtual void refresh();
00088 virtual void logout();
00089 virtual void clearCommandHistory();
00090 virtual void runAutoStart();
00091
00092 virtual void switchDesktops( int delta );
00093
00094 virtual void desktopIconsAreaChanged(const TQRect &area, int screen);
00095
00096 void logout( KApplication::ShutdownConfirm confirm, KApplication::ShutdownType sdtype );
00097
00098 KWinModule* kwinModule() const { return m_pKwinmodule; }
00099
00100
00101 KActionCollection *actionCollection();
00102
00103
00104 KURL url() const;
00105
00106
00107 KDIconView *iconView() const { return m_pIconView; }
00108
00109 private slots:
00111 void backgroundInitDone();
00112
00114 void slotStart();
00115
00117 void slotUpAndRunning();
00118
00120 void slotConfigure();
00121
00123 void slotExecuteCommand();
00124
00126 void slotShowTaskManager();
00127
00128 void slotShowWindowList();
00129
00130 void slotSwitchUser();
00131
00132 void slotLogout();
00133 void slotLogoutNoCnf();
00134 void slotHaltNoCnf();
00135 void slotRebootNoCnf();
00136
00138 void slotDatabaseChanged();
00139
00140 void slotShutdown();
00141 void slotSettingsChanged(int);
00142 void slotIconChanged(int);
00143
00145 void slotSetVRoot();
00146
00148 void handleImageDropEvent( TQDropEvent * );
00149 void handleColorDropEvent( TQDropEvent * );
00150 void slotNewWallpaper(const KURL &url);
00151
00153 void slotSwitchDesktops(int delta);
00154
00155
00156 void slotNoKicker();
00157
00159 void slotCurrentDesktopChanged(int);
00160 void slotWindowAdded(WId w);
00161 void slotWindowChanged(WId w, unsigned int dirty);
00162
00163 protected:
00164 void initConfig();
00165 void initRoot();
00166
00167 virtual void closeEvent(TQCloseEvent *e);
00168
00169 virtual bool isVRoot() { return set_vroot; }
00170 virtual void setVRoot( bool enable );
00171
00172 virtual bool isIconsEnabled() { return m_bDesktopEnabled; }
00173 virtual void setIconsEnabled( bool enable );
00174 virtual bool event ( TQEvent * e );
00175
00176 virtual TQPoint findPlaceForIcon( int column, int row);
00177 virtual void addIcon(const TQString &url, int x, int y);
00178 virtual void addIcon(const TQString &url, const TQString &dest, int x, int y);
00179 virtual void removeIcon(const TQString &url);
00180
00181 private slots:
00182 void desktopResized();
00183
00184 signals:
00185 void desktopShown(bool shown);
00186
00187 private:
00188
00189 KGlobalAccel *keys;
00190
00191 KWinModule* m_pKwinmodule;
00192
00193 KBackgroundManager* bgMgr;
00194
00195 KDIconView *m_pIconView;
00196 KRootWidget *m_pRootWidget;
00197
00198 Minicli *m_miniCli;
00199
00200 StartupId* startup_id;
00201 bool set_vroot;
00202
00204 bool m_bInit;
00205
00207 bool m_bWaitForKded;
00208
00210 bool m_bDesktopEnabled;
00211
00213 bool m_bWheelSwitchesWorkspace;
00214
00215 TQTimer *m_waitForKicker;
00216
00220 static const WheelDirection m_eDefaultWheelDirection = Forward;
00221
00223 static WheelDirection m_eWheelDirection;
00224
00226 static const char* m_wheelDirectionStrings[2];
00227
00228 bool m_wmSupport;
00229 WId m_activeWindow;
00230 TQValueVector<WId> m_iconifiedList;
00231 };
00232
00233 #endif