X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/571b0b138bc5c910e4dbc5bca510b65859741e1b..6c2cd2a2116c5eff1646e0acb7cad2c887300300:/src/cocoa/tooltip.mm diff --git a/src/cocoa/tooltip.mm b/src/cocoa/tooltip.mm index a1eeed486a..95008e474b 100644 --- a/src/cocoa/tooltip.mm +++ b/src/cocoa/tooltip.mm @@ -2,13 +2,15 @@ // Name: src/cocoa/tooltip.mm // Purpose: Cocoa tooltips // Author: Ryan Norton -// Modified by: +// Modified by: // Created: 2004-10-03 // RCS-ID: $Id$ // Copyright: (c) Ryan Norton // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +#include "wx/wxprec.h" + // =========================================================================== // declarations // =========================================================================== @@ -17,11 +19,12 @@ // headers // --------------------------------------------------------------------------- -#include "wx/defs.h" - #if wxUSE_TOOLTIPS -#include "wx/window.h" +#ifndef WX_PRECOMP + #include "wx/window.h" +#endif + #include "wx/tooltip.h" #include "wx/cocoa/autorelease.h" @@ -30,7 +33,7 @@ #import // -// Private object in AppKit - exists in 10.2 at least - +// Private object in AppKit - exists in 10.2 at least - // most likely exists earlier too // @interface NSToolTipManager : NSObject @@ -88,34 +91,34 @@ IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) -wxToolTip::wxToolTip(const wxString &tip) : - m_text(tip), m_window(0) +wxToolTip::wxToolTip(const wxString &tip) : + m_text(tip), m_window(0) { } -wxToolTip::~wxToolTip() +wxToolTip::~wxToolTip() { } void wxToolTip::SetTip(const wxString& tip) -{ - m_text = tip; +{ + m_text = tip; } -const wxString& wxToolTip::GetTip() const -{ - return m_text; +const wxString& wxToolTip::GetTip() const +{ + return m_text; } // the window we're associated with -wxWindow *wxToolTip::GetWindow() const -{ - return m_window; +wxWindow *wxToolTip::GetWindow() const +{ + return m_window; } // enable or disable the tooltips globally -//static - void wxToolTip::Enable(bool flag) +//static + void wxToolTip::Enable(bool flag) { //TODO wxFAIL_MSG(wxT("Not implemented")); @@ -123,22 +126,22 @@ wxWindow *wxToolTip::GetWindow() const // set the delay after which the tooltip appears //static - void wxToolTip::SetDelay(long milliseconds) + void wxToolTip::SetDelay(long milliseconds) { [[NSToolTipManager sharedToolTipManager] setInitialToolTipDelay: ((double)milliseconds) / 1000.0]; } -void wxToolTip::SetWindow(wxWindow* window) +void wxToolTip::SetWindow(wxWindow* window) { wxAutoNSAutoreleasePool pool; m_window = window; - + //set the tooltip - empty string means remove - if (m_text.IsEmpty()) - [m_window->GetNSView() setToolTip:nil]; + if (m_text.empty()) + [m_window->GetNSView() setToolTip:nil]; else - [m_window->GetNSView() setToolTip:wxNSStringWithWxString(m_text)]; + [m_window->GetNSView() setToolTip:wxNSStringWithWxString(m_text)]; } #endif //wxUSE_TOOLTIPS