- TreeItemUnlocker(HTREEITEM item) { gs_unlockItem = item; }
- ~TreeItemUnlocker() { gs_unlockItem = NULL; }
+ // unlock a single item
+ TreeItemUnlocker(HTREEITEM item) { ms_unlockedItem = item; }
+
+ // unlock all items, don't use unless absolutely necessary
+ TreeItemUnlocker() { ms_unlockedItem = (HTREEITEM)-1; }
+
+ // lock everything back
+ ~TreeItemUnlocker() { ms_unlockedItem = NULL; }
+
+
+ // check if the item state is currently locked
+ static bool IsLocked(HTREEITEM item)
+ { return ms_unlockedItem != (HTREEITEM)-1 && item != ms_unlockedItem; }
+
+private:
+ static HTREEITEM ms_unlockedItem;