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

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -38,31 +38,30 @@ extern const char *wxCheckBoxNameStr;
class wxCheckBox: public wxControl 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,
const wxString& name = wxCheckBoxNameStr) const wxString& name = wxCheckBoxNameStr)
{ {
Create(parent, id, label, pos, size, style, validator, name); Create(parent, id, label, pos, size, style, validator, name);
} }
bool Create( wxWindow *parent, wxWindowID id, const wxString& label, bool Create( 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,
const wxString& name = wxCheckBoxNameStr ); const wxString& name = wxCheckBoxNameStr );
void SetValue( bool state ); void SetValue( bool state );
bool GetValue() const; bool GetValue() const;
void SetLabel( const wxString& label ); void SetLabel( const wxString& label );
void Enable( bool enable ); void Enable( bool enable );
// implementation // implementation
void ApplyWidgetStyle(); void ApplyWidgetStyle();

View File

@@ -33,24 +33,23 @@ class wxCheckListBox;
class wxCheckListBox : public wxListBox class wxCheckListBox : public wxListBox
{ {
DECLARE_DYNAMIC_CLASS(wxCheckListBox) DECLARE_DYNAMIC_CLASS(wxCheckListBox)
public: public:
wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = (wxString[]) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr);
wxCheckListBox(); bool IsChecked( int index ) const;
wxCheckListBox(wxWindow *parent, wxWindowID id, void Check( int index, bool check = TRUE );
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = (wxString[]) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr);
bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE );
int GetItemHeight();
int GetItemHeight() const;
}; };
#endif #endif

View File

@@ -1,10 +1,10 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -39,75 +39,78 @@ extern const char *wxListBoxNameStr;
class wxListBox : public wxControl class wxListBox : public wxControl
{ {
DECLARE_DYNAMIC_CLASS(wxListBox) DECLARE_DYNAMIC_CLASS(wxListBox)
public: public:
wxListBox();
wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name);
}
virtual ~wxListBox();
wxListBox(); bool Create(wxWindow *parent, wxWindowID id,
inline 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, long style = 0,
long style = 0, const wxValidator& validator = wxDefaultValidator,
const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr);
const wxString& name = wxListBoxNameStr )
{
m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name);
}
~wxListBox();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr );
void Append( const wxString &item ); void Append( const wxString &item );
void Append( const wxString &item, void* clientData ); void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData ); void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData ); void SetClientData( int n, void* clientData );
void* GetClientData( int n ); void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData ); void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n ); wxClientData* GetClientObject( int n );
void Clear(); void Clear();
void Delete( int n ); void Delete( int n );
void Deselect( int n ); void Deselect( int n );
int FindString( const wxString &item ) const; int FindString( const wxString &item ) const;
int GetSelection(void) const; int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const; int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const; wxString GetString( int n ) const;
wxString GetStringSelection(void) const; wxString GetStringSelection(void) const;
int Number(); int Number();
bool Selected( int n ); bool Selected( int n );
void Set( int n, const wxString *choices ); void Set( int n, const wxString *choices );
void SetFirstItem( int n ); void SetFirstItem( int n );
void SetFirstItem( const wxString &item ); void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE ); void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string ); void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE ); void SetStringSelection( const wxString &string, bool select = TRUE );
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
void SetDropTarget( wxDropTarget *dropTarget ); void SetDropTarget( wxDropTarget *dropTarget );
#endif #endif
// implementation // implementation
void AppendCommon( const wxString &item ); void AppendCommon( const wxString &item );
int GetIndex( GtkWidget *item ) const; int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget(); GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window ); bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle(); void ApplyWidgetStyle();
void ApplyToolTip( GtkTooltips *tips, const char *tip );
GtkList *m_list; #if wxUSE_TOOLTIPS
wxList m_clientDataList; void ApplyToolTip( GtkTooltips *tips, const char *tip );
wxList m_clientObjectList; #endif // wxUSE_TOOLTIPS
bool m_hasCheckBoxes;
GtkList *m_list;
wxList m_clientDataList;
wxList m_clientObjectList;
bool m_hasCheckBoxes;
}; };
#endif // __GTKLISTBOXH__ #endif // __GTKLISTBOXH__

View File

