goldendict-ng/mouseover.hh
Abs62 a8589b39bf Improvements in scan popup functionality.
1. Add search word under cursor through IAccessibleEx interface and UI Automation technology.
2. Reorganize GoldenDict main program and scan libraries interaction to reduce influence to other programs.
3. Fix crash in scan libraries in IE9 protected mode.
2011-07-09 23:26:30 +04:00

70 lines
1.6 KiB
C++

#ifndef __MOUSEOVER_HH_INCLUDED__
#define __MOUSEOVER_HH_INCLUDED__
#include <QObject>
#ifdef Q_OS_WIN32
#include <windows.h>
#endif
/// This is a mouseover feature interface, where you can point your mouse at
/// any word in any window and wait a little, and it would provide that word
/// for the translation.
/// This interface always exists, even on platforms that don't support that
/// feature -- it just remains dormant on them.
///
/// The Windows platform is the only one supported; it works with the help of
/// two external .dll files,
class MouseOver: public QObject
{
Q_OBJECT
public:
/// The class is a singleton.
static MouseOver & instance();
/// Enables mouseover. The mouseover is initially disabled.
void enableMouseOver();
/// Disables mouseover.
void disableMouseOver();
signals:
/// Emitted when there was some text under cursor which was hovered over.
void hovered( QString const & );
#ifdef Q_OS_WIN32
/// Ask for need to handle word under cursor
void askNeedWord( bool * );
/// Ask for use UI Automation interfaces to get word under cursor
void askUseUIAutomation( bool * );
/// Ask for use IAccessibleEx interface to get word under cursor
void askUseIAccessibleEx( bool * );
/// Ask for use GD message to get word under cursor
void askUseGDMessage( bool * );
#endif
private:
MouseOver();
~MouseOver();
#ifdef Q_OS_WIN32
static LRESULT CALLBACK eventHandler( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam );
typedef void ( *ActivateSpyFn )( bool );
ActivateSpyFn activateSpyFn;
HINSTANCE spyDll;
bool mouseOverEnabled;
#endif
};
#endif