summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-14 12:23:42 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-14 12:23:42 +0100
commitd0cdc38a6771473b81f002da6769b7b723d657ff (patch)
tree12fb574a36267391df711a1a81d689d1881488ef
parentacaf4f1d75540acd79b7380c7f0ade4e04b75bd8 (diff)
gridsort: TableDataWindow: use Help::ShowTip instead of Help::ShowQuickHelp.
This means it doesn't interfere with the "normal" quick help (which is a singleton really dedicated to, well, quickly displaying help). Also, it means we do not need the QUICKHELP_NO_DELAY flag. To prevent flickering when repeatedly showing such a tip, introduced Help::UpdateTip, which updates an existing tip, instead of destroying the old tip window, and creating a new one. Used this new UpdateTip also in the BrowseBox, means means some less flickering there, too.
-rw-r--r--svtools/source/brwbox/datwin.cxx9
-rw-r--r--svtools/source/table/tabledatawindow.cxx73
-rw-r--r--svtools/source/table/tabledatawindow.hxx7
-rw-r--r--vcl/inc/vcl/help.hxx4
-rw-r--r--vcl/inc/vcl/helpwin.hxx1
-rw-r--r--vcl/source/app/help.cxx23
6 files changed, 84 insertions, 33 deletions
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index cb43e4989355..2c771f778d92 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -752,17 +752,18 @@ void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt )
ULONG nPos = GetThumbPos();
if ( nPos != _nLastPos )
{
- if ( _nTip )
- Help::HideTip( _nTip );
-
String aTip( String::CreateFromInt32(nPos) );
aTip += '/';
if ( _pDataWin->GetRealRowCount().Len() )
aTip += _pDataWin->GetRealRowCount();
else
aTip += String::CreateFromInt32(GetRangeMax());
+
Rectangle aRect( GetPointerPosPixel(), Size( GetTextHeight(), GetTextWidth( aTip ) ) );
- _nTip = Help::ShowTip( this, aRect, aTip );
+ if ( _nTip )
+ Help::UpdateTip( _nTip, this, aRect, aTip );
+ else
+ _nTip = Help::ShowTip( this, aRect, aTip );
_nLastPos = nPos;
}
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index 1b2106f6d7e0..56be34897fe2 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -36,22 +36,23 @@
#include <vcl/help.hxx>
-//........................................................................
+//......................................................................................................................
namespace svt { namespace table
{
-//........................................................................
+//......................................................................................................................
/** === begin UNO using === **/
using ::com::sun::star::uno::Any;
/** === end UNO using === **/
- //====================================================================
+ //==================================================================================================================
//= TableDataWindow
- //====================================================================
- //--------------------------------------------------------------------
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
:Window( &_rTableControl.getAntiImpl() )
,m_rTableControl( _rTableControl )
+ ,m_nTipWindowHandle( 0 )
{
// by default, use the background as determined by the style settings
const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
@@ -59,33 +60,39 @@ namespace svt { namespace table
SetFillColor( aWindowColor );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ TableDataWindow::~TableDataWindow()
+ {
+ impl_hideTipWindow();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::Paint( const Rectangle& rUpdateRect )
{
m_rTableControl.doPaintContent( rUpdateRect );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetBackground( const Wallpaper& rColor )
{
Window::SetBackground( rColor );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetControlBackground( const Color& rColor )
{
Window::SetControlBackground( rColor );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetBackground()
{
Window::SetBackground();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetControlBackground()
{
Window::SetControlBackground();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::RequestHelp( const HelpEvent& rHEvt )
{
USHORT const nHelpMode = rHEvt.GetMode();
@@ -99,10 +106,10 @@ namespace svt { namespace table
RowPos const hitRow = rTableControl.getRowAtPoint( aMousePos );
ColPos const hitCol = rTableControl.getColAtPoint( aMousePos );
+ ::rtl::OUString sHelpText;
+
if ( ( hitCol >= 0 ) && ( hitCol < pTableModel->getColumnCount() ) )
{
- ::rtl::OUString sHelpText;
-
if ( hitRow == ROW_COL_HEADERS )
{
sHelpText = pTableModel->getColumnModel( hitCol )->getHelpText();
@@ -131,14 +138,19 @@ namespace svt { namespace table
sHelpText = CellValueConversion::convertToString( aCellToolTip );
}
+ }
+ if ( sHelpText.getLength() )
+ {
Rectangle const aControlScreenRect(
OutputToScreenPixel( Point( 0, 0 ) ),
GetOutputSizePixel()
);
- Help::ShowQuickHelp( this, aControlScreenRect, sHelpText, String(), QUICKHELP_FORCE_REPOSITION | QUICKHELP_NO_DELAY );
- // also do this when the help text is empty - in this case, a previously active tip help window
- // (possible displaying the tooltip for another cell) will be hidden, which is intended here.
+
+ if ( m_nTipWindowHandle )
+ Help::UpdateTip( m_nTipWindowHandle, this, aControlScreenRect, sHelpText );
+ else
+ m_nTipWindowHandle = Help::ShowTip( this, aControlScreenRect, sHelpText );
}
}
else
@@ -147,9 +159,22 @@ namespace svt { namespace table
}
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ void TableDataWindow::impl_hideTipWindow()
+ {
+ if ( m_nTipWindowHandle != 0 )
+ {
+ Help::HideTip( m_nTipWindowHandle );
+ m_nTipWindowHandle = 0;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
{
+ if ( rMEvt.IsLeaveWindow() )
+ impl_hideTipWindow();
+
Point aPoint = rMEvt.GetPosPixel();
if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) )
{
@@ -163,7 +188,7 @@ namespace svt { namespace table
}
}
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
const Point aPoint = rMEvt.GetPosPixel();
@@ -182,7 +207,7 @@ namespace svt { namespace table
}
m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) )
@@ -190,17 +215,17 @@ namespace svt { namespace table
m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
m_rTableControl.getAntiImpl().GrabFocus();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::SetPointer( const Pointer& rPointer )
{
Window::SetPointer(rPointer);
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::CaptureMouse()
{
Window::CaptureMouse();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void TableDataWindow::ReleaseMouse( )
{
Window::ReleaseMouse();
@@ -223,6 +248,6 @@ namespace svt { namespace table
}
return nDone ? nDone : Window::Notify( rNEvt );
}
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx
index 1cc030be512b..45ffec92c286 100644
--- a/svtools/source/table/tabledatawindow.hxx
+++ b/svtools/source/table/tabledatawindow.hxx
@@ -55,8 +55,12 @@ namespace svt { namespace table
Link m_aMouseButtonDownHdl;
Link m_aMouseButtonUpHdl;
Link m_aSelectHdl;
+ ULONG m_nTipWindowHandle;
+
public:
TableDataWindow( TableControl_Impl& _rTableControl );
+ ~TableDataWindow();
+
inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; }
inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; }
inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; }
@@ -79,6 +83,9 @@ namespace svt { namespace table
void SetBackground(const Wallpaper& rColor);
void SetBackground();
+
+ private:
+ void impl_hideTipWindow();
};
//........................................................................
} } // namespace svt::table
diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx
index 4fb039b25bec..a43b0fe84862 100644
--- a/vcl/inc/vcl/help.hxx
+++ b/vcl/inc/vcl/help.hxx
@@ -118,6 +118,10 @@ public:
static ULONG ShowTip( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rText, USHORT nStyle = 0 );
+ static void UpdateTip( ULONG nId,
+ Window* pParent,
+ const Rectangle& rScreenRect,
+ const XubString& rText );
static void HideTip( ULONG nId );
};
diff --git a/vcl/inc/vcl/helpwin.hxx b/vcl/inc/vcl/helpwin.hxx
index 244ae1b7d846..799685251e02 100644
--- a/vcl/inc/vcl/helpwin.hxx
+++ b/vcl/inc/vcl/helpwin.hxx
@@ -66,6 +66,7 @@ public:
const String& GetHelpText() const { return maHelpText; }
void SetHelpText( const String& rHelpText );
USHORT GetWinStyle() const { return mnHelpWinStyle; }
+ USHORT GetStyle() const { return mnStyle; }
// Nur merken:
void SetStatusText( const String& rStatusText ) { maStatusText = rStatusText; }
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 46f5e2132e5c..09650cee9231 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -36,6 +36,7 @@
#include "vcl/help.hxx"
#include "vcl/helpwin.hxx"
#include "tools/debug.hxx"
+#include "tools/diagnose_ex.h"
#include "tools/time.hxx"
// =======================================================================
@@ -274,18 +275,30 @@ BOOL Help::ShowQuickHelp( Window* pParent,
// -----------------------------------------------------------------------
-ULONG Help::ShowTip( Window* pParent, const Rectangle& rRect,
+ULONG Help::ShowTip( Window* pParent, const Rectangle& rScreenRect,
const XubString& rText, USHORT nStyle )
{
USHORT nHelpWinStyle = HELPWINSTYLE_QUICK;
HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle );
+ ULONG nId = reinterpret_cast< ULONG >( pHelpWin );
+ UpdateTip( nId, pParent, rScreenRect, rText );
+
+ pHelpWin->ShowHelp( HELPDELAY_NONE );
+ return nId;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::UpdateTip( ULONG nId, Window* pParent, const Rectangle& rScreenRect, const XubString& rText )
+{
+ HelpTextWindow* pHelpWin = reinterpret_cast< HelpTextWindow* >( nId );
+ ENSURE_OR_RETURN_VOID( pHelpWin != NULL, "Help::UpdateTip: invalid ID!" );
+
Size aSz = pHelpWin->CalcOutSize();
pHelpWin->SetOutputSizePixel( aSz );
- ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle,
- pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rRect );
- pHelpWin->ShowHelp( HELPDELAY_NONE );
- return (ULONG)pHelpWin;
+ ImplSetHelpWindowPos( pHelpWin, pHelpWin->GetWinStyle(), pHelpWin->GetStyle(),
+ pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect );
}
// -----------------------------------------------------------------------