@@ -1,53 +1,56 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKTOOLTIPH__ #ifndef __GTKTOOLTIPH__
#define __GTKTOOLTIPH__ #define __GTKTOOLTIPH__
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#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
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
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

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -38,31 +38,30 @@ extern const char *wxCheckBoxNameStr;
class wxCheckBox: public wxControl 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,
const wxString& name = wxCheckBoxNameStr) const wxString& name = wxCheckBoxNameStr)
{ {
Create(parent, id, label, pos, size, style, validator, name); Create(parent, id, label, pos, size, style, validator, name);
} }
bool Create( wxWindow *parent, wxWindowID id, const wxString& label, bool Create( 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,
const wxString& name = wxCheckBoxNameStr ); const wxString& name = wxCheckBoxNameStr );
void SetValue( bool state ); void SetValue( bool state );
bool GetValue() const; bool GetValue() const;
void SetLabel( const wxString& label ); void SetLabel( const wxString& label );
void Enable( bool enable ); void Enable( bool enable );
// implementation // implementation
void ApplyWidgetStyle(); void ApplyWidgetStyle();

View File

@@ -33,24 +33,23 @@ class wxCheckListBox;
class wxCheckListBox : public wxListBox class wxCheckListBox : public wxListBox
{ {
DECLARE_DYNAMIC_CLASS(wxCheckListBox) DECLARE_DYNAMIC_CLASS(wxCheckListBox)
public: public:
wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = (wxString[]) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr);
wxCheckListBox(); bool IsChecked( int index ) const;
wxCheckListBox(wxWindow *parent, wxWindowID id, void Check( int index, bool check = TRUE );
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = (wxString[]) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr);
bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE );
int GetItemHeight();
int GetItemHeight() const;
}; };
#endif #endif

View File

@@ -1,10 +1,10 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -39,75 +39,78 @@ extern const char *wxListBoxNameStr;
class wxListBox : public wxControl class wxListBox : public wxControl
{ {
DECLARE_DYNAMIC_CLASS(wxListBox) DECLARE_DYNAMIC_CLASS(wxListBox)
public: public:
wxListBox();
wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name);
}
virtual ~wxListBox();
wxListBox(); bool Create(wxWindow *parent, wxWindowID id,
inline 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, long style = 0,
long style = 0, const wxValidator& validator = wxDefaultValidator,
const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr);
const wxString& name = wxListBoxNameStr )
{
m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name);
}
~wxListBox();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr );
void Append( const wxString &item ); void Append( const wxString &item );
void Append( const wxString &item, void* clientData ); void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData ); void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData ); void SetClientData( int n, void* clientData );
void* GetClientData( int n ); void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData ); void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n ); wxClientData* GetClientObject( int n );
void Clear(); void Clear();
void Delete( int n ); void Delete( int n );
void Deselect( int n ); void Deselect( int n );
int FindString( const wxString &item ) const; int FindString( const wxString &item ) const;
int GetSelection(void) const; int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const; int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const; wxString GetString( int n ) const;
wxString GetStringSelection(void) const; wxString GetStringSelection(void) const;
int Number(); int Number();
bool Selected( int n ); bool Selected( int n );
void Set( int n, const wxString *choices ); void Set( int n, const wxString *choices );
void SetFirstItem( int n ); void SetFirstItem( int n );
void SetFirstItem( const wxString &item ); void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE ); void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string ); void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE ); void SetStringSelection( const wxString &string, bool select = TRUE );
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
void SetDropTarget( wxDropTarget *dropTarget ); void SetDropTarget( wxDropTarget *dropTarget );
#endif #endif
// implementation // implementation
void AppendCommon( const wxString &item ); void AppendCommon( const wxString &item );
int GetIndex( GtkWidget *item ) const; int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget(); GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window ); bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle(); void ApplyWidgetStyle();
void ApplyToolTip( GtkTooltips *tips, const char *tip );
GtkList *m_list; #if wxUSE_TOOLTIPS
wxList m_clientDataList; void ApplyToolTip( GtkTooltips *tips, const char *tip );
wxList m_clientObjectList; #endif // wxUSE_TOOLTIPS
bool m_hasCheckBoxes;
GtkList *m_list;
wxList m_clientDataList;
wxList m_clientObjectList;
bool m_hasCheckBoxes;
}; };
#endif // __GTKLISTBOXH__ #endif // __GTKLISTBOXH__

View File

@@ -1,53 +1,56 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKTOOLTIPH__ #ifndef __GTKTOOLTIPH__
#define __GTKTOOLTIPH__ #define __GTKTOOLTIPH__
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#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
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
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

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -51,7 +51,7 @@ bool wxCheckListBox::IsChecked( int index ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
return (str[1] == 'X'); return (str[1] == 'X');
} }
@@ -70,24 +70,25 @@ void wxCheckListBox::Check( int index, bool check )
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (check == (str[1] == 'X')) return; if (check == (str[1] == 'X')) return;
if (check) if (check)
str.SetChar( 1, 'X' ); str.SetChar( 1, 'X' );
else else
str.SetChar( 1, '-' ); str.SetChar( 1, '-' );
gtk_label_set( label, str ); gtk_label_set( label, str );
return; return;
} }
wxFAIL_MSG("wrong checklistbox index"); wxFAIL_MSG("wrong checklistbox index");
} }
int wxCheckListBox::GetItemHeight() int wxCheckListBox::GetItemHeight() const
{ {
// FIXME
return 22; return 22;
} }

View File

@@ -233,16 +233,16 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
GtkWidget *list_item; GtkWidget *list_item;
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
wxString str = "[-] "; wxString str = "[-] ";
str += choices[i]; str += choices[i];
list_item = gtk_list_item_new_with_label( str ); list_item = gtk_list_item_new_with_label( str );
} }
else else
{ {
list_item = gtk_list_item_new_with_label( choices[i] ); list_item = gtk_list_item_new_with_label( choices[i] );
} }
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
debug_focus_in( list_item, "wxListBox::list_item", name ); debug_focus_in( list_item, "wxListBox::list_item", name );
@@ -258,17 +258,17 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event", "button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback, (GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this ); (gpointer) this );
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"key_press_event", "key_press_event",
(GtkSignalFunc)gtk_listbox_key_press_callback, (GtkSignalFunc)gtk_listbox_key_press_callback,
(gpointer)this ); (gpointer)this );
} }
ConnectWidget( list_item ); ConnectWidget( list_item );
@@ -305,7 +305,7 @@ void wxListBox::AppendCommon( const wxString &item )
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
wxString str = "[-] "; wxString str = "[-] ";
str += item; str += item;
list_item = gtk_list_item_new_with_label( str ); list_item = gtk_list_item_new_with_label( str );
} }
else else
@@ -325,16 +325,16 @@ void wxListBox::AppendCommon( const wxString &item )
if (m_widgetStyle) ApplyWidgetStyle(); if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event", "button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback, (GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this ); (gpointer) this );
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"key_press_event", "key_press_event",
(GtkSignalFunc)gtk_listbox_key_press_callback, (GtkSignalFunc)gtk_listbox_key_press_callback,
(gpointer)this ); (gpointer)this );
} }
gtk_widget_show( list_item ); gtk_widget_show( list_item );
@@ -480,8 +480,8 @@ int wxListBox::FindString( const wxString &item ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 ); if (m_hasCheckBoxes) str.Remove( 0, 4 );
if (str == item) return count; if (str == item) return count;
@@ -549,8 +549,8 @@ wxString wxListBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 ); if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str; return str;
} }
@@ -568,8 +568,8 @@ wxString wxListBox::GetStringSelection() const
GtkBin *bin = GTK_BIN( selection->data ); GtkBin *bin = GTK_BIN( selection->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 ); if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str; return str;
} }
@@ -641,9 +641,9 @@ void wxListBox::SetString( int n, const wxString &string )
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str; wxString str;
if (m_hasCheckBoxes) str += "[-] "; if (m_hasCheckBoxes) str += "[-] ";
str += string; str += string;
gtk_label_set( label, str ); gtk_label_set( label, str );
} }
@@ -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 )
@@ -697,7 +699,7 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
GList *child = m_list->children; GList *child = m_list->children;
while (child) while (child)
{ {
m_dropTarget->UnregisterWidget( GTK_WIDGET( child->data ) ); m_dropTarget->UnregisterWidget( GTK_WIDGET( child->data ) );
child = child->next; child = child->next;
} }
} }
@@ -711,7 +713,7 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
GList *child = m_list->children; GList *child = m_list->children;
while (child) while (child)
{ {
m_dropTarget->RegisterWidget( GTK_WIDGET( child->data ) ); m_dropTarget->RegisterWidget( GTK_WIDGET( child->data ) );
child = child->next; child = child->next;
} }
} }

View File

@@ -1,16 +1,17 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#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;
@@ -68,7 +59,7 @@ void wxToolTip::Apply( wxWindow *win )
ss_bg.blue = 50000; ss_bg.blue = 50000;
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg ); gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg );
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg ); gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
} }
m_window = win; m_window = win;

View File

