]> icculus.org git repositories - mikachu/openbox.git/blob - openbox/prompt.h
make the prompt buttons respond to button presses. keyboard input code is there too...
[mikachu/openbox.git] / openbox / prompt.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    prompt.h for the Openbox window manager
4    Copyright (c) 2008        Dana Jansens
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef ob__prompt_h
20 #define ob__prompt_h
21
22 typedef struct _ObPrompt       ObPrompt;
23 typedef struct _ObPromptElement ObPromptElement;
24
25 #include "window.h"
26 #include "geom.h"
27 #include "render/render.h"
28 #include <glib.h>
29 #include <X11/Xlib.h>
30
31 struct _ObPromptElement {
32     gchar *text;
33     Window window;
34
35     gint x, y, width, height;
36     gboolean pressed;
37 };
38
39 struct _ObPrompt
40 {
41     InternalWindow super;
42     gint ref;
43
44     /* keep a copy of this because we re-render things that may need it
45        (i.e. the buttons) */
46     RrAppearance *a_bg;
47
48     gboolean mapped;
49     gint width, height;
50     gint msg_wbound;
51
52     ObPromptElement msg;
53
54     /* one for each answer */
55     ObPromptElement *button;
56     guint n_buttons;
57
58     /* points to the button with the focus */
59     ObPromptElement *focus;
60 };
61
62 void prompt_startup(gboolean reconfig);
63 void prompt_shutdown(gboolean reconfig);
64
65 ObPrompt* prompt_new(const gchar *msg, const gchar *const *answers);
66 void prompt_ref(ObPrompt *self);
67 void prompt_unref(ObPrompt *self);
68
69 /*! Show the prompt.  It will be centered within the given area rectangle */
70 void prompt_show(ObPrompt *self, struct _ObClient *parent);
71 void prompt_hide(ObPrompt *self);
72
73 void prompt_key_event(ObPrompt *self, XEvent *e);
74 void prompt_mouse_event(ObPrompt *self, XEvent *e);
75
76 #endif