diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:06 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:06 +0200 |
commit | fbe76102e941b9f1edaf236788e42678f05fdf9a (patch) | |
tree | f5f538316019fa89be8dc478103490c3a826f3ac /shared/customTooltip.cpp | |
parent | 3.8 (diff) | |
download | FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.gz FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.bz2 FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.zip |
3.9
Diffstat (limited to 'shared/customTooltip.cpp')
-rw-r--r-- | shared/customTooltip.cpp | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/shared/customTooltip.cpp b/shared/customTooltip.cpp deleted file mode 100644 index e483f7c7..00000000 --- a/shared/customTooltip.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** -// -#include "customTooltip.h" -#include <wx/stattext.h> -#include <wx/sizer.h> -#include <wx/statbmp.h> - - -class CustomTooltip::PopupFrameGenerated : public wxFrame -{ -public: - PopupFrameGenerated(wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxString& title = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxSize( -1,-1 ), - long style = wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP | wxSTATIC_BORDER); - - wxStaticText* m_staticTextMain; - wxStaticBitmap* m_bitmapLeft; -}; - - -CustomTooltip::PopupFrameGenerated::PopupFrameGenerated( - wxWindow* parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style ) : wxFrame(parent, id, title, pos, size, style) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - this->SetBackgroundColour( wxColour( 255, 255, 255 ) ); - - wxBoxSizer* bSizer158; - bSizer158 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeft = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer158->Add( m_bitmapLeft, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextMain = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer158->Add( m_staticTextMain, 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5 ); - - this->SetSizer( bSizer158 ); - this->Layout(); - bSizer158->Fit( this ); -} - - -CustomTooltip::CustomTooltip() : tipWindow(new PopupFrameGenerated(NULL)), lastBmp(NULL) -{ -#ifdef FFS_WIN //neither looks good nor works at all on Linux - tipWindow->Disable(); //prevent window stealing focus! -#endif - - hide(); -} - - -CustomTooltip::~CustomTooltip() -{ - tipWindow->Destroy(); -} - - -void CustomTooltip::show(const wxString& text, wxPoint pos, const wxBitmap* bmp) -{ - if (bmp != lastBmp) - { - lastBmp = bmp; - tipWindow->m_bitmapLeft->SetBitmap(bmp == NULL ? wxNullBitmap : *bmp); - } - - if (text != tipWindow->m_staticTextMain->GetLabel()) - { - tipWindow->m_staticTextMain->SetLabel(text); - tipWindow->m_staticTextMain->Wrap(600); - } - -#ifdef FFS_LINUX - tipWindow->Fit(); //Alas Fit() seems to be somewhat broken => this needs to be called EVERY time inside show, not only if text or bmp change. -#endif - - if (pos != tipWindow->GetScreenPosition()) - tipWindow->SetSize(pos.x + 30, pos.y, wxDefaultCoord, wxDefaultCoord); - //attention!!! possible endless loop: mouse pointer must NOT be within tipWindow! - //Else it will trigger a wxEVT_LEAVE_WINDOW which will hide the window, causing the window to be shown again via this method, etc. - - if (!tipWindow->IsShown()) - tipWindow->Show(); -} - - -void CustomTooltip::hide() -{ - tipWindow->Hide(); -} |