@@ -134,7 +134,7 @@
static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget), static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
GdkEvent *WXUNUSED(event), GdkEvent *WXUNUSED(event),
const char *name ) const char *name )
{ {
printf( "FOCUS NOW AT: " ); printf( "FOCUS NOW AT: " );
printf( name ); printf( name );
@@ -351,9 +351,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
{ {
wxNavigationKeyEvent new_event; wxNavigationKeyEvent new_event;
new_event.SetDirection( !(gdk_event->state & GDK_SHIFT_MASK) ); new_event.SetDirection( !(gdk_event->state & GDK_SHIFT_MASK) );
new_event.SetWindowChange( FALSE ); new_event.SetWindowChange( FALSE );
new_event.SetCurrentFocus( win ); new_event.SetCurrentFocus( win );
ret = win->GetEventHandler()->ProcessEvent( new_event ); ret = win->GetEventHandler()->ProcessEvent( new_event );
} }
/* /*
@@ -362,7 +362,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
(gdk_event->keyval == GDK_Up)) (gdk_event->keyval == GDK_Up))
{ {
win->m_parent->SetFocus(); win->m_parent->SetFocus();
ret = TRUE; ret = TRUE;
} }
// win is a panel: left/right can be propagated to the panel // win is a panel: left/right can be propagated to the panel
@@ -373,7 +373,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
wxNavigationKeyEvent new_event; wxNavigationKeyEvent new_event;
new_event.SetDirection( (gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Down) ); new_event.SetDirection( (gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Down) );
new_event.SetCurrentFocus( win ); new_event.SetCurrentFocus( win );
ret = win->GetEventHandler()->ProcessEvent( new_event ); ret = win->GetEventHandler()->ProcessEvent( new_event );
} }
*/ */
@@ -589,36 +589,36 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox) if (child->m_isStaticBox)
{ {
// wxStaticBox is transparent in the box itself // wxStaticBox is transparent in the box itself
int x = event.m_x; int x = event.m_x;
int y = event.m_y; int y = event.m_y;
int xx1 = child->m_x; int xx1 = child->m_x;
int yy1 = child->m_y; int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width; int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height; int yy2 = child->m_x + child->m_height;
// left // left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) || if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right // right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) || ((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top // top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) || ((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom // bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2))) ((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{ {
win = child; win = child;
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
else else
{ {
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
(child->m_x+child->m_width >= event.m_x) && (child->m_x+child->m_width >= event.m_x) &&
(child->m_y+child->m_height >= event.m_y)) (child->m_y+child->m_height >= event.m_y))
@@ -627,7 +627,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
node = node->Next(); node = node->Next();
} }
@@ -697,36 +697,36 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox) if (child->m_isStaticBox)
{ {
// wxStaticBox is transparent in the box itself // wxStaticBox is transparent in the box itself
int x = event.m_x; int x = event.m_x;
int y = event.m_y; int y = event.m_y;
int xx1 = child->m_x; int xx1 = child->m_x;
int yy1 = child->m_y; int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width; int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height; int yy2 = child->m_x + child->m_height;
// left // left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) || if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right // right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) || ((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top // top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) || ((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom // bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2))) ((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{ {
win = child; win = child;
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
else else
{ {
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
(child->m_x+child->m_width >= event.m_x) && (child->m_x+child->m_width >= event.m_x) &&
(child->m_y+child->m_height >= event.m_y)) (child->m_y+child->m_height >= event.m_y))
@@ -735,7 +735,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
node = node->Next(); node = node->Next();
} }
@@ -806,36 +806,36 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox) if (child->m_isStaticBox)
{ {
// wxStaticBox is transparent in the box itself // wxStaticBox is transparent in the box itself
int x = event.m_x; int x = event.m_x;
int y = event.m_y; int y = event.m_y;
int xx1 = child->m_x; int xx1 = child->m_x;
int yy1 = child->m_y; int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width; int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height; int yy2 = child->m_x + child->m_height;
// left // left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) || if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right // right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) || ((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top // top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) || ((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom // bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2))) ((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{ {
win = child; win = child;
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
else else
{ {
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
(child->m_x+child->m_width >= event.m_x) && (child->m_x+child->m_width >= event.m_x) &&
(child->m_y+child->m_height >= event.m_y)) (child->m_y+child->m_height >= event.m_y))
@@ -844,7 +844,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
node = node->Next(); node = node->Next();
} }
@@ -1191,7 +1191,7 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget), static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can release the mouse while being over // don't test here as we can release the mouse while being over
// a different window then the slider // a different window then the slider
@@ -1210,7 +1210,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
static gint gtk_scrollbar_button_release_callback( GtkRange *widget, static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can release the mouse while being over // don't test here as we can release the mouse while being over
@@ -1246,12 +1246,12 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{ {
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow), gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget), GTK_WIDGET(child->m_widget),
child->m_x, child->m_x,
child->m_y ); child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget), gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width, child->m_width,
child->m_height ); child->m_height );
if (wxIS_KIND_OF(parent,wxFrame)) if (wxIS_KIND_OF(parent,wxFrame))
{ {
@@ -1261,7 +1261,7 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
if (parent->m_windowStyle & wxTAB_TRAVERSAL) if (parent->m_windowStyle & wxTAB_TRAVERSAL)
{ {
/* we now allow a window to get the focus as long as it /* we now allow a window to get the focus as long as it
doesn't have any children. */ doesn't have any children. */
GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
} }
} }
@@ -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,
@@ -1431,7 +1433,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
if (m_windowStyle & wxTAB_TRAVERSAL) if (m_windowStyle & wxTAB_TRAVERSAL)
{ {
/* we now allow a window to get the focus as long as it /* we now allow a window to get the focus as long as it
doesn't have any children. */ doesn't have any children. */
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
m_acceptsFocus = FALSE; m_acceptsFocus = FALSE;
} }
@@ -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()
@@ -2208,13 +2215,13 @@ void wxWindow::SetFocus()
{ {
gtk_widget_grab_focus (connect_widget); gtk_widget_grab_focus (connect_widget);
} }
else if (GTK_IS_CONTAINER(connect_widget)) else if (GTK_IS_CONTAINER(connect_widget))
{ {
gtk_container_focus( GTK_CONTAINER(connect_widget), GTK_DIR_TAB_FORWARD ); gtk_container_focus( GTK_CONTAINER(connect_widget), GTK_DIR_TAB_FORWARD );
} }
else else
{ {
} }
} }
} }
@@ -2423,7 +2430,7 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
if (m_wxwindow) if (m_wxwindow)
gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL ); gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL );
else else
gtk_widget_draw( m_widget, (GdkRectangle*) NULL ); gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
} }
else else
@@ -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
{ {
@@ -2544,7 +2545,7 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
{ {
m_backgroundColour = wxNullColour; m_backgroundColour = wxNullColour;
ApplyWidgetStyle(); ApplyWidgetStyle();
m_backgroundColour = sysbg; m_backgroundColour = sysbg;
} }
else else
{ {
@@ -2573,7 +2574,7 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
{ {
m_backgroundColour = wxNullColour; m_backgroundColour = wxNullColour;
ApplyWidgetStyle(); ApplyWidgetStyle();
m_backgroundColour = sysbg; m_backgroundColour = sysbg;
} }
else else
{ {
@@ -2635,8 +2636,8 @@ bool wxWindow::Validate()
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this)) if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this))
{ {
return FALSE; return FALSE;
} }
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2671,8 +2672,8 @@ bool wxWindow::TransferDataFromWindow()
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() ) if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() )
{ {
return FALSE; return FALSE;
} }
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2706,8 +2707,8 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
wxMenuItem *menuitem = (wxMenuItem*)node->Data(); wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (menuitem->IsSubMenu()) if (menuitem->IsSubMenu())
{ {
SetInvokingWindow( menuitem->GetSubMenu(), win ); SetInvokingWindow( menuitem->GetSubMenu(), win );
} }
node = node->Next(); node = node->Next();
} }
} }
@@ -2798,7 +2799,7 @@ void wxWindow::SetFont( const wxFont &font )
{ {
m_backgroundColour = wxNullColour; m_backgroundColour = wxNullColour;
ApplyWidgetStyle(); ApplyWidgetStyle();
m_backgroundColour = sysbg; m_backgroundColour = sysbg;
} }
else else
{ {
@@ -2830,8 +2831,8 @@ void wxWindow::CaptureMouse()
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK), GDK_POINTER_MOTION_MASK),
(GdkWindow *) NULL, (GdkWindow *) NULL,
(GdkCursor *) NULL, (GdkCursor *) NULL,
GDK_CURRENT_TIME ); GDK_CURRENT_TIME );
g_capturing = TRUE; g_capturing = TRUE;
} }
@@ -3409,7 +3410,7 @@ void wxWindow::SetConstraintSizes(bool recurse)
winName = GetName(); winName = GetName();
wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n", wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n",
(const char *)windowClass, (const char *)windowClass,
(const char *)winName); (const char *)winName);
if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" ); if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" );
if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" ); if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" );
if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" ); if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" );

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -51,7 +51,7 @@ bool wxCheckListBox::IsChecked( int index ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
return (str[1] == 'X'); return (str[1] == 'X');
} }
@@ -70,24 +70,25 @@ void wxCheckListBox::Check( int index, bool check )
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (check == (str[1] == 'X')) return; if (check == (str[1] == 'X')) return;
if (check) if (check)
str.SetChar( 1, 'X' ); str.SetChar( 1, 'X' );
else else
str.SetChar( 1, '-' ); str.SetChar( 1, '-' );
gtk_label_set( label, str ); gtk_label_set( label, str );
return; return;
} }
wxFAIL_MSG("wrong checklistbox index"); wxFAIL_MSG("wrong checklistbox index");
} }
int wxCheckListBox::GetItemHeight() int wxCheckListBox::GetItemHeight() const
{ {
// FIXME
return 22; return 22;
} }

