summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMalte Timmermann <mt@openoffice.org>2001-04-04 08:30:18 +0000
committerMalte Timmermann <mt@openoffice.org>2001-04-04 08:30:18 +0000
commit64651c732d90ac2fe7218b113da391f33fb76957 (patch)
tree7276030bc5b0eccab595a90ba81b1d1cfd461d00 /toolkit
parentc65df9bb1afb9988a8e5e00d9e9f633766c0f159 (diff)
#85594# RadioButton supports XButton
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx13
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx15
-rw-r--r--toolkit/source/awt/vclxwindows.cxx35
3 files changed, 53 insertions, 10 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index d3178b112de9..e89fe73f5566 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: vclxwindows.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mt $ $Date: 2001-03-14 11:56:50 $
+ * last change: $Author: mt $ $Date: 2001-04-04 09:26:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -444,11 +444,15 @@ public:
// class VCLXRadioButton
// ----------------------------------------------------
class VCLXRadioButton : public ::com::sun::star::awt::XRadioButton,
+ public ::com::sun::star::awt::XButton,
public VCLXWindow
{
private:
ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
protected:
DECL_LINK( ClickHdl, RadioButton* );
DECL_LINK( ToggleHdl, RadioButton* );
@@ -480,6 +484,11 @@ public:
void SAL_CALL setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XButton:
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::awt::XLayoutConstrains
::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
index dfffd22dd23e..c34184793345 100644
--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unocontrols.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mt $ $Date: 2001-02-12 15:53:11 $
+ * last change: $Author: mt $ $Date: 2001-04-04 09:26:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -636,13 +636,15 @@ public:
// class UnoRadioButtonControl
// ----------------------------------------------------
class UnoRadioButtonControl : public UnoControlBase,
+ public ::com::sun::star::awt::XButton,
public ::com::sun::star::awt::XRadioButton,
public ::com::sun::star::awt::XItemListener,
public ::com::sun::star::awt::XLayoutConstrains
{
private:
- ItemListenerMultiplexer maItemListeners;
- ::rtl::OUString maLabel;
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
public:
@@ -664,6 +666,11 @@ public:
// ::com::sun::star::awt::XControl
sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XButton
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::awt::XRadioButton
void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index b9b247837c47..f19467a46a89 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: vclxwindows.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mt $ $Date: 2001-03-20 17:17:18 $
+ * last change: $Author: mt $ $Date: 2001-04-04 09:30:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -653,7 +653,7 @@ IMPL_LINK( VCLXCheckBox, ClickHdl, CheckBox*, EMPTYARG )
// ----------------------------------------------------
// class VCLXRadioButton
// ----------------------------------------------------
-VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this )
+VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
{
}
@@ -690,13 +690,15 @@ void VCLXRadioButton::SetWindow( Window* pWindow )
::com::sun::star::uno::Any VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ) );
+ SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) );
return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
}
// ::com::sun::star::lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( VCLXRadioButton )
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
VCLXWindow::getTypes()
IMPL_XTYPEPROVIDER_END
@@ -790,6 +792,18 @@ void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference
maItemListeners.removeInterface( l );
}
+void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -799,6 +813,12 @@ void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun
pWindow->SetText( rLabel );
}
+void VCLXRadioButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionCommand = rCommand;
+}
+
void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -851,6 +871,13 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti
IMPL_LINK( VCLXRadioButton, ClickHdl, RadioButton*, EMPTYARG )
{
+ if ( GetWindow() && maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = maActionCommand;
+ maActionListeners.actionPerformed( aEvent );
+ }
ImplClickedOrToggled( FALSE );
return 1;
}