NCBI C++ ToolKit
glcontainer.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: glcontainer.cpp 14565 2007-05-18 12:32:01Z dicuccio $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Peter Meric
27  *
28  * File Description:
29  * CGlContainer - container for OpenGL widgets
30  */
31 
32 #include <ncbi_pch.hpp>
34 
35 
37 
38 
40 {
41 }
42 
43 
45 {
46 }
47 
48 
50 {
51  if (!IsVisible()) {
52  return;
53  }
54 
56  TWidgetRef child = *it;
57  if (!child->IsVisible()) {
58  continue;
59  }
60  child->Draw();
61  }
62 }
63 
64 
66 {
68  TWidgetRef child = *it;
69  child->ProcessEvent(event);
70  }
71 }
72 
73 
74 
76 {
77  m_Children.push_back(TWidgetRef(widget));
78 }
79 
80 
82 {
84  if (widget == it->GetPointer()) {
85  m_Children.erase(it);
86  }
87  }
88 }
89 
90 
92 {
93  m_Children.clear();
94 }
95 
96 
97 size_t CGlContainer::Size(void) const
98 {
99  return m_Children.size();
100 }
101 
102 
104 {
105  return m_Children.begin();
106 }
107 
108 
110 {
111  return m_Children.begin();
112 }
113 
114 
116 {
117  return m_Children.end();
118 }
119 
120 
122 {
123  return m_Children.end();
124 }
125 
126 
CRef –.
Definition: ncbiobj.hpp:618
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
iterator end(void)
virtual bool IsVisible(void) const
Definition: glwidget.cpp:56
TWidgetList m_Children
Definition: glcontainer.hpp:75
virtual void Clear(void)
Definition: glcontainer.cpp:91
virtual void ProcessEvent(CGlEvent &event)
Definition: glcontainer.cpp:65
TWidgetList::iterator iterator
Definition: glcontainer.hpp:66
iterator begin(void)
vector< TWidgetRef > TWidgetList
Definition: glcontainer.hpp:52
virtual void Draw(void)
Definition: glcontainer.cpp:49
virtual void Remove(CGlWidget *widget)
Definition: glcontainer.cpp:81
virtual void Add(CGlWidget *widget)
Definition: glcontainer.cpp:75
CRef< CGlWidget > TWidgetRef
Definition: glcontainer.hpp:51
virtual ~CGlContainer()
Definition: glcontainer.cpp:44
TWidgetList::const_iterator const_iterator
Definition: glcontainer.hpp:67
virtual size_t Size(void) const
Definition: glcontainer.cpp:97
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Sat Jul 20 11:11:26 2024 by modify_doxy.py rev. 669887