diff libui/ui/label.h @ 174:6992085d47fd

ui: major theme overhaul, closes #2509 @1h - The font does not contain a color anymore, - Add a new color argument to font_render, - Theme are stored `const` in UI elements to promise no modifications, - Also make all <ui>_draw function to take a const widget too.
author David Demelier <markand@malikania.fr>
date Thu, 22 Oct 2020 15:16:43 +0200
parents 31d7f23c0588
children 49639211d63b
line wrap: on
line diff
--- a/libui/ui/label.h	Wed Oct 21 12:50:11 2020 +0200
+++ b/libui/ui/label.h	Thu Oct 22 15:16:43 2020 +0200
@@ -44,7 +44,7 @@
 	int y;                          /*!< (+) Position in y. */
 	const char *text;               /*!< (+&) Text to show. */
 	enum label_flags flags;         /*!< (+) Optional flags. */
-	struct theme *theme;            /*!< (+&?) Theme to use. */
+	const struct theme *theme;      /*!< (+&?) Theme to use. */
 };
 
 /**
@@ -56,7 +56,16 @@
  * \param label the label
  */
 void
-label_draw_default(struct theme *t, const struct label *label);
+label_draw_default(const struct theme *t, const struct label *label);
+
+/**
+ * Tells if the label is usable.
+ *
+ * \param label the label to check (may be NULL)
+ * \return False if label is null or as empty text.
+ */
+bool
+label_ok(const struct label *label);
 
 /**
  * Update the `w` and `h` fields with the dimensions the text would needs with
@@ -68,7 +77,7 @@
  * \param h the pointer to height (may be NULL)
  */
 void
-label_query(struct label *label, unsigned int *w, unsigned int *h);
+label_query(const struct label *label, unsigned int *w, unsigned int *h);
 
 /**
  * Draw the label.