wxToolTip modifications: wxUSE_TOOLTIPS setting (default: on) added and

the interface changed slightly to be even more consistent with wxMSW


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-02-01 14:40:53 +00:00
parent 301cd871a2
commit ff8bfdbbb1
23 changed files with 1364 additions and 1299 deletions

638
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -764,6 +764,7 @@ DEFAULT_wxUSE_POSTSCRIPT=1
DEFAULT_wxUSE_IPC=1 DEFAULT_wxUSE_IPC=1
DEFAULT_wxUSE_RESOURCES=1 DEFAULT_wxUSE_RESOURCES=1
DEFAULT_wxUSE_CLIPBOARD=1 DEFAULT_wxUSE_CLIPBOARD=1
DEFAULT_wxUSE_TOOLTIPS=1
DEFAULT_wxUSE_DRAG_AND_DROP=1 DEFAULT_wxUSE_DRAG_AND_DROP=1
DEFAULT_wxUSE_MDI_ARCHITECTURE=1 DEFAULT_wxUSE_MDI_ARCHITECTURE=1
@@ -938,6 +939,10 @@ AC_OVERRIDES(clipboard,clipboard,
**--with-clipboard use wxClipboard classes, **--with-clipboard use wxClipboard classes,
wxUSE_CLIPBOARD) wxUSE_CLIPBOARD)
AC_OVERRIDES(tooltips,tooltips,
**--with-tooltips use tooltips,
wxUSE_TOOLTIPS)
AC_OVERRIDES(dnd,dnd, AC_OVERRIDES(dnd,dnd,
**--with-dnd use Drag'n'Drop classes, **--with-dnd use Drag'n'Drop classes,
wxUSE_DRAG_AND_DROP) wxUSE_DRAG_AND_DROP)
@@ -1282,6 +1287,10 @@ if test "$wxUSE_CLIPBOARD" = 1 ; then
AC_DEFINE_UNQUOTED(wxUSE_CLIPBOARD,$wxUSE_CLIPBOARD) AC_DEFINE_UNQUOTED(wxUSE_CLIPBOARD,$wxUSE_CLIPBOARD)
fi fi
if test "$wxUSE_TOOLTIPS" = 1 ; then
AC_DEFINE_UNQUOTED(wxUSE_TOOLTIPS,$wxUSE_TOOLTIPS)
fi
if test "$wxUSE_DRAG_AND_DROP" = 1 ; then if test "$wxUSE_DRAG_AND_DROP" = 1 ; then
AC_DEFINE_UNQUOTED(wxUSE_DRAG_AND_DROP,$wxUSE_DRAG_AND_DROP) AC_DEFINE_UNQUOTED(wxUSE_DRAG_AND_DROP,$wxUSE_DRAG_AND_DROP)
fi fi

View File

@@ -41,9 +41,8 @@ class wxCheckBox: public wxControl
DECLARE_DYNAMIC_CLASS(wxCheckBox) DECLARE_DYNAMIC_CLASS(wxCheckBox)
public: public:
wxCheckBox(void); wxCheckBox(void);
inline wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label, wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,

View File

