- self->h = texth + ob_rr_theme->paddingy * 2;
- iconw = (self->hasicon ? texth : 0);
- self->w = textw + iconw + ob_rr_theme->paddingx * (self->hasicon ? 3 : 2);
+ /* don't let the height be smaller than the text */
+ texth = RrMinHeight(self->a_text) + ob_rr_theme->paddingy * 2;
+ self->h = MAX(h, texth);
+}
+
+void popup_text_width_to_string(ObPopup *self, gchar *text)
+{
+ if (text[0] != '\0') {
+ self->a_text->texture[0].data.text.string = text;
+ self->textw = RrMinWidth(self->a_text);
+ } else
+ self->textw = 0;
+}
+
+void popup_height_to_string(ObPopup *self, gchar *text)
+{
+ self->h = RrMinHeight(self->a_text) + ob_rr_theme->paddingy * 2;
+}
+
+void popup_text_width_to_strings(ObPopup *self, gchar **strings, gint num)
+{
+ gint i, maxw;
+
+ maxw = 0;
+ for (i = 0; i < num; ++i) {
+ popup_text_width_to_string(self, strings[i]);
+ maxw = MAX(maxw, self->textw);
+ }
+ self->textw = maxw;