1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 popup.h for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
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.
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.
16 See the COPYING file for a copy of the GNU General Public License.
23 #include "render/render.h"
28 #define POPUP_WIDTH 320
29 #define POPUP_HEIGHT 48
31 typedef struct _ObPopup ObPopup
;
32 typedef struct _ObIconPopup ObIconPopup
;
33 typedef struct _ObPagerPopup ObPagerPopup
;
52 gboolean delay_mapped
;
54 void (*draw_icon
)(gint x
, gint y
, gint w
, gint h
, gpointer data
);
55 gpointer draw_icon_data
;
73 RrAppearance
*hilight
;
74 RrAppearance
*unhilight
;
77 ObPopup
*popup_new(gboolean hasicon
);
78 void popup_free(ObPopup
*self
);
80 /*! Position the popup. The gravity rules are not the same X uses for windows,
81 instead of the position being the top-left of the window, the gravity
82 specifies which corner of the popup will be placed at the given coords.
83 Static and Forget gravity are equivilent to NorthWest.
85 void popup_position(ObPopup
*self
, gint gravity
, gint x
, gint y
);
86 /*! Set the sizes for the popup. When set to 0, the size will be based on
88 void popup_width(ObPopup
*self
, gint w
);
89 void popup_height(ObPopup
*self
, gint w
);
90 void popup_width_to_string(ObPopup
*self
, gchar
*text
, gint max
);
91 void popup_height_to_string(ObPopup
*self
, gchar
*text
);
92 void popup_width_to_strings(ObPopup
*self
, gchar
**strings
, gint num
,gint max
);
94 void popup_set_text_align(ObPopup
*self
, RrJustify align
);
96 #define popup_show(s, t) popup_delay_show((s),0,(t))
97 void popup_delay_show(ObPopup
*self
, gulong usec
, gchar
*text
);
98 void popup_hide(ObPopup
*self
);
100 RrAppearance
*popup_icon_appearance(ObPopup
*self
);
103 ObIconPopup
*icon_popup_new();
104 void icon_popup_free(ObIconPopup
*self
);
106 #define icon_popup_show(s, t, i) icon_popup_delay_show((s),0,(t),(i))
107 void icon_popup_delay_show(ObIconPopup
*self
, gulong usec
,
108 gchar
*text
, const struct _ObClientIcon
*icon
);
109 #define icon_popup_hide(p) popup_hide((p)->popup)
110 #define icon_popup_position(p, g, x, y) popup_position((p)->popup,(g),(x),(y))
111 #define icon_popup_width(p, w) popup_width((p)->popup,(w))
112 #define icon_popup_height(p, h) popup_height((p)->popup,(h))
113 #define icon_popup_width_to_string(p, s, n, m) \
114 popup_width_to_string((p)->popup,(s),(n),(m))
115 #define icon_popup_width_to_strings(p, s, n, m) \
116 popup_width_to_strings((p)->popup,(s),(n),(m))
117 #define icon_popup_set_text_align(p, j) popup_set_text_align((p)->popup,(j))
119 ObPagerPopup
*pager_popup_new();
120 void pager_popup_free(ObPagerPopup
*self
);
122 #define pager_popup_show(s, t, d) pager_popup_delay_show((s),0,(t),(d))
123 void pager_popup_delay_show(ObPagerPopup
*self
, gulong usec
,
124 gchar
*text
, guint desk
);
125 #define pager_popup_hide(p) popup_hide((p)->popup)
126 #define pager_popup_position(p, g, x, y) popup_position((p)->popup,(g),(x),(y))
127 #define pager_popup_width(p, w) popup_width((p)->popup,(w))
128 #define pager_popup_height(p, h) popup_height((p)->popup,(h))
129 #define pager_popup_width_to_string(p, s, n, m) \
130 popup_width_to_string((p)->popup,(s),(n),(m))
131 #define pager_popup_width_to_strings(p, s, n, m) \
132 popup_width_to_strings((p)->popup,(s),(n),(m))
133 #define pager_popup_set_text_align(p, j) popup_set_text_align((p)->popup,(j))