OpenWalnut
1.5.0dev
src
core
graphicsEngine
widgets
WOSGButtonLabel.h
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#ifndef WOSGBUTTONLABEL_H
26
#define WOSGBUTTONLABEL_H
27
28
#include <osgWidget/Label>
29
#include <osgWidget/Util>
30
#include <osgWidget/WindowManager>
31
32
/**
33
* implements mouse interaction for a osgWidget label
34
*/
35
class
WOSGButtonLabel
:
public
osgWidget::Label
36
{
37
public
:
38
/**
39
* constructor
40
* \param pushable denotes if the button is pushable, i.e. keeps a pushed state or not
41
*/
42
explicit
WOSGButtonLabel
(
bool
pushable );
43
44
/**
45
* destructor
46
*/
47
~WOSGButtonLabel
();
48
49
/**
50
* function handles mouse click on label, the function was copied from an osg example, as everything in
51
* the osg it wasn't documented, so it's not entirely sure what the params are for and what they do
52
*
53
* \return bool
54
*/
55
virtual
bool
mousePush
(
double
,
double
,
const
osgWidget::WindowManager* );
56
57
/**
58
* getter for clicked flag, resets the flag to false
59
*
60
* \return true if the label has been clicked
61
*/
62
bool
clicked
();
63
64
/**
65
* getter for pushed flag
66
*
67
* \return true if the button is pushed
68
*/
69
bool
pushed
();
70
71
/**
72
* setter
73
* \param pushed if true the button is pushed
74
*/
75
void
setPushed
(
bool
pushed
);
76
77
protected
:
78
private
:
79
bool
m_clicked
;
//!< if true the label has been clicked since it was last checked for
80
81
bool
m_pushable
;
//!< button is pushable or not
82
83
bool
m_pushed
;
//!< true if button is pushable and was clicked
84
};
85
86
inline
bool
WOSGButtonLabel::clicked
()
87
{
88
bool
tmp =
m_clicked
;
89
m_clicked
=
false
;
90
return
tmp;
91
}
92
93
inline
bool
WOSGButtonLabel::pushed
()
94
{
95
return
m_pushed
;
96
}
97
98
inline
void
WOSGButtonLabel::setPushed
(
bool
pushed )
99
{
100
m_pushed
=
pushed
;
101
}
102
103
#endif
// WOSGBUTTONLABEL_H
WOSGButtonLabel
implements mouse interaction for a osgWidget label
Definition:
WOSGButtonLabel.h:36
WOSGButtonLabel::setPushed
void setPushed(bool pushed)
setter
Definition:
WOSGButtonLabel.h:98
WOSGButtonLabel::mousePush
virtual bool mousePush(double, double, const osgWidget::WindowManager *)
function handles mouse click on label, the function was copied from an osg example,...
Definition:
WOSGButtonLabel.cpp:45
WOSGButtonLabel::m_pushed
bool m_pushed
true if button is pushable and was clicked
Definition:
WOSGButtonLabel.h:83
WOSGButtonLabel::clicked
bool clicked()
getter for clicked flag, resets the flag to false
Definition:
WOSGButtonLabel.h:86
WOSGButtonLabel::pushed
bool pushed()
getter for pushed flag
Definition:
WOSGButtonLabel.h:93
WOSGButtonLabel::WOSGButtonLabel
WOSGButtonLabel(bool pushable)
constructor
Definition:
WOSGButtonLabel.cpp:27
WOSGButtonLabel::m_pushable
bool m_pushable
button is pushable or not
Definition:
WOSGButtonLabel.h:81
WOSGButtonLabel::~WOSGButtonLabel
~WOSGButtonLabel()
destructor
Definition:
WOSGButtonLabel.cpp:41
WOSGButtonLabel::m_clicked
bool m_clicked
if true the label has been clicked since it was last checked for
Definition:
WOSGButtonLabel.h:79
Generated by
1.9.1