NCBI C++ ToolKit
irenderable.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_GL___IRENDERABLE__HPP
2 #define GUI_WIDGETS_GL___IRENDERABLE__HPP
3 
4 /* $Id: irenderable.hpp 35505 2016-05-16 15:18:00Z shkeda $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Vlad Lebedev
30  *
31  * File Description:
32  * IRenderable -- the basic interface for GL panels for GBENCH
33  */
34 
35 
36 #include <gui/opengl/glpane.hpp>
37 
38 #include <corelib/ncbiobj.hpp>
39 #include <corelib/ncbistd.hpp>
40 
41 
43 
44 ///////////////////////////////////////////////////////////////////////////////
45 /// IRenderable
46 /// class IRenderable defines an abstract interface required for rendering
47 /// graphical panels in the given space (see CGlPane).
48 
50 {
51 public:
52  virtual ~IRenderable(void) { }
53 
54  virtual void Render(CGlPane& pane) = 0;
55 
56  // gets / sets the rectangle in OpenGL viewport space associated with
57  // this component
58  virtual TVPRect GetVPRect() const = 0;
59  virtual void SetVPRect(const TVPRect& rc) = 0;
60 
61  // gets / sets the rectangle in OpenGL model space associated with
62  // this component
63  virtual TModelRect GetModelRect() const = 0;
64  virtual void SetModelRect(const TModelRect& rc) = 0;
65 
66  virtual TVPPoint PreferredSize() = 0;
67 
68  virtual bool IsVisible() = 0;
69  virtual void SetVisible(bool set) = 0;
70 
71  virtual bool NeedTooltip(CGlPane& pane, TVPUnit vp_x, TVPUnit vp_y) = 0;
72  virtual string GetTooltip() = 0;
73 
74  virtual void SetOrder(int order) = 0;
75  virtual int GetOrder() const = 0;
76 };
77 
78 
79 ///////////////////////////////////////////////////////////////////////////////
80 /// CRenderableImpl
82 {
83 public:
85  virtual ~CRenderableImpl();
86 
87  /// @name IRenderable implementation
88  /// @{
89  /// implementing some of the IRenderable functions, other need to be
90  /// implemented in derived classes
91  virtual TVPRect GetVPRect() const;
92  virtual void SetVPRect(const TVPRect& rc);
93 
94  virtual TModelRect GetModelRect() const;
95  virtual void SetModelRect(const TModelRect& rc);
96 
97  virtual TVPPoint PreferredSize();
98 
99  virtual bool IsVisible();
100  virtual void SetVisible(bool set);
101 
102  virtual bool NeedTooltip(CGlPane& pane, TVPUnit vp_x, TVPUnit vp_y);
103  virtual string GetTooltip();
104 
105  virtual void SetOrder(int order);
106  virtual int GetOrder() const;
107 
108  /// @}
109 
110 
111 protected:
114  bool m_Visible;
115  int m_Order = 0; // sort helper
116 };
117 
118 inline
120 {
121  m_Order = order;
122 }
123 
124 inline
126 {
127  return m_Order;
128 }
129 
130 
131 
133 
134 #endif // GUI_WIDGETS_GL___IRENDERABLE__HPP
class CGlPane
Definition: glpane.hpp:62
CRenderableImpl.
Definition: irenderable.hpp:82
virtual void SetOrder(int order)
TModelRect m_ModelRect
virtual int GetOrder() const
IRenderable class IRenderable defines an abstract interface required for rendering graphical panels i...
Definition: irenderable.hpp:50
virtual void SetModelRect(const TModelRect &rc)=0
virtual int GetOrder() const =0
virtual void SetVisible(bool set)=0
virtual void SetOrder(int order)=0
virtual void SetVPRect(const TVPRect &rc)=0
virtual ~IRenderable(void)
Definition: irenderable.hpp:52
virtual bool NeedTooltip(CGlPane &pane, TVPUnit vp_x, TVPUnit vp_y)=0
virtual void Render(CGlPane &pane)=0
virtual TModelRect GetModelRect() const =0
virtual TVPPoint PreferredSize()=0
virtual bool IsVisible()=0
virtual TVPRect GetVPRect() const =0
virtual string GetTooltip()=0
Definition: set.hpp:45
Include a standard set of the NCBI C++ Toolkit most basic headers.
int TVPUnit
Definition: gltypes.hpp:47
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIWIDGETS_GL_EXPORT
Definition: gui_export.h:529
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Mon Apr 22 04:02:26 2024 by modify_doxy.py rev. 669887