ROOT
6.16/01
Reference Guide
graf3d
gl
inc
TGLWidget.h
Go to the documentation of this file.
1
// @(#)root/gl:$Id$
2
// Author: Timur Pocheptsov, Jun 2007
3
4
/*************************************************************************
5
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
#ifndef ROOT_TGLWidget
13
#define ROOT_TGLWidget
14
15
#include <utility>
16
#include <memory>
17
#include <set>
18
19
#include "
TGLContext.h
"
20
#include "
TVirtualGL.h
"
21
#include "
TGLFormat.h
"
22
#include "
TGFrame.h
"
23
24
class
TGLWidget
;
25
class
TGEventHandler
;
26
27
class
TGLWidget
:
public
TGFrame
,
public
TGLPaintDevice
28
{
29
friend
class
TGLContext
;
30
31
private
:
32
TGLContext
*
fGLContext
;
33
//fInnerData is for X11 - <dpy, visualInfo> pair.
34
std::pair<void *, void *>
fInnerData
;
35
Int_t
fWindowIndex
;
36
37
TGLFormat
fGLFormat
;
38
//fFromCtor checks that SetFormat was called only from ctor.
39
Bool_t
fFromInit
;
40
41
std::set<TGLContext *>
fValidContexts
;
42
43
TGEventHandler
*
fEventHandler
;
44
45
public
:
46
static
TGLWidget
*
CreateDummy
();
47
48
static
TGLWidget
*
Create
(
const
TGWindow
* parent,
Bool_t
selectInput,
49
Bool_t
shareDefault,
const
TGLPaintDevice
*shareDevice,
50
UInt_t
width
,
UInt_t
height);
51
52
static
TGLWidget
*
Create
(
const
TGLFormat
&format,
53
const
TGWindow
* parent,
Bool_t
selectInput,
54
Bool_t
shareDefault,
const
TGLPaintDevice
*shareDevice,
55
UInt_t
width
,
UInt_t
height);
56
57
~TGLWidget
();
58
59
virtual
void
InitGL
();
60
virtual
void
PaintGL
();
61
62
Bool_t
MakeCurrent
();
63
Bool_t
ClearCurrent
();
64
void
SwapBuffers
();
65
const
TGLContext
*
GetContext
()
const
;
66
67
const
TGLFormat
*
GetPixelFormat
()
const
;
68
69
//This function is public _ONLY_ for calls
70
//via gInterpreter. Do not call it directly.
71
void
SetFormat
();
72
//To repaint gl-widget without GUI events.
73
void
ExtractViewport
(
Int_t
*vp)
const
;
74
75
TGEventHandler
*
GetEventHandler
()
const
{
return
fEventHandler
; }
76
void
SetEventHandler
(
TGEventHandler
*eh);
77
78
Bool_t
HandleButton
(
Event_t
*ev);
79
Bool_t
HandleDoubleClick
(
Event_t
*ev);
80
Bool_t
HandleConfigureNotify
(
Event_t
*ev);
81
Bool_t
HandleKey
(
Event_t
*ev);
82
Bool_t
HandleMotion
(
Event_t
*ev);
83
Bool_t
HandleFocusChange
(
Event_t
*);
84
Bool_t
HandleCrossing
(
Event_t
*);
85
86
void
DoRedraw
();
87
88
private
:
89
TGLWidget
(
const
TGLWidget
&);
// Not implemented.
90
TGLWidget
&
operator =
(
const
TGLWidget
&);
// Not implemented.
91
92
protected
:
93
TGLWidget
(
Window_t
glw,
const
TGWindow
* parent,
Bool_t
selectInput);
94
95
static
Window_t
CreateWindow
(
const
TGWindow
* parent,
const
TGLFormat
&format,
96
UInt_t
width
,
UInt_t
height,
97
std::pair<void *, void *>& innerData);
98
99
void
AddContext
(
TGLContext
*ctx);
100
void
RemoveContext
(
TGLContext
*ctx);
101
102
std::pair<void *, void *>
GetInnerData
()
const
;
103
104
ClassDef
(
TGLWidget
, 0);
//Window (widget) version of TGLPaintDevice
105
};
106
107
#endif
Window_t
Handle_t Window_t
Definition:
GuiTypes.h:28
Int_t
int Int_t
Definition:
RtypesCore.h:41
UInt_t
unsigned int UInt_t
Definition:
RtypesCore.h:42
Bool_t
bool Bool_t
Definition:
RtypesCore.h:59
ClassDef
#define ClassDef(name, id)
Definition:
Rtypes.h:324
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition:
TDocParser.cxx:121
TGFrame.h
TGLContext.h
TGLFormat.h
TVirtualGL.h
TGEventHandler
Definition:
TGEventHandler.h:27
TGFrame
Definition:
TGFrame.h:127
TGLContext
This class encapsulates window-system specific information about a GL-context and alows their proper ...
Definition:
TGLContext.h:31
TGLFormat
Encapsulation of format / contents of an OpenGL buffer.
Definition:
TGLFormat.h:36
TGLPaintDevice
Definition:
TVirtualGL.h:144
TGLWidget
GL window with context.
Definition:
TGLWidget.h:28
TGLWidget::fFromInit
Bool_t fFromInit
Definition:
TGLWidget.h:39
TGLWidget::MakeCurrent
Bool_t MakeCurrent()
Make the gl-context current.
Definition:
TGLWidget.cxx:201
TGLWidget::GetContext
const TGLContext * GetContext() const
Get gl context.
Definition:
TGLWidget.cxx:225
TGLWidget::HandleDoubleClick
Bool_t HandleDoubleClick(Event_t *ev)
Delegate call to the owner.
Definition:
TGLWidget.cxx:603
TGLWidget::Create
static TGLWidget * Create(const TGWindow *parent, Bool_t selectInput, Bool_t shareDefault, const TGLPaintDevice *shareDevice, UInt_t width, UInt_t height)
Static constructor for creating widget with default pixel format.
Definition:
TGLWidget.cxx:83
TGLWidget::HandleKey
Bool_t HandleKey(Event_t *ev)
Delegate call to the owner.
Definition:
TGLWidget.cxx:654
TGLWidget::AddContext
void AddContext(TGLContext *ctx)
Register gl-context created for this window.
Definition:
TGLWidget.cxx:249
TGLWidget::fEventHandler
TGEventHandler * fEventHandler
Definition:
TGLWidget.h:43
TGLWidget::InitGL
virtual void InitGL()
Call glEnable(... in overrider of InitGL.
Definition:
TGLWidget.cxx:187
TGLWidget::fValidContexts
std::set< TGLContext * > fValidContexts
Definition:
TGLWidget.h:41
TGLWidget::fGLFormat
TGLFormat fGLFormat
Definition:
TGLWidget.h:37
TGLWidget::HandleConfigureNotify
Bool_t HandleConfigureNotify(Event_t *ev)
Delegate call to the owner.
Definition:
TGLWidget.cxx:619
TGLWidget::CreateDummy
static TGLWidget * CreateDummy()
Static constructor for creating widget with default pixel format.
Definition:
TGLWidget.cxx:73
TGLWidget::RemoveContext
void RemoveContext(TGLContext *ctx)
Remove context (no real deletion, done by TGLContex dtor).
Definition:
TGLWidget.cxx:257
TGLWidget::HandleButton
Bool_t HandleButton(Event_t *ev)
Delegate call to the owner.
Definition:
TGLWidget.cxx:587
TGLWidget::PaintGL
virtual void PaintGL()
Do actual drawing in overrider of PaintGL.
Definition:
TGLWidget.cxx:194
TGLWidget::GetEventHandler
TGEventHandler * GetEventHandler() const
Definition:
TGLWidget.h:75
TGLWidget::HandleFocusChange
Bool_t HandleFocusChange(Event_t *)
Delegate call to the owner.
Definition:
TGLWidget.cxx:638
TGLWidget::~TGLWidget
~TGLWidget()
Destructor. Deletes window ???? and XVisualInfo.
Definition:
TGLWidget.cxx:162
TGLWidget::operator=
TGLWidget & operator=(const TGLWidget &)
TGLWidget::CreateWindow
static Window_t CreateWindow(const TGWindow *parent, const TGLFormat &format, UInt_t width, UInt_t height, std::pair< void *, void * > &innerData)
CreateWidget - X11 version.
Definition:
TGLWidget.cxx:499
TGLWidget::SwapBuffers
void SwapBuffers()
Swap buffers.
Definition:
TGLWidget.cxx:217
TGLWidget::SetFormat
void SetFormat()
Set pixel format.
Definition:
TGLWidget.cxx:542
TGLWidget::GetInnerData
std::pair< void *, void * > GetInnerData() const
Dpy*, XVisualInfo *.
Definition:
TGLWidget.cxx:241
TGLWidget::fInnerData
std::pair< void *, void * > fInnerData
Definition:
TGLWidget.h:34
TGLWidget::HandleMotion
Bool_t HandleMotion(Event_t *ev)
Delegate call to the owner.
Definition:
TGLWidget.cxx:670
TGLWidget::ClearCurrent
Bool_t ClearCurrent()
Clear the current gl-context.
Definition:
TGLWidget.cxx:209
TGLWidget::ExtractViewport
void ExtractViewport(Int_t *vp) const
For camera.
Definition:
TGLWidget.cxx:267
TGLWidget::TGLWidget
TGLWidget(const TGLWidget &)
TGLWidget::SetEventHandler
void SetEventHandler(TGEventHandler *eh)
Set event-handler. All events are passed to this object.
Definition:
TGLWidget.cxx:558
TGLWidget::DoRedraw
void DoRedraw()
Delegate call to the owner.
Definition:
TGLWidget.cxx:686
TGLWidget::GetPixelFormat
const TGLFormat * GetPixelFormat() const
Pixel format.
Definition:
TGLWidget.cxx:233
TGLWidget::fGLContext
TGLContext * fGLContext
Definition:
TGLWidget.h:32
TGLWidget::fWindowIndex
Int_t fWindowIndex
Definition:
TGLWidget.h:35
TGLWidget::HandleCrossing
Bool_t HandleCrossing(Event_t *)
Handle mouse crossing event.
Definition:
TGLWidget.cxx:566
TGWindow
Definition:
TGWindow.h:32
Event_t
Definition:
GuiTypes.h:173