You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kooldock/src/kooldock.h

368 lines
11 KiB

/***************************************************************************
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 <config.h>
#endif
#include <kapp.h>
#include <tdepopupmenu.h>
#include <twinmodule.h>
#include <tdeaboutdialog.h>
#include <krootpixmap.h>
#include <kpixmap.h>
#include <kurifilter.h>
#include <tqwidget.h>
#include <tqptrlist.h>
#include <tqtimer.h>
#include <tqcolor.h>
#include <netwm.h>
#include <tqdatetime.h>
#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 TQWidget
{
Q_OBJECT
public:
/** construtor */
KoolDock(TQWidget* parent = 0, const char* name = 0);
/** destructor */
~KoolDock();
void setMainPath(const TQString& path);
void setArgs(const TQString& param);
clip *clipw;
private:
TQTime* 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;
TQColor 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
TQString 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;
TQStringList lstDrop;
bool useList;
Atom net_system_tray_selection;
Atom net_system_tray_opcode;
TQString fLeftImg;
TQString fRightImg;
TQString fCenterImg;
bool fNWideBg;
bool scaleMax;
TQPixmap LeftImg;
TQPixmap RightImg;
TQPixmap CenterImg;
TQPixmap TempScaledCenter;
TQPixmap TestPix;
TQImage TestIm;
unsigned int oLeft, oRight;
int iwSmall;
int iwBig;
int iwBig2;
int firstX, tmpw;
int oldfirstX, oldtmpw;
int lastX;
int dockOpacity;
TQColor bgColor;
TQColor sepColor; // separator bar's color
int Ybase;
// normal variables
TQString progPath;
TQString menuPath;
TQString confFile;
TQString iFilename; // right clicked item filename
TQString mainPath;
TQString args;
TQStringList 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;
TQPtrList<Item> items;//currently visible items
TQPtrList<Item> 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
TQPixmap offscr;//drawing buffer
KRootPixmap* rootpix;
KPixmap bottomBg;
KPixmap bottomBgf;
TQPixmap topBg;
TDEAboutDialog* aboutDlg;
TQTimer* mkbigTimer; //zoom animation timers
TQTimer* mksmallTimer;
TQTimer* mTimer; //mouse move emulator (can't use normal event instead)
TQTimer* onChangeTimer; // used when a window has changed and we need to notify user
TQTimer* 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)
TQString cClass;
WId CurrentFocus;
int onChangeAnimStep;
TDEPopupMenu* deskpopup;
TDEPopupMenu* appMenu;
TDEPopupMenu* godesk;
TDEPopupMenu* tasklist;
TDEPopupMenu* popup;
TDEPopupMenu* advMenu;
int menuCount, currMenu;
bool allApps;
TQPtrList<TDEPopupMenu> popups;
bool iGroup;
int dIndex, nDesks;
TQPtrList<dInfo> desks;
bool fExpanded;
bool track2active;
/*Xosd Section */
TQString nom;
TQString aux;
int xosd_st;
int showNames;
int fCleaner;
int xosdShadowOffset;
TQString xosdFont;
TQString xosdColor;
TQString xosdShadowColor;
bool xosdBold;
bool xosdItalic;
int xosdSize;
KURIFilterData* _filterData;
xosd* xosdw;
int animValue;
int animState;
void run(const TQString& 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(TDEPopupMenu* 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(TQPaintEvent*);
void mousePressEvent(TQMouseEvent*);
void mMoveEvent(int ex, int ey);
void mPress( int mx, int my, ButtonState srcButton);
void wheelEvent(TQWheelEvent*);
void enterEvent(TQEvent*);
void onleaveEvent(TQEvent*);
void mksmallTimerstop();
void dragMoveEvent(TQDragMoveEvent* event);
void dropEvent(TQDropEvent* 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 TQPixmap&);
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(const TQString& filename,
const TQString& iconname,
const TQString& execname,
const TQString& name,
bool notify = true,
bool terminal = false,
bool tclose = false,
bool cuser = false,
TQString = "na");
bool ignored(const TQString& appname);
#ifdef _ENABLE_DEBUG
static void debug(TQString message);
#endif
#ifndef _ENABLE_DEBUG
static void debug(TQString);
#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 // KOOLDOCK_H