X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6f076cb30dc735bbfc57ed4f2aced6bc74e90225..87f0b1323b7ac77f02133b836c8dfee63b0fd387:/src/cocoa/tooltip.mm?ds=inline diff --git a/src/cocoa/tooltip.mm b/src/cocoa/tooltip.mm index fcc9c6e0aa..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" @@ -29,6 +32,10 @@ #import +// +// Private object in AppKit - exists in 10.2 at least - +// most likely exists earlier too +// @interface NSToolTipManager : NSObject { /* @@ -84,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")); @@ -119,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