@@ -34,8 +34,8 @@ class wxCheckListBox;
class wxCheckListBox : public wxListBox class wxCheckListBox : public wxListBox
{ {
DECLARE_DYNAMIC_CLASS(wxCheckListBox) DECLARE_DYNAMIC_CLASS(wxCheckListBox)
public:
public:
wxCheckListBox(); wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id, wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -49,8 +49,7 @@ public:
bool IsChecked( int index ) const; bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE ); void Check( int index, bool check = TRUE );
int GetItemHeight(); int GetItemHeight() const;
}; };
#endif #endif

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: listbox.h // Name: listbox.h
// Purpose: // Purpose: wxListBox class declaration
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
@@ -42,9 +42,8 @@ class wxListBox : public wxControl
DECLARE_DYNAMIC_CLASS(wxListBox) DECLARE_DYNAMIC_CLASS(wxListBox)
public: public:
wxListBox(); wxListBox();
inline wxListBox( wxWindow *parent, wxWindowID id, wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL, int n = 0, const wxString choices[] = (const wxString *) NULL,
@@ -55,7 +54,8 @@ public:
m_hasCheckBoxes = FALSE; m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name); Create(parent, id, pos, size, n, choices, style, validator, name);
} }
~wxListBox(); virtual ~wxListBox();
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
@@ -102,7 +102,10 @@ public:
GtkWidget *GetConnectWidget(); GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window ); bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle(); void ApplyWidgetStyle();
#if wxUSE_TOOLTIPS
void ApplyToolTip( GtkTooltips *tips, const char *tip ); void ApplyToolTip( GtkTooltips *tips, const char *tip );
#endif // wxUSE_TOOLTIPS
GtkList *m_list; GtkList *m_list;
wxList m_clientDataList; wxList m_clientDataList;

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: tooltip.h // Name: tooltip.h
// Purpose: // Purpose: wxToolTip class
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
@@ -15,14 +15,15 @@
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/string.h"
#include "wx/object.h" #include "wx/object.h"
#include "wx/window.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // forward declarations
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxToolTip; class wxToolTip;
class wxWindow;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxToolTip // wxToolTip
@@ -31,23 +32,25 @@ class wxToolTip;
class wxToolTip : public wxObject class wxToolTip : public wxObject
{ {
public: public:
// globally change the tooltip parameters
wxToolTip( const wxString &tip );
void SetTip( const wxString &tip );
wxString GetTip() const;
wxWindow *GetWindow() const;
bool Ok() const;
static void Enable( bool flag ); static void Enable( bool flag );
static void SetDelay( long msecs ); static void SetDelay( long msecs );
// implementation wxToolTip( const wxString &tip );
// get/set the tooltip text
void SetTip( const wxString &tip );
wxString GetTip() const { return m_text; }
wxWindow *GetWindow() const { return m_window; }
bool IsOk() const { return m_window != NULL; }
// implementation
void Apply( wxWindow *win );
private:
wxString m_text; wxString m_text;
wxWindow *m_window; wxWindow *m_window;
void Apply( wxWindow *win );
}; };
#endif // __GTKTOOLTIPH__ #endif // __GTKTOOLTIPH__

View File

@@ -229,9 +229,11 @@ public:
void WarpPointer(int x, int y); void WarpPointer(int x, int y);
virtual void SetToolTip( const wxString &tip ); #if wxUSE_TOOLTIPS
void SetToolTip( const wxString &tip );
virtual void SetToolTip( wxToolTip *tip ); virtual void SetToolTip( wxToolTip *tip );
virtual wxToolTip* GetToolTip(); wxToolTip* GetToolTip() const { return m_toolTip; }
#endif // wxUSE_TOOLTIPS
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
virtual void Clear(); virtual void Clear();
@@ -348,7 +350,9 @@ public:
void SetWidgetStyle(); void SetWidgetStyle();
virtual void ApplyWidgetStyle(); virtual void ApplyWidgetStyle();
#if wxUSE_TOOLTIPS
virtual void ApplyToolTip( GtkTooltips *tips, const char *tip ); virtual void ApplyToolTip( GtkTooltips *tips, const char *tip );
#endif // wxUSE_TOOLTIPS
/* private member variables */ /* private member variables */
@@ -377,7 +381,10 @@ public:
wxAcceleratorTable m_acceleratorTable; wxAcceleratorTable m_acceleratorTable;
wxClientData *m_clientObject; wxClientData *m_clientObject;
void *m_clientData; void *m_clientData;
#if wxUSE_TOOLTIPS
wxToolTip *m_toolTip; wxToolTip *m_toolTip;
#endif // wxUSE_TOOLTIPS
GtkWidget *m_widget; GtkWidget *m_widget;
GtkWidget *m_wxwindow; GtkWidget *m_wxwindow;

View File

