summaryrefslogtreecommitdiff
path: root/src/Dock.h
blob: 491d2d5eddb2b220ed1b3cde12dd0e134c1a42ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* $Id: Dock.h,v 1.5 2007/01/07 05:00:56 whot Exp $ */

#ifndef __DOCK_H__
#define __DOCK_H__

#include <vector>
#include <cairo.h>
#include "XConn.h"
#include "Config.h"
#include "DockApp.h"
#include "DockProcess.h"
#include "DockKeyboard.h"

using namespace std;

const int DOCK_BUTTON_WIDTH = 32;
const int DOCK_BUTTON_HEIGHT = 32;
/* 
   Size of the dock is always applications * dock button size
   the following two decide how much bigger (in px) the dock should be than
   the space occupied by the buttons. Space will be divided equally to left
   and right of the buttons. Height will be above the buttons.
 */
const int DOCK_WIDTH_EXTENDED = 10;
const int DOCK_HEIGHT_EXTENDED = 5;

class DockProcess;
class DockApp;

class Dock 
{
    private:
        XConn* x11;
        Window dock;
        Pixmap backbuff;
        GC gc_dock;
        vector<DockApp*> apps; /* apps to start app */
        vector<DockProcess*> processes; /* minimized processes */
        vector<DockKeyboard*> keyboards; /* connected keyboards */

        int x;
        int y;
        int width;
        int height;
        
        cairo_t* cr;

    public:
        Dock(XConn* x11);
        ~Dock();
        bool hasWindow(Window win);
        void handleExpose(XExposeEvent* ev);
        void handleButtonEvent(XButtonEvent *ev);
        void appendProcess(WMWindow* win);
        void appendKeyboard(KeyboardDevice* kbd);
        void removeProcess(DockProcess* dp);

    private:
        void repaint();
};

#endif