Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
185ce33c
Commit
185ce33c
authored
Dec 27, 2005
by
Will Schroeder
Browse files
ENH:Reworked API for requesting focus and cursor
parent
58221126
Changes
2
Hide whitespace changes
Inline
Side-by-side
Common/vtkObject.cxx
View file @
185ce33c
...
...
@@ -19,7 +19,7 @@
#include
"vtkGarbageCollector.h"
#include
"vtkTimeStamp.h"
vtkCxxRevisionMacro
(
vtkObject
,
"1.9
4
"
);
vtkCxxRevisionMacro
(
vtkObject
,
"1.9
5
"
);
// Initialize static member that controls warning display
static
int
vtkObjectGlobalWarningDisplay
=
1
;
...
...
@@ -93,7 +93,7 @@ void vtkObserver::PrintSelf(ostream& os, vtkIndent indent)
class
vtkSubjectHelper
{
public:
vtkSubjectHelper
()
:
ListModified
(
0
),
Focus
(
0
),
Start
(
0
),
Count
(
1
)
{}
vtkSubjectHelper
()
:
ListModified
(
0
),
Focus
1
(
0
),
Focus2
(
0
),
Start
(
0
),
Count
(
1
)
{}
~
vtkSubjectHelper
();
unsigned
long
AddObserver
(
unsigned
long
event
,
vtkCommand
*
cmd
,
float
p
);
...
...
@@ -105,12 +105,15 @@ public:
unsigned
long
GetTag
(
vtkCommand
*
);
int
HasObserver
(
unsigned
long
event
);
int
HasObserver
(
unsigned
long
event
,
vtkCommand
*
cmd
);
void
GrabFocus
(
vtkCommand
*
c
)
{
this
->
Focus
=
c
;}
void
ReleaseFocus
()
{
this
->
Focus
=
NULL
;}
void
GrabFocus
(
vtkCommand
*
c
1
,
vtkCommand
*
c2
)
{
this
->
Focus
1
=
c
1
;
this
->
Focus2
=
c2
;}
void
ReleaseFocus
()
{
this
->
Focus
1
=
NULL
;
this
->
Focus2
=
NULL
;}
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
int
ListModified
;
vtkCommand
*
Focus
;
// This is to support the GrabFocus() methods found in vtkInteractorObserver.
vtkCommand
*
Focus1
;
vtkCommand
*
Focus2
;
protected:
vtkObserver
*
Start
;
...
...
@@ -243,7 +246,8 @@ vtkSubjectHelper::~vtkSubjectHelper()
elem
=
next
;
}
this
->
Start
=
NULL
;
this
->
Focus
=
NULL
;
this
->
Focus1
=
NULL
;
this
->
Focus2
=
NULL
;
}
...
...
@@ -461,7 +465,8 @@ int vtkSubjectHelper::InvokeEvent(unsigned long event, void *callData,
next
=
elem
->
Next
;
if
(
!
elem
->
Visited
&&
(
elem
->
Event
==
event
||
elem
->
Event
==
vtkCommand
::
AnyEvent
)
&&
(
!
this
->
Focus
||
this
->
Focus
==
elem
->
Command
)
)
(
!
this
->
Focus1
||
this
->
Focus1
==
elem
->
Command
)
&&
(
!
this
->
Focus2
||
this
->
Focus2
==
elem
->
Command
)
)
{
elem
->
Visited
=
1
;
vtkCommand
*
command
=
elem
->
Command
;
...
...
@@ -666,16 +671,16 @@ int vtkObject::HasObserver(const char *event, vtkCommand *cmd)
}
//----------------------------------------------------------------------------
void
vtkObject
::
GrabFocus
(
vtkCommand
*
c
)
void
vtkObject
::
Internal
GrabFocus
(
vtkCommand
*
mouseEvents
,
vtkCommand
*
keypressEvents
)
{
if
(
this
->
SubjectHelper
)
{
this
->
SubjectHelper
->
GrabFocus
(
c
);
this
->
SubjectHelper
->
GrabFocus
(
mouseEvents
,
keypressEvents
);
}
}
//----------------------------------------------------------------------------
void
vtkObject
::
ReleaseFocus
()
void
vtkObject
::
Internal
ReleaseFocus
()
{
if
(
this
->
SubjectHelper
)
{
...
...
Common/vtkObject.h
View file @
185ce33c
...
...
@@ -160,15 +160,6 @@ public:
int
InvokeEvent
(
unsigned
long
event
)
{
return
this
->
InvokeEvent
(
event
,
NULL
);
};
int
InvokeEvent
(
const
char
*
event
)
{
return
this
->
InvokeEvent
(
event
,
NULL
);
};
// Description:
// These methods allow a particular command to exclusively grab
// all events. (This method is typically used by widgets to grab
// events once an event sequence begins.)
//BTX
void
GrabFocus
(
vtkCommand
*
);
void
ReleaseFocus
();
//ETX
protected:
vtkObject
();
virtual
~
vtkObject
();
...
...
@@ -181,6 +172,18 @@ protected:
vtkTimeStamp
MTime
;
// Keep track of modification time
vtkSubjectHelper
*
SubjectHelper
;
// Description:
// These methods allow a command to exclusively grab all events. (This
// method is typically used by widgets to grab events once an event
// sequence begins.) These methods are provided in support of the
// public methods found in the class vtkInteractorObserver. Note that
// these methods are designed to support vtkInteractorObservers since
// they use two separate vtkCommands to watch for mouse and keypress events.
//BTX
void
InternalGrabFocus
(
vtkCommand
*
mouseEvents
,
vtkCommand
*
keypressEvents
=
NULL
);
void
InternalReleaseFocus
();
//ETX
private:
vtkObject
(
const
vtkObject
&
);
// Not implemented.
void
operator
=
(
const
vtkObject
&
);
// Not implemented.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment