0 #if !defined(BUTTON_H)
1 #define BUTTON_H
2
3 /*
4 * Copyright 2006 Johan Veenhuizen
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25 #include <X11/Xlib.h>
26
27 #include "lib.h"
28 #include "widget.h"
29
30 struct window;
31
32 struct button { struct widget widget;
33 struct window *window;
34 struct color *fg;
35 struct color *bg;
36 Pixmap pixmap;
37 GC gc;
38 IMAGE *image;
39 int acting;
40 int depressed;
41 int hover;
42 void (*handler)(struct window *);
43 };
44
45 struct button *create_button(struct window *, int, int, int, int);
46 void destroy_button(struct button *);
47 void move_button(struct button *, int, int);
48 void repaint_button(struct button *);
49 void set_button_handler(struct button *, void (*)(struct window *));
50 void set_button_image(struct button *, IMAGE *);
51
52 #endif /* !defined(BUTTON_H) */
53