1 /*
2  * appbar.hh - Header for appbar (application launch toolbar)
3  * Copyright (C) 2001 Frank Hale
4  * frankhale@yahoo.com
5  * http://sapphire.sourceforge.net/
6  *
7  * Updated: 24 July 2001
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  */
23 
24 #ifndef _APPBAR_HH_
25 #define _APPBAR_HH_
26 
27 #include "misc.hh"
28 #include <list>
29 
30 enum { HORIZONTAL, VERTICAL }; // Appbar style
31 enum { NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST }; // Appbar placement
32 
33 class Appbar
34 {
35 private: /* member variables */
36 	Display *dpy;
37 	Window win, root;
38 	Icon *current_icon;
39 
40 	Atom gnome[GNOME_HINT_COUNT], motif;
41 	PropMwmHints mwm_hints;
42 
43 	Atom atom_wm_protos;
44 	Atom atom_wm_delete;
45 	Atom atom_wm_state;
46 	Atom net_wm_state_skip_taskbar;
47 	Atom net_wm_state_skip_pager;
48  	Atom net_wm_strut;
49 	Atom net_wm_state_sticky;
50 
51 	long gnome_win_normal_hints;
52 	long gnome_win_hints_no_on_top;
53 
54 	//XFontStruct *font;
55 	bool hidden, one_click;
56 	Visual *visual;
57 	int screen, depth;
58 	Pixmap win_pix;
59 	GC gc;
60 	BImageControl *image_control;
61 	BColor to, from;
62 
63 	std::list<Icon *> *iconList;
64 
65 	Scanner *appbarConfig;
66 
67 	int window_width, window_height;
68 	int screen_width, screen_height;
69 
70 	int placement;
71 	int screen_placement;
72 
73 	unsigned char temp_color;
74 
75 private: /* member functions */
76 	void set_gnome_hint(Window w, int a, long value);
77 	void set_mwm_hints(Window w, PropMwmHints *hints);
78 	void set_foreground (int index);
79 	void draw_dot (Window win, int x, int y);
80 	void draw3DLine(Window win, int style, int x1, int y1, int x2, int y2);
81 	void draw3DRectRaised(Window win, int x, int y, int h, int w);
82 	void draw3DRectSunken(Window win, int x, int y, int h, int w);
83 
84 	void drawVerticalGrill(Window win, int x, int height);
85 	void drawHoriontalGrill(Window win, int y, int height);
86 
87 	bool imageKeyword(Scanner *s);
88 	bool executeKeyword(Scanner *s);
89 	bool iconKeyword(Scanner *s);
90 	bool horizontalKeyword(Scanner *s);
91 	bool verticalKeyword(Scanner *s);
92 	bool northeastKeyword(Scanner *s);
93 	bool northwestKeyword(Scanner *s);
94 	bool southeastKeyword(Scanner *s);
95 	bool southwestKeyword(Scanner *s);
96 	bool oneclickKeyword(Scanner *s);
97 	bool rgbKeywords(Scanner *s);
98 	bool fromKeyword(Scanner *s);
99 	bool toKeyword(Scanner *s);
100 	void parseAppbarConfig(Scanner* s);
101 
102 	void appbarScreenPlacement();
103 
104 	void horizontalBarIconPlacement();
105 	void verticalBarIconPlacement();
106 
107 	void drawHorizontalBarGrill();
108 	void drawVerticalBarGrill();
109 
110 	Icon* findIconWindow(Window win);
111 
112 	void doEventLoop();
113 
114 	void turnOffStrut();
115 	void setLeftStrut();
116 	void setRightStrut();
117 	void setTopStrut();
118 	void setBottomStrut();
119 
120 public: /* member functions */
121 	Appbar(char* filename);
122 	~Appbar();
123 
124 	void quit();
125 };
126 
127 extern Appbar *ab;
128 
129 #endif
130