From 491592015bc937a7fa46215e0ebaa0962456359b Mon Sep 17 00:00:00 2001 From: Tomcsik Bence Date: Thu, 1 Mar 2012 13:33:04 +0100 Subject: implement scrolling with mouse in Object Catalog dialog I edited out the ObjectTreeListBox class because BasicTreeListBox contains the scroll function and all the other functions that the ObjectTreeListBox uses. --- basctl/source/basicide/bastype2.cxx | 27 ++++++++++++++++++++++++- basctl/source/basicide/bastype2.hxx | 1 + basctl/source/basicide/objdlg.cxx | 39 ------------------------------------- basctl/source/basicide/objdlg.hxx | 14 +------------ 4 files changed, 28 insertions(+), 53 deletions(-) (limited to 'basctl') diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index abacd01b802c..3703776ef9ef 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -33,7 +33,9 @@ #include - +#include "basidesh.hxx" +#include "iderdll.hxx" +#include "iderdll2.hxx" #include #include #include @@ -879,4 +881,27 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc ) SetCurEntry( pCurEntry ); } +void BasicTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) +{ + SvTreeListBox::MouseButtonDown( rMEvt ); + if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) ) + { + BasicEntryDescriptor aDesc( GetEntryDescriptor( GetCurEntry() ) ); + + if ( aDesc.GetType() == OBJ_TYPE_METHOD ) + { + BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); + SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; + SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; + if( pDispatcher ) + { + SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), aDesc.GetName(), + aDesc.GetMethodName(), ConvertType( aDesc.GetType() ) ); + pDispatcher->Execute( SID_BASICIDE_SHOWSBX, + SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); + } + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx index 6f1162774de1..20aa7c5d8c69 100644 --- a/basctl/source/basicide/bastype2.hxx +++ b/basctl/source/basicide/bastype2.hxx @@ -157,6 +157,7 @@ private: ::basctl::DocumentEventNotifier m_aNotifier; void SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); protected: virtual void RequestingChildren( SvLBoxEntry* pParent ); diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx index 59172c1f7d8b..14355bffa4d0 100644 --- a/basctl/source/basicide/objdlg.cxx +++ b/basctl/source/basicide/objdlg.cxx @@ -43,45 +43,6 @@ #include #include -ObjectTreeListBox::ObjectTreeListBox( Window* pParent, const ResId& rRes ) - : BasicTreeListBox( pParent, rRes ) -{ -} - -ObjectTreeListBox::~ObjectTreeListBox() -{ -} - -void ObjectTreeListBox::Command( const CommandEvent& ) -{ -} - -void ObjectTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) -{ - BasicTreeListBox::MouseButtonDown( rMEvt ); - - if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) ) - { - BasicEntryDescriptor aDesc( GetEntryDescriptor( GetCurEntry() ) ); - - if ( aDesc.GetType() == OBJ_TYPE_METHOD ) - { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), aDesc.GetName(), - aDesc.GetMethodName(), ConvertType( aDesc.GetType() ) ); - pDispatcher->Execute( SID_BASICIDE_SHOWSBX, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - } - } -} - - - ObjectCatalog::ObjectCatalog( Window * pParent ) :FloatingWindow( pParent, IDEResId( RID_BASICIDE_OBJCAT ) ) ,aMacroTreeList( this, IDEResId( RID_TLB_MACROS ) ) diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx index c919fbcb927d..df77a64e360c 100644 --- a/basctl/source/basicide/objdlg.hxx +++ b/basctl/source/basicide/objdlg.hxx @@ -39,18 +39,6 @@ class StarBASIC; -class ObjectTreeListBox : public BasicTreeListBox -{ -private: - - virtual void Command( const CommandEvent& rCEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - -public: - ObjectTreeListBox( Window* pParent, const ResId& rRes ); - ~ObjectTreeListBox(); -}; - class ObjectCatalogToolBox_Impl: public ToolBox { public: @@ -67,7 +55,7 @@ private: class ObjectCatalog : public FloatingWindow { private: - ObjectTreeListBox aMacroTreeList; + BasicTreeListBox aMacroTreeList; ObjectCatalogToolBox_Impl aToolBox; FixedText aMacroDescr; Link aCancelHdl; -- cgit