wmcalc: Null-termitate display string when clearing.
[dockapps.git] / cputnik / src / docklib.h
blob69613e798ef6ec850cbbda4e03042a6a9dd3031d
2 /*
3 * DOCKLIB - a simple dockapp library
5 * Copyright (C) 2000-2005 some people...
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <stdbool.h>
25 #include <ctype.h>
26 #include <stdarg.h>
27 #include <string.h>
28 #include <unistd.h>
29 #include <limits.h>
30 #include <time.h>
32 #include <sys/stat.h>
33 #include <sys/wait.h>
34 #include <sys/stat.h>
35 #include <sys/types.h>
37 #include <X11/Xlib.h>
38 #include <X11/xpm.h>
39 #include <X11/extensions/shape.h>
41 extern Display *display;
43 /* prefs file mode */
44 #define P_READ 1
45 #define P_WRITE 2
47 #define MAX_LINE_LEN 512
48 #define MAX_VALUE_LEN 256
50 #define MAX_STRING_LEN 32
52 /* mouse buttons */
53 #define LMB 1
54 #define MMB 2
55 #define RMB 3
57 #define MAX_MOUSE_REGION 8
59 #define FONT_SMALL 1
60 #define FONT_NORMAL 2
61 #define FONT_LARGE 3
63 /*-------------------------------------------------------------------------------*/
65 typedef struct {
66 int enable;
67 int top;
68 int bottom;
69 int left;
70 int right;
71 } MOUSE_REGION;
74 typedef struct {
75 Pixmap pixmap;
76 Pixmap mask;
77 XpmAttributes attributes;
78 } XpmIcon;
80 #define NUM_COLORS 10
82 enum { /* don't change the order! */
83 GRAY = 0,
84 YELLOW,
85 GREEN,
86 CYAN,
87 SKYBLUE,
88 ORANGE,
89 RED,
90 MAGENTA,
91 BROWN,
92 WHITE
93 } led_colors;
95 enum {
96 F_NOT_AVAILABLE = 0,
97 F_REGULAR,
98 F_DIRECTORY,
99 F_CHAR_DEVICE,
100 F_BLOCK_DEVICE,
101 F_LINK,
102 F_FIFO,
103 F_SOCK
104 } file_types;
106 /*-------------------------------------------------------------------------------*/
108 void dcl_open_x_window (int argc, char *argv[], char **, char *, int, int);
109 void dcl_redraw_window (void);
110 void dcl_redraw_window_xy (int x, int y);
111 void dcl_copy_xpm_area (int x, int y, int sx, int sy, int dx, int dy);
112 void dcl_copy_font_xpm_area (int x, int y, int sx, int sy, int dx, int dy);
113 void dcl_copy_led_xpm_area (int x, int y, int sx, int sy, int dx, int dy);
114 void dcl_copy_xbm_area (int x, int y, int sx, int sy, int dx, int dy);
115 void dcl_set_mask_xy (int x, int y);
116 void dcl_get_xpm (XpmIcon *wmgen, char **pixmap_bytes);
117 Pixel dcl_get_color (char *name);
118 int dcl_draw_char (int x, int y, char z, int font_type);
119 int dcl_draw_led (int x, int y, int color);
120 int dcl_draw_string (int x, int y, char *string, int font_type, int length);
121 void dcl_add_mouse_region (int index, int left, int top, int right, int bottom);
122 int dcl_check_mouse_region (int x, int y);
123 char* dcl_getfilename_config (char *config_dir, char *config_filename);
124 void* dcl_prefs_openfile (char *filename, int openmode);
125 void dcl_prefs_closefile (void);
126 void dcl_prefs_put_int (char *tagname, int value);
127 void dcl_prefs_put_float (char *tagname, float value);
128 void dcl_prefs_put_string (char *tagname, char *value);
129 void dcl_prefs_put_lf (void);
130 void dcl_prefs_put_comment (char *comment);
131 int dcl_prefs_get_int (char *tagname);
132 float dcl_prefs_get_float (char *tagname);
133 char* dcl_prefs_get_string (char *tagname);
134 char* dcl_strcpy (char *dest, const char *src, int maxlength);
135 char* dcl_strcat (char *dest, const char *src, int maxlength);
136 void dcl_execute_command (char *command, int flag);
137 int dcl_check_file (char *filename);
138 void dcl_draw_point (int x, int y, Pixel color);
139 void dcl_draw_line (int x0, int y0, int x1, int y1, Pixel color);
143 * Created: Sat 26 Mar 2005 05:46:11 PM CET
144 * Last Modified: Sat 26 Mar 2005 10:53:50 PM CET