Advertisement
Vultraz

Untitled

Sep 20th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. struct stacked_widget_implementation
  2. {
  3.     template<typename W>
  4.     static widget* find(utils::const_clone_ref<stacked_widget, W> stack,
  5.             const std::string& id,
  6.             const bool must_be_active)
  7.     {
  8.         // Use base method if find-in-all-layer isn't set.
  9.         if(!stack.find_in_all_layers_) {
  10.             return stack.container_base::find(id, must_be_active);
  11.         }
  12.  
  13.         widget* res = nullptr;
  14.  
  15.         for(unsigned i = 0; i < stack.get_layer_count(); ++i) {
  16.             res = stack.get_layer_grid(i)->find(id, must_be_active);
  17.  
  18.             if(res) {
  19.                 break;
  20.             }
  21.         }
  22.  
  23.         if(!res) {
  24.             res = stack.container_base::find(id, must_be_active);
  25.         }
  26.  
  27.         return res;
  28.     }
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement