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

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -38,33 +38,32 @@ extern const char *wxCheckBoxNameStr;
class wxCheckBox: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxCheckBox)
public:
DECLARE_DYNAMIC_CLASS(wxCheckBox)
public:
wxCheckBox(void);
inline wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr)
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
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,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr );
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr );
void SetValue( bool state );
bool GetValue() const;
void SetLabel( const wxString& label );
void Enable( bool enable );
// implementation
void ApplyWidgetStyle();
// implementation
void ApplyWidgetStyle();
bool m_blockFirstEvent;
};

View File

@@ -2,7 +2,7 @@
// Name: checklst.h
// Purpose: wxCheckListBox class
// Author: Robert Roebling
// Modified by:
// Modified by:
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
@@ -33,25 +33,24 @@ class wxCheckListBox;
class wxCheckListBox : public wxListBox
{
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
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();
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);
bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE );
int GetItemHeight();
bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE );
int GetItemHeight() const;
};
#endif
#endif
//__GTKCHECKLISTH__

View File

@@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: listbox.h
// Purpose:
// Purpose: wxListBox class declaration
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -39,75 +39,78 @@ extern const char *wxListBoxNameStr;
class wxListBox : public wxControl
{
DECLARE_DYNAMIC_CLASS(wxListBox)
DECLARE_DYNAMIC_CLASS(wxListBox)
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();
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* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete( int n );
void Deselect( int n );
int FindString( const wxString &item ) const;
int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number();
bool Selected( int n );
void Set( int n, const wxString *choices );
void SetFirstItem( int n );
void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE );
wxListBox();
inline 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);
}
~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* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete( int n );
void Deselect( int n );
int FindString( const wxString &item ) const;
int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number();
bool Selected( int n );
void Set( int n, const wxString *choices );
void SetFirstItem( int n );
void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE );
#if wxUSE_DRAG_AND_DROP
void SetDropTarget( wxDropTarget *dropTarget );
void SetDropTarget( wxDropTarget *dropTarget );
#endif
// implementation
void AppendCommon( const wxString &item );
int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
void ApplyToolTip( GtkTooltips *tips, const char *tip );
GtkList *m_list;
wxList m_clientDataList;
wxList m_clientObjectList;
bool m_hasCheckBoxes;
// implementation
void AppendCommon( const wxString &item );
int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
#if wxUSE_TOOLTIPS
void ApplyToolTip( GtkTooltips *tips, const char *tip );
#endif // wxUSE_TOOLTIPS
GtkList *m_list;
wxList m_clientDataList;
wxList m_clientObjectList;
bool m_hasCheckBoxes;
};
#endif // __GTKLISTBOXH__

View File

@@ -1,53 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: tooltip.h
// Purpose:
// Purpose: wxToolTip class
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKTOOLTIPH__
#define __GTKTOOLTIPH__
#ifdef __GNUG__
#pragma interface
#pragma interface
#endif
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/object.h"
#include "wx/window.h"
//-----------------------------------------------------------------------------
// classes
// forward declarations
//-----------------------------------------------------------------------------
class wxToolTip;
class wxWindow;
//-----------------------------------------------------------------------------
// wxToolTip
//-----------------------------------------------------------------------------
class wxToolTip: public wxObject
class wxToolTip : public wxObject
{
public:
wxToolTip( const wxString &tip );
void SetTip( const wxString &tip );
wxString GetTip() const;
wxWindow *GetWindow() const;
bool Ok() const;
// globally change the tooltip parameters
static void Enable( bool flag );
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;
wxWindow *m_window;
void Apply( wxWindow *win );
};
#endif // __GTKTOOLTIPH__

View File

@@ -146,23 +146,23 @@ public:
virtual void SetSize( int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO );
virtual void SetSize( int width, int height );
virtual void Move( int x, int y );
virtual void GetSize( int *width, int *height ) const;
wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); }
virtual void SetClientSize( int const width, int const height );
virtual void GetClientSize( int *width, int *height ) const;
wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); }
virtual void GetPosition( int *x, int *y ) const;
wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); }
wxRect GetRect() const
{ int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); }
virtual void Centre( int direction = wxHORIZONTAL );
inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
virtual void Fit();
@@ -188,7 +188,7 @@ public:
virtual void SetFocus();
static wxWindow *FindFocus();
virtual void AddChild( wxWindow *child );
wxList& GetChildren() { return m_children; }
@@ -226,12 +226,14 @@ public:
wxWindowID GetId() const;
void SetCursor( const wxCursor &cursor );
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 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 Clear();
@@ -326,20 +328,20 @@ public:
bool HasVMT();
virtual void OnInternalIdle();
/* used by all classes in the widget creation process */
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
/* the methods below are required because many native widgets
are composed of several subwidgets and setting a style for
the widget means setting it for all subwidgets as well.
the widget means setting it for all subwidgets as well.
also, it is nor clear, which native widget is the top
widget where (most of) the input goes. even tooltips have
to be applied to all subwidgets. */
virtual GtkWidget* GetConnectWidget();
virtual bool IsOwnGtkWindow( GdkWindow *window );
void ConnectWidget( GtkWidget *widget );
@@ -347,8 +349,10 @@ public:
GtkStyle *GetWidgetStyle();
void SetWidgetStyle();
virtual void ApplyWidgetStyle();
#if wxUSE_TOOLTIPS
virtual void ApplyToolTip( GtkTooltips *tips, const char *tip );
#endif // wxUSE_TOOLTIPS
/* private member variables */
@@ -377,7 +381,10 @@ public:
wxAcceleratorTable m_acceleratorTable;
wxClientData *m_clientObject;
void *m_clientData;
#if wxUSE_TOOLTIPS
wxToolTip *m_toolTip;
#endif // wxUSE_TOOLTIPS
GtkWidget *m_widget;
GtkWidget *m_wxwindow;