View File

@@ -233,16 +233,16 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
GtkWidget *list_item; GtkWidget *list_item;
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
wxString str = "[-] "; wxString str = "[-] ";
str += choices[i]; str += choices[i];
list_item = gtk_list_item_new_with_label( str ); list_item = gtk_list_item_new_with_label( str );
} }
else else
{ {
list_item = gtk_list_item_new_with_label( choices[i] ); list_item = gtk_list_item_new_with_label( choices[i] );
} }
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
debug_focus_in( list_item, "wxListBox::list_item", name ); debug_focus_in( list_item, "wxListBox::list_item", name );
@@ -258,17 +258,17 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event", "button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback, (GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this ); (gpointer) this );
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"key_press_event", "key_press_event",
(GtkSignalFunc)gtk_listbox_key_press_callback, (GtkSignalFunc)gtk_listbox_key_press_callback,
(gpointer)this ); (gpointer)this );
} }
ConnectWidget( list_item ); ConnectWidget( list_item );
@@ -305,7 +305,7 @@ void wxListBox::AppendCommon( const wxString &item )
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
wxString str = "[-] "; wxString str = "[-] ";
str += item; str += item;
list_item = gtk_list_item_new_with_label( str ); list_item = gtk_list_item_new_with_label( str );
} }
else else
@@ -325,16 +325,16 @@ void wxListBox::AppendCommon( const wxString &item )
if (m_widgetStyle) ApplyWidgetStyle(); if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event", "button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback, (GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this ); (gpointer) this );
if (m_hasCheckBoxes) if (m_hasCheckBoxes)
{ {
gtk_signal_connect( GTK_OBJECT(list_item), gtk_signal_connect( GTK_OBJECT(list_item),
"key_press_event", "key_press_event",
(GtkSignalFunc)gtk_listbox_key_press_callback, (GtkSignalFunc)gtk_listbox_key_press_callback,
(gpointer)this ); (gpointer)this );
} }
gtk_widget_show( list_item ); gtk_widget_show( list_item );
@@ -480,8 +480,8 @@ int wxListBox::FindString( const wxString &item ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 ); if (m_hasCheckBoxes) str.Remove( 0, 4 );
if (str == item) return count; if (str == item) return count;
@@ -549,8 +549,8 @@ wxString wxListBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 ); if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str; return str;
} }
@@ -568,8 +568,8 @@ wxString wxListBox::GetStringSelection() const
GtkBin *bin = GTK_BIN( selection->data ); GtkBin *bin = GTK_BIN( selection->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label; wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 ); if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str; return str;
} }
@@ -641,9 +641,9 @@ void wxListBox::SetString( int n, const wxString &string )
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
wxString str; wxString str;
if (m_hasCheckBoxes) str += "[-] "; if (m_hasCheckBoxes) str += "[-] ";
str += string; str += string;
gtk_label_set( label, str ); gtk_label_set( label, str );
} }
@@ -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 )
@@ -697,7 +699,7 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
GList *child = m_list->children; GList *child = m_list->children;
while (child) while (child)
{ {
m_dropTarget->UnregisterWidget( GTK_WIDGET( child->data ) ); m_dropTarget->UnregisterWidget( GTK_WIDGET( child->data ) );
child = child->next; child = child->next;
} }
} }
@@ -711,7 +713,7 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
GList *child = m_list->children; GList *child = m_list->children;
while (child) while (child)
{ {
m_dropTarget->RegisterWidget( GTK_WIDGET( child->data ) ); m_dropTarget->RegisterWidget( GTK_WIDGET( child->data ) );
child = child->next; child = child->next;
} }
} }

