mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-24 07:24:31 +08:00
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:
@@ -764,6 +764,7 @@ DEFAULT_wxUSE_POSTSCRIPT=1
|
||||
DEFAULT_wxUSE_IPC=1
|
||||
DEFAULT_wxUSE_RESOURCES=1
|
||||
DEFAULT_wxUSE_CLIPBOARD=1
|
||||
DEFAULT_wxUSE_TOOLTIPS=1
|
||||
DEFAULT_wxUSE_DRAG_AND_DROP=1
|
||||
|
||||
DEFAULT_wxUSE_MDI_ARCHITECTURE=1
|
||||
@@ -938,6 +939,10 @@ AC_OVERRIDES(clipboard,clipboard,
|
||||
**--with-clipboard use wxClipboard classes,
|
||||
wxUSE_CLIPBOARD)
|
||||
|
||||
AC_OVERRIDES(tooltips,tooltips,
|
||||
**--with-tooltips use tooltips,
|
||||
wxUSE_TOOLTIPS)
|
||||
|
||||
AC_OVERRIDES(dnd,dnd,
|
||||
**--with-dnd use Drag'n'Drop classes,
|
||||
wxUSE_DRAG_AND_DROP)
|
||||
@@ -1282,6 +1287,10 @@ if test "$wxUSE_CLIPBOARD" = 1 ; then
|
||||
AC_DEFINE_UNQUOTED(wxUSE_CLIPBOARD,$wxUSE_CLIPBOARD)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_TOOLTIPS" = 1 ; then
|
||||
AC_DEFINE_UNQUOTED(wxUSE_TOOLTIPS,$wxUSE_TOOLTIPS)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DRAG_AND_DROP" = 1 ; then
|
||||
AC_DEFINE_UNQUOTED(wxUSE_DRAG_AND_DROP,$wxUSE_DRAG_AND_DROP)
|
||||
fi
|
||||
|
||||
+18
-19
@@ -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;
|
||||
};
|
||||
|
||||
+16
-17
@@ -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__
|
||||
|
||||
+68
-65
@@ -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__
|
||||
|
||||
+21
-18
@@ -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__
|
||||
|
||||
+25
-18
@@ -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;
|
||||
|
||||
+18
-19
@@ -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;
|
||||
};
|
||||
|
||||
+16
-17
@@ -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__
|
||||
|
||||
+68
-65
@@ -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__
|
||||
|
||||
+21
-18
@@ -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__
|
||||
|
||||
+25
-18
@@ -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;
|
||||
|
||||
@@ -164,6 +164,10 @@
|
||||
* Use clipboard
|
||||
*/
|
||||
#define wxUSE_CLIPBOARD 0
|
||||
/*
|
||||
* Use tooltips
|
||||
*/
|
||||
#define wxUSE_TOOLTIPS 0
|
||||
/*
|
||||
* Use dnd
|
||||
*/
|
||||
|
||||
+19
-19
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@ extern bool g_blockEventsOnDrag;
|
||||
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
||||
{
|
||||
if (!cb->HasVMT()) return;
|
||||
|
||||
|
||||
if (cb->m_blockFirstEvent)
|
||||
{
|
||||
cb->m_blockFirstEvent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||
event.SetInt( cb->GetValue() );
|
||||
event.SetEventObject(cb);
|
||||
@@ -56,50 +56,50 @@ wxCheckBox::wxCheckBox(void)
|
||||
}
|
||||
|
||||
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
long style, const wxValidator& validator, const wxString &name )
|
||||
{
|
||||
m_needParent = TRUE;
|
||||
m_acceptsFocus = TRUE;
|
||||
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_check_button_new_with_label( m_label );
|
||||
|
||||
|
||||
m_blockFirstEvent = FALSE;
|
||||
|
||||
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
|
||||
if (newSize.y == -1) newSize.y = 26;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), (gpointer*)this );
|
||||
|
||||
|
||||
m_parent->AddChild( this );
|
||||
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
|
||||
|
||||
PostCreation();
|
||||
|
||||
|
||||
gtk_widget_realize( GTK_BUTTON( m_widget )->child );
|
||||
|
||||
|
||||
SetLabel( label );
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
SetForegroundColour( parent->GetForegroundColour() );
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxCheckBox::SetValue( bool state )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
|
||||
if ( state == GetValue() )
|
||||
return;
|
||||
|
||||
@@ -122,7 +122,7 @@ void wxCheckBox::SetLabel( const wxString& label )
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
wxControl::SetLabel( label );
|
||||
|
||||
|
||||
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void wxCheckBox::Enable( bool enable )
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
wxControl::Enable( enable );
|
||||
|
||||
|
||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||
}
|
||||
|
||||
|
||||
+23
-22
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -31,7 +31,7 @@ wxCheckListBox::wxCheckListBox() :
|
||||
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
int nStrings,
|
||||
int nStrings,
|
||||
const wxString choices[],
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
@@ -44,18 +44,18 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||
bool wxCheckListBox::IsChecked( int index ) const
|
||||
{
|
||||
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
|
||||
|
||||
|
||||
GList *child = g_list_nth( m_list->children, index );
|
||||
if (child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
GtkLabel *label = GTK_LABEL( bin->child );
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
return (str[1] == 'X');
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG("wrong checklistbox index");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -63,31 +63,32 @@ bool wxCheckListBox::IsChecked( int index ) const
|
||||
void wxCheckListBox::Check( int index, bool check )
|
||||
{
|
||||
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
|
||||
|
||||
|
||||
GList *child = g_list_nth( m_list->children, index );
|
||||
if (child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
GtkLabel *label = GTK_LABEL( bin->child );
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
if (check == (str[1] == 'X')) return;
|
||||
|
||||
if (check)
|
||||
str.SetChar( 1, 'X' );
|
||||
else
|
||||
str.SetChar( 1, '-' );
|
||||
|
||||
gtk_label_set( label, str );
|
||||
|
||||
return;
|
||||
|
||||
if (check)
|
||||
str.SetChar( 1, 'X' );
|
||||
else
|
||||
str.SetChar( 1, '-' );
|
||||
|
||||
gtk_label_set( label, str );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG("wrong checklistbox index");
|
||||
}
|
||||
|
||||
int wxCheckListBox::GetItemHeight()
|
||||
int wxCheckListBox::GetItemHeight() const
|
||||
{
|
||||
// FIXME
|
||||
return 22;
|
||||
}
|
||||
|
||||
+111
-109
File diff suppressed because it is too large
Load Diff
+14
-23
@@ -1,16 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tooltip.cpp
|
||||
// Purpose:
|
||||
// Purpose: wxToolTip implementation
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "tooltip.h"
|
||||
#pragma implementation "tooltip.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/tooltip.h"
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
@@ -23,7 +24,7 @@
|
||||
static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
|
||||
static GdkColor ss_bg;
|
||||
static GdkColor ss_fg;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolTip
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -34,16 +35,6 @@ wxToolTip::wxToolTip( const wxString &tip )
|
||||
m_window = (wxWindow*) NULL;
|
||||
}
|
||||
|
||||
bool wxToolTip::Ok() const
|
||||
{
|
||||
return (m_window);
|
||||
}
|
||||
|
||||
wxString wxToolTip::GetTip() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
void wxToolTip::SetTip( const wxString &tip )
|
||||
{
|
||||
m_text = tip;
|
||||
@@ -57,22 +48,22 @@ void wxToolTip::Apply( wxWindow *win )
|
||||
if (!ss_tooltips)
|
||||
{
|
||||
ss_tooltips = gtk_tooltips_new();
|
||||
|
||||
ss_fg.red = 0;
|
||||
|
||||
ss_fg.red = 0;
|
||||
ss_fg.green = 0;
|
||||
ss_fg.blue = 0;
|
||||
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg );
|
||||
|
||||
|
||||
ss_bg.red = 65535;
|
||||
ss_bg.green = 65535;
|
||||
ss_bg.blue = 50000;
|
||||
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;
|
||||
|
||||
|
||||
if (m_text.IsEmpty())
|
||||
m_window->ApplyToolTip( ss_tooltips, (char*) NULL );
|
||||
else
|
||||
@@ -82,7 +73,7 @@ void wxToolTip::Apply( wxWindow *win )
|
||||
void wxToolTip::Enable( bool flag )
|
||||
{
|
||||
if (!ss_tooltips) return;
|
||||
|
||||
|
||||
if (flag)
|
||||
gtk_tooltips_enable( ss_tooltips );
|
||||
else
|
||||
@@ -92,7 +83,7 @@ void wxToolTip::Enable( bool flag )
|
||||
void wxToolTip::SetDelay( long msecs )
|
||||
{
|
||||
if (!ss_tooltips) return;
|
||||
|
||||
|
||||
gtk_tooltips_set_delay( ss_tooltips, msecs );
|
||||
}
|
||||
|
||||
|
||||
+191
-190
File diff suppressed because it is too large
Load Diff
+19
-19
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@ extern bool g_blockEventsOnDrag;
|
||||
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
||||
{
|
||||
if (!cb->HasVMT()) return;
|
||||
|
||||
|
||||
if (cb->m_blockFirstEvent)
|
||||
{
|
||||
cb->m_blockFirstEvent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||
event.SetInt( cb->GetValue() );
|
||||
event.SetEventObject(cb);
|
||||
@@ -56,50 +56,50 @@ wxCheckBox::wxCheckBox(void)
|
||||
}
|
||||
|
||||
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
long style, const wxValidator& validator, const wxString &name )
|
||||
{
|
||||
m_needParent = TRUE;
|
||||
m_acceptsFocus = TRUE;
|
||||
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_check_button_new_with_label( m_label );
|
||||
|
||||
|
||||
m_blockFirstEvent = FALSE;
|
||||
|
||||
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
|
||||
if (newSize.y == -1) newSize.y = 26;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), (gpointer*)this );
|
||||
|
||||
|
||||
m_parent->AddChild( this );
|
||||
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
|
||||
|
||||
PostCreation();
|
||||
|
||||
|
||||
gtk_widget_realize( GTK_BUTTON( m_widget )->child );
|
||||
|
||||
|
||||
SetLabel( label );
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
SetForegroundColour( parent->GetForegroundColour() );
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxCheckBox::SetValue( bool state )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
|
||||
if ( state == GetValue() )
|
||||
return;
|
||||
|
||||
@@ -122,7 +122,7 @@ void wxCheckBox::SetLabel( const wxString& label )
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
wxControl::SetLabel( label );
|
||||
|
||||
|
||||
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void wxCheckBox::Enable( bool enable )
|
||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||
|
||||
wxControl::Enable( enable );
|
||||
|
||||
|
||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||
}
|
||||
|
||||
|
||||
+23
-22
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -31,7 +31,7 @@ wxCheckListBox::wxCheckListBox() :
|
||||
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
int nStrings,
|
||||
int nStrings,
|
||||
const wxString choices[],
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
@@ -44,18 +44,18 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||
bool wxCheckListBox::IsChecked( int index ) const
|
||||
{
|
||||
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
|
||||
|
||||
|
||||
GList *child = g_list_nth( m_list->children, index );
|
||||
if (child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
GtkLabel *label = GTK_LABEL( bin->child );
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
return (str[1] == 'X');
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG("wrong checklistbox index");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -63,31 +63,32 @@ bool wxCheckListBox::IsChecked( int index ) const
|
||||
void wxCheckListBox::Check( int index, bool check )
|
||||
{
|
||||
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
|
||||
|
||||
|
||||
GList *child = g_list_nth( m_list->children, index );
|
||||
if (child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN( child->data );
|
||||
GtkLabel *label = GTK_LABEL( bin->child );
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
|
||||
wxString str = label->label;
|
||||
|
||||
if (check == (str[1] == 'X')) return;
|
||||
|
||||
if (check)
|
||||
str.SetChar( 1, 'X' );
|
||||
else
|
||||
str.SetChar( 1, '-' );
|
||||
|
||||
gtk_label_set( label, str );
|
||||
|
||||
return;
|
||||
|
||||
if (check)
|
||||
str.SetChar( 1, 'X' );
|
||||
else
|
||||
str.SetChar( 1, '-' );
|
||||
|
||||
gtk_label_set( label, str );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG("wrong checklistbox index");
|
||||
}
|
||||
|
||||
int wxCheckListBox::GetItemHeight()
|
||||
int wxCheckListBox::GetItemHeight() const
|
||||
{
|
||||
// FIXME
|
||||
return 22;
|
||||
}
|
||||
|
||||
+111
-109
File diff suppressed because it is too large
Load Diff
+14
-23
@@ -1,16 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tooltip.cpp
|
||||
// Purpose:
|
||||
// Purpose: wxToolTip implementation
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "tooltip.h"
|
||||
#pragma implementation "tooltip.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/tooltip.h"
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
@@ -23,7 +24,7 @@
|
||||
static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
|
||||
static GdkColor ss_bg;
|
||||
static GdkColor ss_fg;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolTip
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -34,16 +35,6 @@ wxToolTip::wxToolTip( const wxString &tip )
|
||||
m_window = (wxWindow*) NULL;
|
||||
}
|
||||
|
||||
bool wxToolTip::Ok() const
|
||||
{
|
||||
return (m_window);
|
||||
}
|
||||
|
||||
wxString wxToolTip::GetTip() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
void wxToolTip::SetTip( const wxString &tip )
|
||||
{
|
||||
m_text = tip;
|
||||
@@ -57,22 +48,22 @@ void wxToolTip::Apply( wxWindow *win )
|
||||
if (!ss_tooltips)
|
||||
{
|
||||
ss_tooltips = gtk_tooltips_new();
|
||||
|
||||
ss_fg.red = 0;
|
||||
|
||||
ss_fg.red = 0;
|
||||
ss_fg.green = 0;
|
||||
ss_fg.blue = 0;
|
||||
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg );
|
||||
|
||||
|
||||
ss_bg.red = 65535;
|
||||
ss_bg.green = 65535;
|
||||
ss_bg.blue = 50000;
|
||||
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;
|
||||
|
||||
|
||||
if (m_text.IsEmpty())
|
||||
m_window->ApplyToolTip( ss_tooltips, (char*) NULL );
|
||||
else
|
||||
@@ -82,7 +73,7 @@ void wxToolTip::Apply( wxWindow *win )
|
||||
void wxToolTip::Enable( bool flag )
|
||||
{
|
||||
if (!ss_tooltips) return;
|
||||
|
||||
|
||||
if (flag)
|
||||
gtk_tooltips_enable( ss_tooltips );
|
||||
else
|
||||
@@ -92,7 +83,7 @@ void wxToolTip::Enable( bool flag )
|
||||
void wxToolTip::SetDelay( long msecs )
|
||||
{
|
||||
if (!ss_tooltips) return;
|
||||
|
||||
|
||||
gtk_tooltips_set_delay( ss_tooltips, msecs );
|
||||
}
|
||||
|
||||
|
||||
+191
-190
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user