@@ -41,9 +41,8 @@ class wxCheckBox: public wxControl
DECLARE_DYNAMIC_CLASS(wxCheckBox) DECLARE_DYNAMIC_CLASS(wxCheckBox)
public: public:
wxCheckBox(void); wxCheckBox(void);
inline wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label, wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,

View File

@@ -34,8 +34,8 @@ class wxCheckListBox;
class wxCheckListBox : public wxListBox class wxCheckListBox : public wxListBox
{ {
DECLARE_DYNAMIC_CLASS(wxCheckListBox) DECLARE_DYNAMIC_CLASS(wxCheckListBox)
public:
public:
wxCheckListBox(); wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id, wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -49,8 +49,7 @@ public:
bool IsChecked( int index ) const; bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE ); void Check( int index, bool check = TRUE );
int GetItemHeight(); int GetItemHeight() const;
}; };
#endif #endif

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: listbox.h // Name: listbox.h
// Purpose: // Purpose: wxListBox class declaration
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
@@ -42,9 +42,8 @@ class wxListBox : public wxControl
DECLARE_DYNAMIC_CLASS(wxListBox) DECLARE_DYNAMIC_CLASS(wxListBox)
public: public:
wxListBox(); wxListBox();
inline wxListBox( wxWindow *parent, wxWindowID id, wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL, int n = 0, const wxString choices[] = (const wxString *) NULL,
@@ -55,7 +54,8 @@ public:
m_hasCheckBoxes = FALSE; m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name); Create(parent, id, pos, size, n, choices, style, validator, name);
} }
~wxListBox(); virtual ~wxListBox();
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
@@ -102,7 +102,10 @@ public:
GtkWidget *GetConnectWidget(); GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window ); bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle(); void ApplyWidgetStyle();
#if wxUSE_TOOLTIPS
void ApplyToolTip( GtkTooltips *tips, const char *tip ); void ApplyToolTip( GtkTooltips *tips, const char *tip );
#endif // wxUSE_TOOLTIPS
GtkList *m_list; GtkList *m_list;
wxList m_clientDataList; wxList m_clientDataList;

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: tooltip.h // Name: tooltip.h
// Purpose: // Purpose: wxToolTip class
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
@@ -15,14 +15,15 @@
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/string.h"
#include "wx/object.h" #include "wx/object.h"
#include "wx/window.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // forward declarations
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxToolTip; class wxToolTip;
class wxWindow;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxToolTip // wxToolTip
@@ -31,23 +32,25 @@ class wxToolTip;
class wxToolTip : public wxObject class wxToolTip : public wxObject
{ {
public: public:
// globally change the tooltip parameters
wxToolTip( const wxString &tip );
void SetTip( const wxString &tip );
wxString GetTip() const;
wxWindow *GetWindow() const;
bool Ok() const;
static void Enable( bool flag ); static void Enable( bool flag );
static void SetDelay( long msecs ); static void SetDelay( long msecs );
// implementation wxToolTip( const wxString &tip );
// get/set the tooltip text
void SetTip( const wxString &tip );
wxString GetTip() const { return m_text; }
wxWindow *GetWindow() const { return m_window; }
bool IsOk() const { return m_window != NULL; }
// implementation
void Apply( wxWindow *win );
private:
wxString m_text; wxString m_text;
wxWindow *m_window; wxWindow *m_window;
void Apply( wxWindow *win );
}; };
#endif // __GTKTOOLTIPH__ #endif // __GTKTOOLTIPH__

View File

