/*************************************************************************** kooldock.h - description ------------------- begin : Tue Jun 10 22:18:34 BST 2003 copyright : (C) 2003 by KoolDock team email : ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KOOLDOCK_H #define KOOLDOCK_H #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include "item.h" #include "xosd.h" #include "clip.h" #include "setupdialogprg.h" #include "dinfo.h" const int MAX_ICONS = 150; // max number of icons const int UPDATE_DIST = 1; // update when x - last_x <= UPDATE_DIST const int DEF_SMALL_SIZE = 32; // default small icon size const int DEF_BIG_SIZE = 90; // default big icon size const int DEF_DOCK_OPACITY = 50; // default dock opacity const int DEF_PRIORITY = 5; const int DEF_HIDDEN = 1; // default hidden priority const int ANIM_TOTAL_STEP = 6; // not in use yet const int SPACE_W = 1; // space between quick launchers and tasks (the seperator) const int ON_CHANGE_ANIM_INTERVAL = 50; // animation's interval /** KoolDock is the base class of the project */ class KoolDock : public QWidget { Q_OBJECT public: /** construtor */ KoolDock(QWidget* parent=0, const char *name=0); /** destructor */ ~KoolDock(); //static bool writeIgnoreList(QString text); void setMainPath(QString path); void setArgs(QString param); clip *clipw; private: QTime *perf; // configuration variables int fShowTaskbar; // show-taskbar flag int fMinimizedOnly; // show only minimized icons flag int fShowNotification; // show-notification flag int fShowBorders; // show-borders flag int fShowKMenu; // show the K menu int fUseKBFX; int fPriority; // "nice" priority int fMouseTimer; // Mouse timer interval int fClipping; //window area clippig int fClipIcons; //icon area clipping long int fzoomSpeed, zoomStep, zoomStepB, zoomStepS, zoomVal; //speed of show/hide animation int zoomTicksB, zoomTicksS; //counts timer ticks int neededTicksB,neededTicksS; //sets how many ticks is necessary to calculate new speed bool fSpeed; QColor borderColor; int fHidden; // hidden dockbar int fStayBelow; int fOrientation; //bottom/left/top/right int fHideOnClick; int fSteppy; int fShowFrames; // frames to show the dock "growing from bottom" int fGrowFrames; // frames to grow the icon when the mouse is over it. int fHighLightTime; bool fFirstRun; bool fShowShot; bool fGrouping; int fRepaintInterval; int xinerama; //whether we want xinerama int hideTimer; //user define time to show dock int Solid; //whether using backgroung Image or not (for preference controls) int fShowNav; //whether we want the navigation menu (clock + desktop chooser) in kooldocks main menu int numSystray; //for systray control int fSystray; //whether we want the systray or not int fCurrent; //whether to only show windows on current desktop int oldDesktop; //number of previous desktop bool firstTime; //to control certain things QString curTheme; //for the background theme (to preserve changes) int leftRes; //Left monitor resolution int XinDesiredHeight; int XinPreviousWidth; int fpercentPos; bool noSet; bool firstInit; bool reloadIcons; bool initialization; int ptPart; bool mouseOnLauncher; QStringList lstDrop; bool useList; Atom net_system_tray_selection; Atom net_system_tray_opcode; QString fLeftImg; QString fRightImg; QString fCenterImg; bool fNWideBg; bool scaleMax; QPixmap LeftImg; QPixmap RightImg; QPixmap CenterImg; QPixmap TempScaledCenter; QPixmap TestPix; QImage TestIm; unsigned int oLeft, oRight; int iwSmall; int iwBig; int iwBig2; int firstX, tmpw; int oldfirstX, oldtmpw; int lastX; int dockOpacity; QColor bgColor; QColor sepColor; // separator bar's color int Ybase; // normal variables QString progPath; QString menuPath; QString confFile; QString iFilename; // right clicked item filename QString mainPath; QString args; QStringList ignoreList; NETWinInfo *info; KWinModule *wm; SetupDialog *setupdlg; int Offset; int numLaunchers; // number of quick launcher items int x, y, w, h, h0, h1, w0, x0, w1, x1; int rx, ry, rw, rh, uw; //current position int ix, iy, iDist, iSpace; int dw, dh, rdh; int funcW, funcH; int ii_first, ii_last; int soffset, eoffset; //used in icon positioning int sx, sw; int adjust; int fAmount; int last_mx; int last_ncx; QPtrList items;//currently visible items QPtrList witems;//all windows on all desktops int iSize[MAX_ICONS + 1];//icon sizes int cx[MAX_ICONS + 1];//positions of small icons int cur_cx[MAX_ICONS + 1];//positions of visible icons QPixmap offscr;//drawing buffer KRootPixmap *rootpix; KPixmap bottomBg; KPixmap bottomBgf; QPixmap topBg; KAboutDialog *aboutDlg; QTimer *mkbigTimer; //zoom animation timers QTimer *mksmallTimer; QTimer *mTimer; //mouse move emulator (can't use normal event instead) QTimer *onChangeTimer; // used when a window has changed and we need to notify user QTimer *trackTimer; //checks whether mouse touches screen edge int animStep; // animation step, not in use yet int iOnClick; // index of the quick launcher being clicked WId cId; // id of the application (used in the right click menu over the taskbar) QString cClass; WId CurrentFocus; int onChangeAnimStep; KPopupMenu *deskpopup; KPopupMenu *appMenu; KPopupMenu *godesk; KPopupMenu *tasklist; KPopupMenu *popup; KPopupMenu *advMenu; int menuCount, currMenu; bool allApps; QPtrList popups; bool iGroup; int dIndex, nDesks; QPtrList desks; bool fExpanded; bool track2active; /*Xosd Section */ QString nom; QString aux; //xosd *osd; int xosd_st; int showNames; int fCleaner; int xosdShadowOffset; QString xosdFont; QString xosdColor; QString xosdShadowColor; bool xosdBold; bool xosdItalic; int xosdSize; KURIFilterData *_filterData; xosd *xosdw; int animValue; int animState; void run(QString cmd); int func(int x); int func2(int x); void doUpdateGeometry(); bool addTask(WId id, int iFound=-1); bool rmTask(WId id, int iFound=-1); void rmwTask(int iFound); bool addwTask(WId id); void movetoback(WId id); void loadConf(); void loadIgnore(); void saveConf(); void loadMenu(); void addWindows(); int itemFromPoint(int x); int xFromIndex(int i); void createMenu(WId id, KPopupMenu* tmpMenu, KWin::WindowInfo* info); void updTaskList(); void addToTaskList(WId id); void rmFromTaskList(WId id); bool doRepaint; int currXPos; int lastXPos; int lastYPos; void init1(); void init2(); protected: void paintEvent(QPaintEvent *); void mousePressEvent( QMouseEvent * ); void mMoveEvent( int ex, int ey); void mPress( int mx, int my, ButtonState srcButton); void wheelEvent(QWheelEvent *); void enterEvent(QEvent*); void onleaveEvent(QEvent*); void mksmallTimerstop(); void dragMoveEvent(QDragMoveEvent* event); void dropEvent(QDropEvent* event); public slots: void edit(); void editPref(); void about(); void windowAdded(WId id); void windowRemoved(WId id); void windowChanged(WId id, unsigned int properties); void activeWindowChanged(WId id); void workAreaChanged(); void currentDesktopChanged(int); void onChangeTimerTicked(); void updateBackground(const QPixmap&); void moveApp(); void resizeApp(); void minApp(); void maxApp(); void restApp(); void minAllApps(); void maxAllApps(); void restAllApps(); void closeAllApps(); void shadeApp(); void activateApp(); void closeApp(); void editItem(); void removeItem(); void sendToDesktop(int); void goToDesktop(int); void goToWindow(int); /* Systray support */ void systemTrayWindowAdded(WId id); void systemTrayWindowRemoved(WId id); void aboutToShow(); void aboutToHide(); void toggleAlwaysOnTop(); void toggleKeptBelowOthers(); void toggleFullScreen(); static void addFile(QString filename, QString iconname, QString execname, QString name, bool notify, bool terminal, bool tclose, bool, QString); bool ignored(QString appname); #ifdef _ENABLE_DEBUG static void debug(QString message); #endif #ifndef _ENABLE_DEBUG static void debug(QString); #endif void mkbigTimerDo(); void mksmallTimerDo(); void endProg(); void mTimerEnd(); void trackTimerEnd(); void trackTimer2End(); void restart(); void reload(); void chkRestart(); void refreshBackground(); void unhighlight(); void move2(int nx, int ny); void resize2(int nw, int nh); void getBottomBG(); void getTopBG(); void setDesktopIconsArea(int, int, int, int); void setDockAbove(); void setDockBelow(); void menuX(int num); void menuShow(); void pTest(); }; #endif