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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
// wmmixer - A mixer designed for WindowMaker
//
// Release 1.5
// Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
// Copyright (C) 2002 Gordon Fraser <gordon@debian.org>
// This software comes with ABSOLUTELY NO WARRANTY
// This software is free software, and you are welcome to redistribute it
// under certain conditions
// See the COPYING file for details.
#ifndef __xhandler_h__
#define __xhandler_h__
//--------------------------------------------------------------------
// X-Windows includes - standard
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h>
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "common.h"
// Xpm images - standard
#include "XPM/wmmixer.xpm"
#include "XPM/tile.xpm"
// Xpm images - custom
#include "XPM/icons.xpm"
#include "XPM/norec.xpm"
//--------------------------------------------------------------------
#define BTN_LEFT_X 5
#define BTN_LEFT_Y 34
#define BTN_RIGHT_X 17
#define BTN_RIGHT_Y 34
#define BTN_MUTE_X 17
#define BTN_MUTE_Y 47
#define BTN_REC_X 5
#define BTN_REC_Y 47
#define BTN_WIDTH 12
#define BTN_HEIGHT 11
#define BTNNEXT 1
#define BTNPREV 2
#define BTNREC 4
#define BTNMUTE 8
//--------------------------------------------------------------------
class XHandler
{
protected:
int button_state_;
int window_size_;
bool is_wmaker_;
bool is_ushape_;
bool is_astep_;
unsigned *icon_list_;
Display *display_default_;
Window window_icon_;
Window window_main_;
Window window_root_;
GC graphics_context_;
unsigned long colors_[4];
unsigned long shade_colors_[25];
char display_name_[256];
char position_name_[256];
char ledcolor_name_[256];
char ledcolor_high_name_[256];
char backcolor_name_[256];
char window_class_[256];
Pixel back_pix;
Pixel fore_pix;
// Pixmaps - standard
Pixmap pixmap_main;
Pixmap pixmap_tile;
Pixmap pixmap_disp;
Pixmap pixmap_mask;
// Pixmaps - custom
Pixmap pixmap_icon;
Pixmap pixmap_nrec;
// X-Windows basics - standard
Atom _XA_GNUSTEP_WM_FUNC;
Atom deleteWin;
unsigned long getColor(char*);
unsigned long mixColor(char*, int, char*, int);
void drawButton(int, int, int, int, bool);
void initPixmaps(int);
void initWindow(int, char**);
void initGraphicsContext();
void initMask();
void initColors();
void initIcons(int);
int flush_expose(Window);
public:
XHandler();
virtual ~XHandler();
void init(int, char**, int);
void repaint();
void update(unsigned);
void drawLeft(unsigned);
void drawRight(unsigned);
void drawBtns(int, bool);
void drawMono(unsigned);
bool isLeftButton(int, int);
bool isRightButton(int, int);
bool isMuteButton(int, int);
bool isRecButton(int, int);
bool isVolumeBar(int, int);
Display* getDisplay() {return display_default_;}
int getButtonState();
void setButtonState(int);
void setDisplay(char* arg);
void setPosition(char* arg);
void setLedColor(char* arg);
void setLedHighColor(char* arg);
void setBackColor(char* arg);
void setWindowClass(char* arg);
void setUnshaped();
void setWindowMaker();
void setAfterStep();
int getWindowSize();
Atom getDeleteWin();
};
#endif //__xhandler_h__
|