@@ -229,9 +229,11 @@ public:
void WarpPointer(int x, int y); void WarpPointer(int x, int y);
virtual void SetToolTip( const wxString &tip ); #if wxUSE_TOOLTIPS
void SetToolTip( const wxString &tip );
virtual void SetToolTip( wxToolTip *tip ); virtual void SetToolTip( wxToolTip *tip );
virtual wxToolTip* GetToolTip(); wxToolTip* GetToolTip() const { return m_toolTip; }
#endif // wxUSE_TOOLTIPS
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
virtual void Clear(); virtual void Clear();
@@ -348,7 +350,9 @@ public:
void SetWidgetStyle(); void SetWidgetStyle();
virtual void ApplyWidgetStyle(); virtual void ApplyWidgetStyle();
#if wxUSE_TOOLTIPS
virtual void ApplyToolTip( GtkTooltips *tips, const char *tip ); virtual void ApplyToolTip( GtkTooltips *tips, const char *tip );
#endif // wxUSE_TOOLTIPS
/* private member variables */ /* private member variables */
@@ -377,7 +381,10 @@ public:
wxAcceleratorTable m_acceleratorTable; wxAcceleratorTable m_acceleratorTable;
wxClientData *m_clientObject; wxClientData *m_clientObject;
void *m_clientData; void *m_clientData;
#if wxUSE_TOOLTIPS
wxToolTip *m_toolTip; wxToolTip *m_toolTip;
#endif // wxUSE_TOOLTIPS
GtkWidget *m_widget; GtkWidget *m_widget;
GtkWidget *m_wxwindow; GtkWidget *m_wxwindow;

View File

@@ -164,6 +164,10 @@
* Use clipboard * Use clipboard
*/ */
#define wxUSE_CLIPBOARD 0 #define wxUSE_CLIPBOARD 0
/*
* Use tooltips
*/
#define wxUSE_TOOLTIPS 0
/* /*
* Use dnd * Use dnd
*/ */

View File

@@ -87,7 +87,8 @@ void wxCheckListBox::Check( int index, bool check )
wxFAIL_MSG("wrong checklistbox index"); wxFAIL_MSG("wrong checklistbox index");
} }
int wxCheckListBox::GetItemHeight() int wxCheckListBox::GetItemHeight() const
{ {
// FIXME
return 22; return 22;
} }

View File

