Initial dockapps git repo
[dockapps.git] / wmmixer-1.5 / xhandler.h
blob68ecbf8dd7776ec9fc09383190322693cc35e8a1
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];
89 Pixel back_pix;
90 Pixel fore_pix;
92 // Pixmaps - standard
93 Pixmap pixmap_main;
94 Pixmap pixmap_tile;
95 Pixmap pixmap_disp;
96 Pixmap pixmap_mask;
98 // Pixmaps - custom
99 Pixmap pixmap_icon;
100 Pixmap pixmap_nrec;
102 // X-Windows basics - standard
103 Atom _XA_GNUSTEP_WM_FUNC;
104 Atom deleteWin;
107 unsigned long getColor(char*);
108 unsigned long mixColor(char*, int, char*, int);
109 void drawButton(int, int, int, int, bool);
110 void initPixmaps(int);
111 void initWindow(int, char**);
112 void initGraphicsContext();
113 void initMask();
114 void initColors();
115 void initIcons(int);
117 int flush_expose(Window);
119 public:
120 XHandler();
121 virtual ~XHandler();
122 void init(int, char**, int);
124 void repaint();
125 void update(unsigned);
126 void drawLeft(unsigned);
127 void drawRight(unsigned);
128 void drawBtns(int, bool);
129 void drawMono(unsigned);
131 bool isLeftButton(int, int);
132 bool isRightButton(int, int);
133 bool isMuteButton(int, int);
134 bool isRecButton(int, int);
135 bool isVolumeBar(int, int);
137 Display* getDisplay() {return display_default_;}
138 int getButtonState();
139 void setButtonState(int);
140 void setDisplay(char* arg);
141 void setPosition(char* arg);
142 void setLedColor(char* arg);
143 void setLedHighColor(char* arg);
144 void setBackColor(char* arg);
145 void setUnshaped();
146 void setWindowMaker();
147 void setAfterStep();
148 int getWindowSize();
149 Atom getDeleteWin();
153 #endif //__xhandler_h__