From a9fcd6c4c64d653928f3c2dc8ae8414abf31c58f Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 10 Apr 2016 11:01:48 +0300 Subject: [PATCH] widget_state_t: new type. (widget_get_state): new widget API. Signed-off-by: Andrew Borodin --- lib/widget/widget-common.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/widget/widget-common.h b/lib/widget/widget-common.h index 49311fc48..cea146c45 100644 --- a/lib/widget/widget-common.h +++ b/lib/widget/widget-common.h @@ -70,6 +70,12 @@ typedef enum WOP_DISABLED = (1 << 5) /* Widget cannot be selected */ } widget_options_t; +/* Widget state */ +typedef enum +{ + WST_DEFAULT = (0 << 0), +} widget_state_t; + /* Flags for widget repositioning on dialog resize */ typedef enum { @@ -202,4 +208,20 @@ widget_get_options (const Widget * w, widget_options_t options) /* --------------------------------------------------------------------------------------------- */ +/** + * Check whether one or several state flags are set or not. + * @param w widget + * @param state widget state flags + * + * @return TRUE if all requested state flags are set, FALSE otherwise. + */ + +static inline gboolean +widget_get_state (const Widget * w, widget_state_t state) +{ + return ((w->state & state) == state); +} + +/* --------------------------------------------------------------------------------------------- */ + #endif /* MC__WIDGET_INTERNAL_H */