@@ -676,6 +676,7 @@ int wxListBox::GetIndex( GtkWidget *item ) const
return -1; return -1;
} }
#if wxUSE_TOOLTIPS
void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip ) void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip )
{ {
GList *child = m_list->children; GList *child = m_list->children;
@@ -685,6 +686,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip )
child = child->next; child = child->next;
} }
} }
#endif // wxUSE_TOOLTIPS
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
void wxListBox::SetDropTarget( wxDropTarget *dropTarget ) void wxListBox::SetDropTarget( wxDropTarget *dropTarget )

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: tooltip.cpp // Name: tooltip.cpp
// Purpose: // Purpose: wxToolTip implementation
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
@@ -11,6 +11,7 @@
#pragma implementation "tooltip.h" #pragma implementation "tooltip.h"
#endif #endif
#include "wx/window.h"
#include "wx/tooltip.h" #include "wx/tooltip.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
@@ -34,16 +35,6 @@ wxToolTip::wxToolTip( const wxString &tip )
m_window = (wxWindow*) NULL; m_window = (wxWindow*) NULL;
} }
bool wxToolTip::Ok() const
{
return (m_window);
}
wxString wxToolTip::GetTip() const
{
return m_text;
}
void wxToolTip::SetTip( const wxString &tip ) void wxToolTip::SetTip( const wxString &tip )
{ {
m_text = tip; m_text = tip;

View File

@@ -1351,7 +1351,9 @@ wxWindow::wxWindow()
m_isStaticBox = FALSE; m_isStaticBox = FALSE;
m_acceptsFocus = FALSE; m_acceptsFocus = FALSE;
#if wxUSE_TOOLTIPS
m_toolTip = (wxToolTip*) NULL; m_toolTip = (wxToolTip*) NULL;
#endif // wxUSE_TOOLTIPS
} }
wxWindow::wxWindow( wxWindow *parent, wxWindowID id, wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
@@ -1509,10 +1511,12 @@ wxWindow::~wxWindow()
m_hasVMT = FALSE; m_hasVMT = FALSE;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
if (m_dropTarget) delete m_dropTarget; wxDELETE(m_dropTarget);
#endif #endif
if (m_toolTip) delete m_toolTip; #if wxUSE_TOOLTIPS
wxDELETE(m_toolTip);
#endif // wxUSE_TOOLTIPS
if (m_parent) m_parent->RemoveChild( this ); if (m_parent) m_parent->RemoveChild( this );
if (m_widget) Show( FALSE ); if (m_widget) Show( FALSE );
@@ -1643,7 +1647,10 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_clientData = NULL; m_clientData = NULL;
m_isStaticBox = FALSE; m_isStaticBox = FALSE;
#if wxUSE_TOOLTIPS
m_toolTip = (wxToolTip*) NULL; m_toolTip = (wxToolTip*) NULL;
#endif // wxUSE_TOOLTIPS
} }
void wxWindow::PostCreation() void wxWindow::PostCreation()
@@ -2473,6 +2480,7 @@ void wxWindow::Clear()
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window ); if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
} }
#if wxUSE_TOOLTIPS
void wxWindow::SetToolTip( const wxString &tip ) void wxWindow::SetToolTip( const wxString &tip )
{ {
if (m_toolTip) if (m_toolTip)
@@ -2481,15 +2489,11 @@ void wxWindow::SetToolTip( const wxString &tip )
} }
else else
{ {
m_toolTip = new wxToolTip( tip ); SetToolTip( new wxToolTip( tip ) );
m_toolTip->Apply( this );
} }
if (tip.IsEmpty()) // setting empty tooltip text does not remove the tooltip any more for
{ // wxMSW compatibility - use SetToolTip((wxToolTip *)NULL) for this
delete m_toolTip;
m_toolTip = (wxToolTip*) NULL;
}
} }
void wxWindow::SetToolTip( wxToolTip *tip ) void wxWindow::SetToolTip( wxToolTip *tip )
@@ -2502,18 +2506,15 @@ void wxWindow::SetToolTip( wxToolTip *tip )
m_toolTip = tip; m_toolTip = tip;
if (m_toolTip) m_toolTip->Apply( this ); if (m_toolTip)
m_toolTip->Apply( this );
} }
void wxWindow::ApplyToolTip( GtkTooltips *tips, const char *tip ) void wxWindow::ApplyToolTip( GtkTooltips *tips, const char *tip )
{ {
gtk_tooltips_set_tip( tips, GetConnectWidget(), tip, (gchar*) NULL ); gtk_tooltips_set_tip( tips, GetConnectWidget(), tip, (gchar*) NULL );
} }
#endif // wxUSE_TOOLTIPS
wxToolTip* wxWindow::GetToolTip()
{
return m_toolTip;
}
wxColour wxWindow::GetBackgroundColour() const wxColour wxWindow::GetBackgroundColour() const
{ {

View File

@@ -87,7 +87,8 @@ void wxCheckListBox::Check( int index, bool check )
wxFAIL_MSG("wrong checklistbox index"); wxFAIL_MSG("wrong checklistbox index");
} }
int wxCheckListBox::GetItemHeight() int wxCheckListBox::GetItemHeight() const
{ {
// FIXME
return 22; return 22;
} }

View File

