From c10d7a3642420e35ac3890becdae1cbf35d2cf75 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Wed, 27 Feb 2002 08:40:21 +0000 Subject: #97034# VclEventListener --- .../inc/toolkit/awt/vclxaccessiblecomponent.hxx | 9 ++++-- toolkit/source/awt/vclxaccessiblecomponent.cxx | 37 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx index bc3aeffa896a..81e2ce76fa32 100644 --- a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxaccessiblecomponent.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: pb $ $Date: 2002-02-21 08:55:19 $ + * last change: $Author: mt $ $Date: 2002-02-27 09:40:21 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,9 +80,12 @@ #endif #include // Size +#include // Size class Window; class VCLXWindow; +class VclSimpleEvent; +class VclWindowEvent; namespace utl { class AccessibleStateSetHelper; @@ -118,7 +121,9 @@ private: protected: ::osl::Mutex& GetMutex() { return maMutex; } + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + /* virtual */ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); public: diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 75357bc667bf..61f9fa957b15 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxaccessiblecomponent.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mt $ $Date: 2002-02-15 10:31:39 $ + * last change: $Author: mt $ $Date: 2002-02-27 09:39:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,7 @@ #include #include #include +#include #include @@ -85,15 +86,47 @@ VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXindow ) { mpVCLXindow = pVCLXindow; mxWindow = pVCLXindow; + + DBG_ASSERT( pVCLXindow->GetWindow(), "VCLXAccessibleComponent - no window!" ); + if ( pVCLXindow->GetWindow() ) + pVCLXindow->GetWindow()->AddEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); } VCLXAccessibleComponent::~VCLXAccessibleComponent() { + if ( mpVCLXindow && mpVCLXindow->GetWindow() ) + mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); +} + +IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent ) +{ + DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); + if ( pEvent && pEvent->ISA( VclWindowEvent ) ) + { + DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow() && GetWindow(), "Window???" ); + ProcessWindowEvent( *(VclWindowEvent*)pEvent ); + } + return 0; +} + +void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) +{ + switch ( rVclWindowEvent.GetId() ) + { +// case XXX: +// { +// } +// break; + } } void VCLXAccessibleComponent::disposing() { + if ( mpVCLXindow && mpVCLXindow->GetWindow() ) + mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); + mxWindow.clear(); + mpVCLXindow = NULL; } Window* VCLXAccessibleComponent::GetWindow() const -- cgit