]> Dogcows Code - chaz/openbox/blob - openbox/popup.h
Merge branch 'master' into chaz
[chaz/openbox] / openbox / popup.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 popup.h for the Openbox window manager
4 Copyright (c) 2003-2007 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 __popup_h
20 #define __popup_h
21
22 #include "client.h"
23 #include "window.h"
24 #include "obrender/render.h"
25 #include <glib.h>
26
27 struct _ObClientIcon;
28
29 #define POPUP_WIDTH 320
30 #define POPUP_HEIGHT 48
31
32 typedef struct _ObPopup ObPopup;
33 typedef struct _ObIconPopup ObIconPopup;
34 typedef struct _ObPagerPopup ObPagerPopup;
35
36 struct _ObPopup
37 {
38 ObWindow obwin;
39 Window bg;
40
41 Window text;
42
43 gboolean hasicon;
44 RrAppearance *a_bg;
45 RrAppearance *a_text;
46 gint gravity;
47 gint x;
48 gint y;
49 gint textw;
50 gint h;
51 gint minw;
52 gint maxw;
53 guint iconwm; /* icon width multiplier. multiplied by the normal width */
54 guint iconhm; /* icon height multiplier. multipled by the normal height */
55 gboolean mapped;
56 gboolean delay_mapped;
57 guint delay_timer;
58
59 void (*draw_icon)(gint x, gint y, gint w, gint h, gpointer data);
60 gpointer draw_icon_data;
61
62 ObClient *client;
63 };
64
65 struct _ObIconPopup
66 {
67 ObPopup *popup;
68
69 Window icon;
70 RrAppearance *a_icon;
71 };
72
73 struct _ObPagerPopup
74 {
75 ObPopup *popup;
76
77 guint desks;
78 guint curdesk;
79 Window *wins;
80 RrAppearance *hilight;
81 RrAppearance *unhilight;
82 };
83
84 ObPopup *popup_new(void);
85 void popup_free(ObPopup *self);
86
87 /*! Position the popup. The gravity rules are not the same X uses for windows,
88 instead of the position being the top-left of the window, the gravity
89 specifies which corner of the popup will be placed at the given coords.
90 Static and Forget gravity are equivilent to NorthWest.
91 */
92 void popup_position(ObPopup *self, gint gravity, gint x, gint y);
93 /*! Set the sizes for the popup. When set to 0, the size will be based on
94 the text size. */
95 void popup_height(ObPopup *self, gint w);
96 void popup_min_width(ObPopup *self, gint minw);
97 void popup_max_width(ObPopup *self, gint maxw);
98 void popup_text_width(ObPopup *self, gint w);
99 void popup_text_width_to_string(ObPopup *self, gchar *text);
100 void popup_height_to_string(ObPopup *self, gchar *text);
101 void popup_text_width_to_strings(ObPopup *self, gchar **strings, gint num);
102
103 void popup_set_text_align(ObPopup *self, RrJustify align);
104
105 #define popup_show(s, t) popup_delay_show((s),0,(t))
106 void popup_delay_show(ObPopup *self, gulong msec, gchar *text);
107 void popup_hide(ObPopup *self);
108
109 RrAppearance *popup_icon_appearance(ObPopup *self);
110
111
112 ObIconPopup *icon_popup_new(void);
113 void icon_popup_free(ObIconPopup *self);
114
115 #define icon_popup_show(s, t, i) icon_popup_delay_show((s),0,(t),(i))
116 void icon_popup_delay_show(ObIconPopup *self, gulong msec,
117 gchar *text, RrImage *icon);
118 #define icon_popup_hide(p) popup_hide((p)->popup)
119 #define icon_popup_position(p, g, x, y) popup_position((p)->popup,(g),(x),(y))
120 #define icon_popup_text_width(p, w) popup_text_width((p)->popup,(w))
121 #define icon_popup_height(p, h) popup_height((p)->popup,(h))
122 #define icon_popup_min_width(p, m) popup_min_width((p)->popup,(m))
123 #define icon_popup_max_width(p, m) popup_max_width((p)->popup,(m))
124 #define icon_popup_text_width_to_string(p, s) \
125 popup_text_width_to_string((p)->popup,(s))
126 #define icon_popup_text_width_to_strings(p, s, n) \
127 popup_text_width_to_strings((p)->popup,(s),(n))
128 #define icon_popup_set_text_align(p, j) popup_set_text_align((p)->popup,(j))
129 void icon_popup_icon_size_multiplier(ObIconPopup *self, guint wm, guint hm);
130
131 ObPagerPopup *pager_popup_new(void);
132 void pager_popup_free(ObPagerPopup *self);
133
134 #define pager_popup_show(s, t, d) pager_popup_delay_show((s),0,(t),(d))
135 void pager_popup_delay_show(ObPagerPopup *self, gulong msec,
136 gchar *text, guint desk);
137 #define pager_popup_hide(p) popup_hide((p)->popup)
138 #define pager_popup_position(p, g, x, y) popup_position((p)->popup,(g),(x),(y))
139 #define pager_popup_text_width(p, w) popup_text_width((p)->popup,(w))
140 #define pager_popup_height(p, h) popup_height((p)->popup,(h))
141 #define pager_popup_min_width(p, m) popup_min_width((p)->popup,(m))
142 #define pager_popup_max_width(p, m) popup_max_width((p)->popup,(m))
143 #define pager_popup_text_width_to_string(p, s) \
144 popup_text_width_to_string((p)->popup,(s))
145 #define pager_popup_text_width_to_strings(p, s, n) \
146 popup_text_width_to_strings((p)->popup,(s),(n))
147 #define pager_popup_set_text_align(p, j) popup_set_text_align((p)->popup,(j))
148 void pager_popup_icon_size_multiplier(ObPagerPopup *self, guint wm, guint hm);
149
150 #endif
This page took 0.035397 seconds and 4 git commands to generate.