@@ -676,6 +676,7 @@ int wxListBox::GetIndex( GtkWidget *item ) const
return -1; return -1;
} }
#if wxUSE_TOOLTIPS
void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip ) void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip )
{ {
GList *child = m_list->children; GList *child = m_list->children;
@@ -685,6 +686,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip )
child = child->next; child = child->next;
} }
} }
#endif // wxUSE_TOOLTIPS
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
void wxListBox::SetDropTarget( wxDropTarget *dropTarget ) void wxListBox::SetDropTarget( wxDropTarget *dropTarget )

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: tooltip.cpp // Name: tooltip.cpp
// Purpose: // Purpose: wxToolTip implementation
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
@@ -11,6 +11,7 @@
#pragma implementation "tooltip.h" #pragma implementation "tooltip.h"
#endif #endif
#include "wx/window.h"
#include "wx/tooltip.h" #include "wx/tooltip.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
@@ -34,16 +35,6 @@ wxToolTip::wxToolTip( const wxString &tip )
m_window = (wxWindow*) NULL; m_window = (wxWindow*) NULL;
} }
bool wxToolTip::Ok() const
{
return (m_window);
}
wxString wxToolTip::GetTip() const
{
return m_text;
}
void wxToolTip::SetTip( const wxString &tip ) void wxToolTip::SetTip( const wxString &tip )
{ {
m_text = tip; m_text = tip;

View File

@@ -1351,7 +1351,9 @@ wxWindow::wxWindow()
m_isStaticBox = FALSE; m_isStaticBox = FALSE;
m_acceptsFocus = FALSE; m_acceptsFocus = FALSE;
#if wxUSE_TOOLTIPS
m_toolTip = (wxToolTip*) NULL; m_toolTip = (wxToolTip*) NULL;
#endif // wxUSE_TOOLTIPS
} }
wxWindow::wxWindow( wxWindow *parent, wxWindowID id, wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
@@ -1509,10 +1511,12 @@ wxWindow::~wxWindow()
m_hasVMT = FALSE; m_hasVMT = FALSE;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
if (m_dropTarget) delete m_dropTarget; wxDELETE(m_dropTarget);
#endif #endif
if (m_toolTip) delete m_toolTip; #if wxUSE_TOOLTIPS
wxDELETE(m_toolTip);
#endif // wxUSE_TOOLTIPS
if (m_parent) m_parent->RemoveChild( this ); if (m_parent) m_parent->RemoveChild( this );
if (m_widget) Show( FALSE ); if (m_widget) Show( FALSE );
@@ -1643,7 +1647,10 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_clientData = NULL; m_clientData = NULL;
m_isStaticBox = FALSE; m_isStaticBox = FALSE;
#if wxUSE_TOOLTIPS
m_toolTip = (wxToolTip*) NULL; m_toolTip = (wxToolTip*) NULL;
#endif // wxUSE_TOOLTIPS
} }
void wxWindow::PostCreation() void wxWindow::PostCreation()
@@ -2473,6 +2480,7 @@ void wxWindow::Clear()
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window ); if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
} }
#if wxUSE_TOOLTIPS
void wxWindow::SetToolTip( const wxString &tip ) void wxWindow::SetToolTip( const wxString &tip )
{ {
if (m_toolTip) if (m_toolTip)
@@ -2481,15 +2489,11 @@ void wxWindow::SetToolTip( const wxString &tip )
} }
else else
{ {
m_toolTip = new wxToolTip( tip ); SetToolTip( new wxToolTip( tip ) );
m_toolTip->Apply( this );
} }
if (tip.IsEmpty()) // setting empty tooltip text does not remove the tooltip any more for
{ // wxMSW compatibility - use SetToolTip((wxToolTip *)NULL) for this
delete m_toolTip;
m_toolTip = (wxToolTip*) NULL;
}
} }
void wxWindow::SetToolTip( wxToolTip *tip ) void wxWindow::SetToolTip( wxToolTip *tip )
@@ -2502,18 +2506,15 @@ void wxWindow::SetToolTip( wxToolTip *tip )
m_toolTip = tip; m_toolTip = tip;
if (m_toolTip) m_toolTip->Apply( this ); if (m_toolTip)
m_toolTip->Apply( this );
} }
void wxWindow::ApplyToolTip( GtkTooltips *tips, const char *tip ) void wxWindow::ApplyToolTip( GtkTooltips *tips, const char *tip )
{ {
gtk_tooltips_set_tip( tips, GetConnectWidget(), tip, (gchar*) NULL ); gtk_tooltips_set_tip( tips, GetConnectWidget(), tip, (gchar*) NULL );
} }
#endif // wxUSE_TOOLTIPS
wxToolTip* wxWindow::GetToolTip()
{
return m_toolTip;
}
wxColour wxWindow::GetBackgroundColour() const wxColour wxWindow::GetBackgroundColour() const
{ {