[gimp] app: add gimp_item_is_visible()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_item_is_visible()
- Date: Fri, 23 Sep 2011 21:44:36 +0000 (UTC)
commit d995fefb7c729fd0c3eb995f665b16825e13bf8a
Author: Michael Natterer <mitch gimp org>
Date: Fri Sep 23 23:43:42 2011 +0200
app: add gimp_item_is_visible()
which returns TRUE if an item is effectively visible (it is visible
and all its parents are visible).
app/core/gimpitem.c | 18 ++++++++++++++++++
app/core/gimpitem.h | 1 +
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 92e5dbe..a7a142d 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -1963,6 +1963,24 @@ gimp_item_get_visible (const GimpItem *item)
return GET_PRIVATE (item)->visible;
}
+gboolean
+gimp_item_is_visible (const GimpItem *item)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+
+ if (gimp_item_get_visible (item))
+ {
+ GimpItem *parent = gimp_item_get_parent (item);
+
+ if (parent)
+ return gimp_item_is_visible (parent);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void
gimp_item_set_linked (GimpItem *item,
gboolean linked,
diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h
index 7764b57..cc6f01b 100644
--- a/app/core/gimpitem.h
+++ b/app/core/gimpitem.h
@@ -291,6 +291,7 @@ void gimp_item_set_visible (GimpItem *item,
gboolean visible,
gboolean push_undo);
gboolean gimp_item_get_visible (const GimpItem *item);
+gboolean gimp_item_is_visible (const GimpItem *item);
void gimp_item_set_linked (GimpItem *item,
gboolean linked,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]