]> Dogcows Code - chaz/openbox/blob - openbox/prompt.h
make the text area in alttab list mode the same hight as the icon _with hilite_
[chaz/openbox] / 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 #include "window.h"
23 #include "geom.h"
24 #include "render/render.h"
25 #include <glib.h>
26 #include <X11/Xlib.h>
27
28 typedef struct _ObPrompt ObPrompt;
29 typedef struct _ObPromptElement ObPromptElement;
30 typedef struct _ObPromptAnswer ObPromptAnswer;
31
32 typedef void (*ObPromptCallback)(ObPrompt *p, gint result, gpointer data);
33
34 struct _ObPromptElement {
35 gchar *text;
36 Window window;
37
38 gint x, y, width, height;
39 gboolean pressed;
40 gint result;
41 };
42
43 struct _ObPrompt
44 {
45 ObInternalWindow super;
46 gint ref;
47
48 guint event_mask;
49
50 /* keep a copy of this because we re-render things that may need it
51 (i.e. the buttons) */
52 RrAppearance *a_bg;
53
54 gboolean mapped;
55 gint width, height;
56 gint msg_wbound;
57
58 ObPromptElement msg;
59
60 /* one for each answer */
61 ObPromptElement *button;
62 gint n_buttons;
63
64 /* points to the button with the focus */
65 ObPromptElement *focus;
66 /* the default button to have selected */
67 gint default_result;
68 /* the cancel result if the dialog is closed */
69 gint cancel_result;
70
71 ObPromptCallback func;
72 gpointer data;
73 };
74
75 struct _ObPromptAnswer {
76 const gchar *text;
77 gint result;
78 };
79
80 void prompt_startup(gboolean reconfig);
81 void prompt_shutdown(gboolean reconfig);
82
83 /*! Create a new prompt
84 @param answers A number of ObPromptAnswers which define the buttons which
85 will appear in the dialog from left to right, and the result
86 returned when they are selected.
87 @param n_answers The number of answers
88 @param default_result The result for the answer button selected by default
89 @param cancel_result The result that is given if the dialog is closed instead
90 of having a button presssed
91 @param func The callback function which is called when the dialog is closed
92 or a button is pressed
93 @param data User defined data which will be passed to the callback
94 */
95 ObPrompt* prompt_new(const gchar *msg,
96 const ObPromptAnswer *answers, gint n_answers,
97 gint default_result, gint cancel_result,
98 ObPromptCallback func, gpointer data);
99 void prompt_ref(ObPrompt *self);
100 void prompt_unref(ObPrompt *self);
101
102 /*! Show the prompt. It will be centered within the given area rectangle */
103 void prompt_show(ObPrompt *self, struct _ObClient *parent);
104 void prompt_hide(ObPrompt *self);
105
106 gboolean prompt_key_event(ObPrompt *self, XEvent *e);
107 gboolean prompt_mouse_event(ObPrompt *self, XEvent *e);
108 void prompt_cancel(ObPrompt *self);
109
110 #endif
This page took 0.037713 seconds and 4 git commands to generate.