Add missing libraries to examples' Makefiles
[dockapps.git] / wmmixer / xhandler.h
blobe6c9fc4c5130fa0195a72893baa47cc4f4919573
1 // wmmixer - A mixer designed for WindowMaker
2 //
3 // Release 1.5
4 // Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
5 // Copyright (C) 2002 Gordon Fraser <gordon@debian.org>
6 // This software comes with ABSOLUTELY NO WARRANTY
7 // This software is free software, and you are welcome to redistribute it
8 // under certain conditions
9 // See the COPYING file for details.
12 #ifndef __xhandler_h__
13 #define __xhandler_h__
15 //--------------------------------------------------------------------
17 // X-Windows includes - standard
18 #include <X11/X.h>
19 #include <X11/Xlib.h>
20 #include <X11/Xutil.h>
21 #include <X11/Xproto.h>
22 #include <X11/xpm.h>
23 #include <X11/extensions/shape.h>
25 #include <iostream>
26 #include <stdio.h>
27 #include <string.h>
28 #include <stdlib.h>
29 #include "common.h"
31 // Xpm images - standard
32 #include "XPM/wmmixer.xpm"
33 #include "XPM/tile.xpm"
35 // Xpm images - custom
36 #include "XPM/icons.xpm"
37 #include "XPM/norec.xpm"
39 //--------------------------------------------------------------------
40 #define BTN_LEFT_X 5
41 #define BTN_LEFT_Y 34
43 #define BTN_RIGHT_X 17
44 #define BTN_RIGHT_Y 34
46 #define BTN_MUTE_X 17
47 #define BTN_MUTE_Y 47
49 #define BTN_REC_X 5
50 #define BTN_REC_Y 47
52 #define BTN_WIDTH 12
53 #define BTN_HEIGHT 11
55 #define BTNNEXT 1
56 #define BTNPREV 2
57 #define BTNREC 4
58 #define BTNMUTE 8
61 //--------------------------------------------------------------------
62 class XHandler
64 protected:
65 int button_state_;
66 int window_size_;
68 bool is_wmaker_;
69 bool is_ushape_;
70 bool is_astep_;
72 unsigned *icon_list_;
74 Display *display_default_;
75 Window window_icon_;
76 Window window_main_;
77 Window window_root_;
79 GC graphics_context_;
80 unsigned long colors_[4];
81 unsigned long shade_colors_[25];
83 char display_name_[256];
84 char position_name_[256];
85 char ledcolor_name_[256];
86 char ledcolor_high_name_[256];
87 char backcolor_name_[256];
88 char window_class_[256];
90 Pixel back_pix;
91 Pixel fore_pix;
93 // Pixmaps - standard
94 Pixmap pixmap_main;
95 Pixmap pixmap_tile;
96 Pixmap pixmap_disp;
97 Pixmap pixmap_mask;
99 // Pixmaps - custom
100 Pixmap pixmap_icon;
101 Pixmap pixmap_nrec;
103 // X-Windows basics - standard
104 Atom _XA_GNUSTEP_WM_FUNC;
105 Atom deleteWin;
108 unsigned long getColor(char*);
109 unsigned long mixColor(char*, int, char*, int);
110 void drawButton(int, int, int, int, bool);
111 void initPixmaps(int);
112 void initWindow(int, char**);
113 void initGraphicsContext();
114 void initMask();
115 void initColors();
116 void initIcons(int);
118 int flush_expose(Window);
120 public:
121 XHandler();
122 virtual ~XHandler();
123 void init(int, char**, int);
125 void repaint();
126 void update(unsigned);
127 void drawLeft(unsigned);
128 void drawRight(unsigned);
129 void drawBtns(int, bool);
130 void drawMono(unsigned);
132 bool isLeftButton(int, int);
133 bool isRightButton(int, int);
134 bool isMuteButton(int, int);
135 bool isRecButton(int, int);
136 bool isVolumeBar(int, int);
138 Display* getDisplay() {return display_default_;}
139 int getButtonState();
140 void setButtonState(int);
141 void setDisplay(char* arg);
142 void setPosition(char* arg);
143 void setLedColor(char* arg);
144 void setLedHighColor(char* arg);
145 void setBackColor(char* arg);
146 void setWindowClass(char* arg);
147 void setUnshaped();
148 void setWindowMaker();
149 void setAfterStep();
150 int getWindowSize();
151 Atom getDeleteWin();
155 #endif //__xhandler_h__