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

Go to the SVN repository for this file.

1 /* $Id: cn3d_glcanvas.hpp 59440 2013-08-26 16:48:09Z thiessen $
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: Paul Thiessen
27 *
28 * File Description:
29 * OpenGL canvas object
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_GLCANVAS__HPP
35 #define CN3D_GLCANVAS__HPP
36 
37 #include <corelib/ncbistd.hpp>
38 
39 #ifdef __WXMSW__
40 #include <windows.h>
41 #include <wx/msw/winundef.h>
42 #endif
43 #include <wx/wx.h>
44 #include <wx/glcanvas.h>
45 
46 
47 BEGIN_SCOPE(Cn3D)
48 
49 class StructureSet;
50 class OpenGLRenderer;
51 
52 class Cn3DGLCanvas: public wxGLCanvas
53 {
54 public:
55  Cn3DGLCanvas(wxWindow *parent, int *attribList);
56  ~Cn3DGLCanvas(void);
57 
60 
61  void SetCurrent(void);
62 
63  // font stuff - setup from registry, and measure using currently selected font
64  void SetGLFontFromRegistry(double fontScale = 1.0);
65  bool MeasureText(const std::string& text, int *width, int *height, int *centerX, int *centerY);
66  const wxFont& GetGLFont(void) const { return font; }
67 
68  void SuspendRendering(bool suspend);
69  void FakeOnSize(void);
70 
71 private:
72  void OnPaint(wxPaintEvent& event);
73  void OnSize(wxSizeEvent& event);
74  void OnEraseBackground(wxEraseEvent& event);
75  void OnMouseEvent(wxMouseEvent& event);
76 
77  wxGLContext* glContext;
78 
79  // memoryDC is used for measuring text
80  wxMemoryDC memoryDC;
81  wxBitmap memoryBitmap;
82  wxFont font;
83  bool suspended;
84 
85  DECLARE_EVENT_TABLE()
86 };
87 
88 END_SCOPE(Cn3D)
89 
90 #endif // CN3D_GLCANVAS__HPP
void OnEraseBackground(wxEraseEvent &event)
OpenGLRenderer * renderer
Cn3DGLCanvas(wxWindow *parent, int *attribList)
void OnPaint(wxPaintEvent &event)
void FakeOnSize(void)
void SetGLFontFromRegistry(double fontScale=1.0)
wxBitmap memoryBitmap
wxMemoryDC memoryDC
void SuspendRendering(bool suspend)
void OnSize(wxSizeEvent &event)
void OnMouseEvent(wxMouseEvent &event)
wxGLContext * glContext
void SetCurrent(void)
const wxFont & GetGLFont(void) const
StructureSet * structureSet
bool MeasureText(const std::string &text, int *width, int *height, int *centerX, int *centerY)
Include a standard set of the NCBI C++ Toolkit most basic headers.
string
Definition: cgiapp.hpp:687
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static void text(MDB_val *v)
Definition: mdb_dump.c:62
Modified on Sat May 25 14:17:16 2024 by modify_doxy.py rev. 669887