various cleanups

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton
2004-10-08 01:26:43 +00:00
parent 0c0be4a318
commit 1e15159472
5 changed files with 111 additions and 16 deletions

View File

@@ -262,6 +262,10 @@ wxCOCOA:
- Added UNICODE layer for OSX so that you can build wxWidgets in UNICODE mode in OSX 10.2 (and possibly lower) with wxMAC and wxCOCOA (RN) - Added UNICODE layer for OSX so that you can build wxWidgets in UNICODE mode in OSX 10.2 (and possibly lower) with wxMAC and wxCOCOA (RN)
- Fixed so that wxCOCOA runs in 10.2 (and possibly lower) (RN) - Fixed so that wxCOCOA runs in 10.2 (and possibly lower) (RN)
- Tooltips now supported - Enable and SetDelay not implemented (RN)
- wxSound now supported (RN)
- wxDisplay now supported (RN)
- Cursors (hopefully) now supported (RN)
wxMac: wxMac:

View File

@@ -11,29 +11,32 @@
#include "wx/object.h" #include "wx/object.h"
class wxWindow;
class wxToolTip : public wxObject class wxToolTip : public wxObject
{ {
public: public:
// ctor & dtor // ctor & dtor
wxToolTip(const wxString &tip) : m_text(tip), m_window(0) {} wxToolTip(const wxString &tip);
virtual ~wxToolTip() {} virtual ~wxToolTip();
// accessors // accessors
// tip text // tip text
void SetTip(const wxString& tip) { m_text = tip; } void SetTip(const wxString& tip);
const wxString& GetTip() const { return m_text; } const wxString& GetTip() const;
// the window we're associated with // the window we're associated with
wxWindow *GetWindow() const { return m_window; } wxWindow *GetWindow() const;
// controlling tooltip behaviour: globally change tooltip parameters // controlling tooltip behaviour: globally change tooltip parameters
// enable or disable the tooltips globally // enable or disable the tooltips globally
static void Enable(bool flag) {} static void Enable(bool flag);
// set the delay after which the tooltip appears // set the delay after which the tooltip appears
static void SetDelay(long milliseconds) {} static void SetDelay(long milliseconds);
private: private:
void SetWindow(wxWindow* window) {m_window = window;} void SetWindow(wxWindow* window);
friend class wxWindow; friend class wxWindow;
wxString m_text; // tooltip text wxString m_text; // tooltip text

View File

@@ -1,11 +1,11 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: src/cocoa/display.cpp // Name: src/cocoa/display.mm
// Purpose: Cocoa implementation of wxDisplay class // Purpose: Cocoa implementation of wxDisplay class
// Author: Ryan Norton // Author: Ryan Norton
// Modified by: // Modified by:
// Created: 2004-10-03 // Created: 2004-10-03
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) wxWidgets team // Copyright: (c) Ryan Norton
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@@ -1 +1,92 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/cocoa/tooltip.mm
// Purpose: Cocoa tooltips
// Author: Ryan Norton
// Modified by:
// Created: 2004-10-03
// RCS-ID: $Id$
// Copyright: (c) Ryan Norton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ===========================================================================
// declarations
// ===========================================================================
// ---------------------------------------------------------------------------
// headers
// ---------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_TOOLTIPS
#include "wx/window.h"
#include "wx/tooltip.h"
#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/string.h"
#import <AppKit/NSView.h>
//-----------------------------------------------------------------------------
// wxToolTip
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
wxToolTip::wxToolTip(const wxString &tip) :
m_text(tip), m_window(0)
{
}
wxToolTip::~wxToolTip()
{
}
void wxToolTip::SetTip(const wxString& tip)
{
m_text = tip;
}
const wxString& wxToolTip::GetTip() const
{
return m_text;
}
// the window we're associated with
wxWindow *wxToolTip::GetWindow() const
{
return m_window;
}
// enable or disable the tooltips globally
//static
void wxToolTip::Enable(bool flag)
{
//TODO
wxFAIL_MSG(wxT("Not implemented"));
}
// set the delay after which the tooltip appears
//static
void SetDelay(long milliseconds)
{
//TODO
wxFAIL_MSG(wxT("Not implemented"));
}
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];
else
[m_window->GetNSView() setToolTip:wxNSStringWithWxString(m_text)];
}
#endif //wxUSE_TOOLTIPS

View File

@@ -25,7 +25,6 @@
#import <AppKit/NSColor.h> #import <AppKit/NSColor.h>
#import <AppKit/NSClipView.h> #import <AppKit/NSClipView.h>
#import <Foundation/NSException.h> #import <Foundation/NSException.h>
#import <Foundation/NSString.h>
#include <objc/objc-runtime.h> #include <objc/objc-runtime.h>
@@ -611,22 +610,20 @@ void wxWindowCocoa::DoSetSize(int x, int y, int width, int height, int sizeFlags
DoMoveWindow(x,y,width,height); DoMoveWindow(x,y,width,height);
} }
//We should really get rid of wxToolTip :) #if wxUSE_TOOLTIPS
IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
void wxWindowCocoa::DoSetToolTip( wxToolTip *tip ) void wxWindowCocoa::DoSetToolTip( wxToolTip *tip )
{ {
wxWindowBase::DoSetToolTip(tip); wxWindowBase::DoSetToolTip(tip);
wxAutoNSAutoreleasePool pool;
if ( m_tooltip ) if ( m_tooltip )
{ {
m_tooltip->SetWindow((wxWindow *)this); m_tooltip->SetWindow((wxWindow *)this);
[GetNSView() setToolTip:wxNSStringWithWxString(m_tooltip->GetTip())];
} }
} }
#endif
void wxWindowCocoa::DoMoveWindow(int x, int y, int width, int height) void wxWindowCocoa::DoMoveWindow(int x, int y, int width, int height)
{ {
wxAutoNSAutoreleasePool pool; wxAutoNSAutoreleasePool pool;