View File

@@ -1,16 +1,17 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#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;
@@ -68,7 +59,7 @@ void wxToolTip::Apply( wxWindow *win )
ss_bg.blue = 50000; ss_bg.blue = 50000;
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg ); gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg );
gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg ); gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );
} }
m_window = win; m_window = win;

View File

@@ -134,7 +134,7 @@
static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget), static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
GdkEvent *WXUNUSED(event), GdkEvent *WXUNUSED(event),
const char *name ) const char *name )
{ {
printf( "FOCUS NOW AT: " ); printf( "FOCUS NOW AT: " );
printf( name ); printf( name );
@@ -351,9 +351,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
{ {
wxNavigationKeyEvent new_event; wxNavigationKeyEvent new_event;
new_event.SetDirection( !(gdk_event->state & GDK_SHIFT_MASK) ); new_event.SetDirection( !(gdk_event->state & GDK_SHIFT_MASK) );
new_event.SetWindowChange( FALSE ); new_event.SetWindowChange( FALSE );
new_event.SetCurrentFocus( win ); new_event.SetCurrentFocus( win );
ret = win->GetEventHandler()->ProcessEvent( new_event ); ret = win->GetEventHandler()->ProcessEvent( new_event );
} }
/* /*
@@ -362,7 +362,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
(gdk_event->keyval == GDK_Up)) (gdk_event->keyval == GDK_Up))
{ {
win->m_parent->SetFocus(); win->m_parent->SetFocus();
ret = TRUE; ret = TRUE;
} }
// win is a panel: left/right can be propagated to the panel // win is a panel: left/right can be propagated to the panel
@@ -373,7 +373,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
wxNavigationKeyEvent new_event; wxNavigationKeyEvent new_event;
new_event.SetDirection( (gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Down) ); new_event.SetDirection( (gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Down) );
new_event.SetCurrentFocus( win ); new_event.SetCurrentFocus( win );
ret = win->GetEventHandler()->ProcessEvent( new_event ); ret = win->GetEventHandler()->ProcessEvent( new_event );
} }
*/ */
@@ -589,36 +589,36 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox) if (child->m_isStaticBox)
{ {
// wxStaticBox is transparent in the box itself // wxStaticBox is transparent in the box itself
int x = event.m_x; int x = event.m_x;
int y = event.m_y; int y = event.m_y;
int xx1 = child->m_x; int xx1 = child->m_x;
int yy1 = child->m_y; int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width; int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height; int yy2 = child->m_x + child->m_height;
// left // left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) || if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right // right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) || ((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top // top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) || ((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom // bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2))) ((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{ {
win = child; win = child;
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
else else
{ {
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
(child->m_x+child->m_width >= event.m_x) && (child->m_x+child->m_width >= event.m_x) &&
(child->m_y+child->m_height >= event.m_y)) (child->m_y+child->m_height >= event.m_y))
@@ -627,7 +627,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
node = node->Next(); node = node->Next();
} }
@@ -697,36 +697,36 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox) if (child->m_isStaticBox)
{ {
// wxStaticBox is transparent in the box itself // wxStaticBox is transparent in the box itself
int x = event.m_x; int x = event.m_x;
int y = event.m_y; int y = event.m_y;
int xx1 = child->m_x; int xx1 = child->m_x;
int yy1 = child->m_y; int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width; int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height; int yy2 = child->m_x + child->m_height;
// left // left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) || if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right // right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) || ((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top // top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) || ((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom // bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2))) ((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{ {
win = child; win = child;
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
else else
{ {
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
(child->m_x+child->m_width >= event.m_x) && (child->m_x+child->m_width >= event.m_x) &&
(child->m_y+child->m_height >= event.m_y)) (child->m_y+child->m_height >= event.m_y))
@@ -735,7 +735,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
node = node->Next(); node = node->Next();
} }
@@ -806,36 +806,36 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
{ {
wxWindow *child = (wxWindow*)node->Data(); wxWindow *child = (wxWindow*)node->Data();
if (child->m_isStaticBox) if (child->m_isStaticBox)
{ {
// wxStaticBox is transparent in the box itself // wxStaticBox is transparent in the box itself
int x = event.m_x; int x = event.m_x;
int y = event.m_y; int y = event.m_y;
int xx1 = child->m_x; int xx1 = child->m_x;
int yy1 = child->m_y; int yy1 = child->m_y;
int xx2 = child->m_x + child->m_width; int xx2 = child->m_x + child->m_width;
int yy2 = child->m_x + child->m_height; int yy2 = child->m_x + child->m_height;
// left // left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) || if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
// right // right
((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) || ((x >= xx2-10) && (x <= xx2) && (y >= yy1) && (y <= yy2)) ||
// top // top
((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) || ((x >= xx1) && (x <= xx2) && (y >= yy1) && (y <= yy1+10)) ||
// bottom // bottom
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2))) ((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{ {
win = child; win = child;
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
else else
{ {
if ((child->m_wxwindow == (GtkWidget*) NULL) && if ((child->m_wxwindow == (GtkWidget*) NULL) &&
(child->m_x <= event.m_x) && (child->m_x <= event.m_x) &&
(child->m_y <= event.m_y) && (child->m_y <= event.m_y) &&
(child->m_x+child->m_width >= event.m_x) && (child->m_x+child->m_width >= event.m_x) &&
(child->m_y+child->m_height >= event.m_y)) (child->m_y+child->m_height >= event.m_y))
@@ -844,7 +844,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
event.m_x -= child->m_x; event.m_x -= child->m_x;
event.m_y -= child->m_y; event.m_y -= child->m_y;
break; break;
} }
} }
node = node->Next(); node = node->Next();
} }
@@ -1191,7 +1191,7 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget), static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can release the mouse while being over // don't test here as we can release the mouse while being over
// a different window then the slider // a different window then the slider
@@ -1210,7 +1210,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
static gint gtk_scrollbar_button_release_callback( GtkRange *widget, static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// don't test here as we can release the mouse while being over // don't test here as we can release the mouse while being over
@@ -1246,12 +1246,12 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{ {
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow), gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget), GTK_WIDGET(child->m_widget),
child->m_x, child->m_x,
child->m_y ); child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget), gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width, child->m_width,
child->m_height ); child->m_height );
if (wxIS_KIND_OF(parent,wxFrame)) if (wxIS_KIND_OF(parent,wxFrame))
{ {
@@ -1261,7 +1261,7 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
if (parent->m_windowStyle & wxTAB_TRAVERSAL) if (parent->m_windowStyle & wxTAB_TRAVERSAL)
{ {
/* we now allow a window to get the focus as long as it /* we now allow a window to get the focus as long as it
doesn't have any children. */ doesn't have any children. */
GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
} }
} }
@@ -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,
@@ -1431,7 +1433,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
if (m_windowStyle & wxTAB_TRAVERSAL) if (m_windowStyle & wxTAB_TRAVERSAL)
{ {
/* we now allow a window to get the focus as long as it /* we now allow a window to get the focus as long as it
doesn't have any children. */ doesn't have any children. */
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
m_acceptsFocus = FALSE; m_acceptsFocus = FALSE;
} }
@@ -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()
@@ -2208,13 +2215,13 @@ void wxWindow::SetFocus()
{ {
gtk_widget_grab_focus (connect_widget); gtk_widget_grab_focus (connect_widget);
} }
else if (GTK_IS_CONTAINER(connect_widget)) else if (GTK_IS_CONTAINER(connect_widget))
{ {
gtk_container_focus( GTK_CONTAINER(connect_widget), GTK_DIR_TAB_FORWARD ); gtk_container_focus( GTK_CONTAINER(connect_widget), GTK_DIR_TAB_FORWARD );
} }
else else
{ {
} }
} }
} }
@@ -2423,7 +2430,7 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
if (m_wxwindow) if (m_wxwindow)
gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL ); gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL );
else else
gtk_widget_draw( m_widget, (GdkRectangle*) NULL ); gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
} }
else else
@@ -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
{ {
@@ -2544,7 +2545,7 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
{ {
m_backgroundColour = wxNullColour; m_backgroundColour = wxNullColour;
ApplyWidgetStyle(); ApplyWidgetStyle();
m_backgroundColour = sysbg; m_backgroundColour = sysbg;
} }
else else
{ {
@@ -2573,7 +2574,7 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
{ {
m_backgroundColour = wxNullColour; m_backgroundColour = wxNullColour;
ApplyWidgetStyle(); ApplyWidgetStyle();
m_backgroundColour = sysbg; m_backgroundColour = sysbg;
} }
else else
{ {
@@ -2635,8 +2636,8 @@ bool wxWindow::Validate()
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this)) if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this))
{ {
return FALSE; return FALSE;
} }
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2671,8 +2672,8 @@ bool wxWindow::TransferDataFromWindow()
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();
if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() ) if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() )
{ {
return FALSE; return FALSE;
} }
node = node->Next(); node = node->Next();
} }
return TRUE; return TRUE;
@@ -2706,8 +2707,8 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
wxMenuItem *menuitem = (wxMenuItem*)node->Data(); wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (menuitem->IsSubMenu()) if (menuitem->IsSubMenu())
{ {
SetInvokingWindow( menuitem->GetSubMenu(), win ); SetInvokingWindow( menuitem->GetSubMenu(), win );
} }
node = node->Next(); node = node->Next();
} }
} }
@@ -2798,7 +2799,7 @@ void wxWindow::SetFont( const wxFont &font )
{ {
m_backgroundColour = wxNullColour; m_backgroundColour = wxNullColour;
ApplyWidgetStyle(); ApplyWidgetStyle();
m_backgroundColour = sysbg; m_backgroundColour = sysbg;
} }
else else
{ {
@@ -2830,8 +2831,8 @@ void wxWindow::CaptureMouse()
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK), GDK_POINTER_MOTION_MASK),
(GdkWindow *) NULL, (GdkWindow *) NULL,
(GdkCursor *) NULL, (GdkCursor *) NULL,
GDK_CURRENT_TIME ); GDK_CURRENT_TIME );
g_capturing = TRUE; g_capturing = TRUE;
} }
@@ -3409,7 +3410,7 @@ void wxWindow::SetConstraintSizes(bool recurse)
winName = GetName(); winName = GetName();
wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n", wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n",
(const char *)windowClass, (const char *)windowClass,
(const char *)winName); (const char *)winName);
if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" ); if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" );
if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" ); if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" );
if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" ); if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" );