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_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
|
||||||
|
@@ -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,33 +38,32 @@ 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();
|
||||||
|
|
||||||
bool m_blockFirstEvent;
|
bool m_blockFirstEvent;
|
||||||
};
|
};
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// Name: checklst.h
|
// Name: checklst.h
|
||||||
// Purpose: wxCheckListBox class
|
// Purpose: wxCheckListBox class
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
@@ -33,25 +33,24 @@ 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
|
||||||
//__GTKCHECKLISTH__
|
//__GTKCHECKLISTH__
|
||||||
|
@@ -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();
|
||||||
|
|
||||||
|
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
|
#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 );
|
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
GtkList *m_list;
|
void ApplyToolTip( GtkTooltips *tips, const char *tip );
|
||||||
wxList m_clientDataList;
|
#endif // wxUSE_TOOLTIPS
|
||||||
wxList m_clientObjectList;
|
|
||||||
bool m_hasCheckBoxes;
|
GtkList *m_list;
|
||||||
|
wxList m_clientDataList;
|
||||||
|
wxList m_clientObjectList;
|
||||||
|
bool m_hasCheckBoxes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKLISTBOXH__
|
#endif // __GTKLISTBOXH__
|
||||||
|
@@ -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__
|
||||||
|
@@ -146,23 +146,23 @@ public:
|
|||||||
virtual void SetSize( int x, int y, int width, int height,
|
virtual void SetSize( int x, int y, int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO );
|
int sizeFlags = wxSIZE_AUTO );
|
||||||
virtual void SetSize( int width, int height );
|
virtual void SetSize( int width, int height );
|
||||||
|
|
||||||
virtual void Move( int x, int y );
|
virtual void Move( int x, int y );
|
||||||
|
|
||||||
virtual void GetSize( int *width, int *height ) const;
|
virtual void GetSize( int *width, int *height ) const;
|
||||||
wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); }
|
wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); }
|
||||||
|
|
||||||
virtual void SetClientSize( int const width, int const height );
|
virtual void SetClientSize( int const width, int const height );
|
||||||
|
|
||||||
virtual void GetClientSize( int *width, int *height ) const;
|
virtual void GetClientSize( int *width, int *height ) const;
|
||||||
wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); }
|
wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); }
|
||||||
|
|
||||||
virtual void GetPosition( int *x, int *y ) const;
|
virtual void GetPosition( int *x, int *y ) const;
|
||||||
wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); }
|
wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); }
|
||||||
|
|
||||||
wxRect GetRect() const
|
wxRect GetRect() const
|
||||||
{ int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); }
|
{ int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); }
|
||||||
|
|
||||||
virtual void Centre( int direction = wxHORIZONTAL );
|
virtual void Centre( int direction = wxHORIZONTAL );
|
||||||
inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
|
inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
|
||||||
virtual void Fit();
|
virtual void Fit();
|
||||||
@@ -188,7 +188,7 @@ public:
|
|||||||
|
|
||||||
virtual void SetFocus();
|
virtual void SetFocus();
|
||||||
static wxWindow *FindFocus();
|
static wxWindow *FindFocus();
|
||||||
|
|
||||||
virtual void AddChild( wxWindow *child );
|
virtual void AddChild( wxWindow *child );
|
||||||
wxList& GetChildren() { return m_children; }
|
wxList& GetChildren() { return m_children; }
|
||||||
|
|
||||||
@@ -226,12 +226,14 @@ public:
|
|||||||
wxWindowID GetId() const;
|
wxWindowID GetId() const;
|
||||||
|
|
||||||
void SetCursor( const wxCursor &cursor );
|
void SetCursor( const wxCursor &cursor );
|
||||||
|
|
||||||
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();
|
||||||
@@ -326,20 +328,20 @@ public:
|
|||||||
bool HasVMT();
|
bool HasVMT();
|
||||||
|
|
||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
|
||||||
/* used by all classes in the widget creation process */
|
/* used by all classes in the widget creation process */
|
||||||
|
|
||||||
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||||
const wxSize &size, long style, const wxString &name );
|
const wxSize &size, long style, const wxString &name );
|
||||||
void PostCreation();
|
void PostCreation();
|
||||||
|
|
||||||
/* the methods below are required because many native widgets
|
/* the methods below are required because many native widgets
|
||||||
are composed of several subwidgets and setting a style for
|
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
|
also, it is nor clear, which native widget is the top
|
||||||
widget where (most of) the input goes. even tooltips have
|
widget where (most of) the input goes. even tooltips have
|
||||||
to be applied to all subwidgets. */
|
to be applied to all subwidgets. */
|
||||||
|
|
||||||
virtual GtkWidget* GetConnectWidget();
|
virtual GtkWidget* GetConnectWidget();
|
||||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void ConnectWidget( GtkWidget *widget );
|
void ConnectWidget( GtkWidget *widget );
|
||||||
@@ -347,8 +349,10 @@ public:
|
|||||||
GtkStyle *GetWidgetStyle();
|
GtkStyle *GetWidgetStyle();
|
||||||
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;
|
||||||
|
@@ -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,33 +38,32 @@ 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();
|
||||||
|
|
||||||
bool m_blockFirstEvent;
|
bool m_blockFirstEvent;
|
||||||
};
|
};
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// Name: checklst.h
|
// Name: checklst.h
|
||||||
// Purpose: wxCheckListBox class
|
// Purpose: wxCheckListBox class
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
@@ -33,25 +33,24 @@ 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
|
||||||
//__GTKCHECKLISTH__
|
//__GTKCHECKLISTH__
|
||||||
|
@@ -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();
|
||||||
|
|
||||||
|
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
|
#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 );
|
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
GtkList *m_list;
|
void ApplyToolTip( GtkTooltips *tips, const char *tip );
|
||||||
wxList m_clientDataList;
|
#endif // wxUSE_TOOLTIPS
|
||||||
wxList m_clientObjectList;
|
|
||||||
bool m_hasCheckBoxes;
|
GtkList *m_list;
|
||||||
|
wxList m_clientDataList;
|
||||||
|
wxList m_clientObjectList;
|
||||||
|
bool m_hasCheckBoxes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKLISTBOXH__
|
#endif // __GTKLISTBOXH__
|
||||||
|
@@ -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__
|
||||||
|
@@ -146,23 +146,23 @@ public:
|
|||||||
virtual void SetSize( int x, int y, int width, int height,
|
virtual void SetSize( int x, int y, int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO );
|
int sizeFlags = wxSIZE_AUTO );
|
||||||
virtual void SetSize( int width, int height );
|
virtual void SetSize( int width, int height );
|
||||||
|
|
||||||
virtual void Move( int x, int y );
|
virtual void Move( int x, int y );
|
||||||
|
|
||||||
virtual void GetSize( int *width, int *height ) const;
|
virtual void GetSize( int *width, int *height ) const;
|
||||||
wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); }
|
wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); }
|
||||||
|
|
||||||
virtual void SetClientSize( int const width, int const height );
|
virtual void SetClientSize( int const width, int const height );
|
||||||
|
|
||||||
virtual void GetClientSize( int *width, int *height ) const;
|
virtual void GetClientSize( int *width, int *height ) const;
|
||||||
wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); }
|
wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); }
|
||||||
|
|
||||||
virtual void GetPosition( int *x, int *y ) const;
|
virtual void GetPosition( int *x, int *y ) const;
|
||||||
wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); }
|
wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); }
|
||||||
|
|
||||||
wxRect GetRect() const
|
wxRect GetRect() const
|
||||||
{ int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); }
|
{ int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); }
|
||||||
|
|
||||||
virtual void Centre( int direction = wxHORIZONTAL );
|
virtual void Centre( int direction = wxHORIZONTAL );
|
||||||
inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
|
inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
|
||||||
virtual void Fit();
|
virtual void Fit();
|
||||||
@@ -188,7 +188,7 @@ public:
|
|||||||
|
|
||||||
virtual void SetFocus();
|
virtual void SetFocus();
|
||||||
static wxWindow *FindFocus();
|
static wxWindow *FindFocus();
|
||||||
|
|
||||||
virtual void AddChild( wxWindow *child );
|
virtual void AddChild( wxWindow *child );
|
||||||
wxList& GetChildren() { return m_children; }
|
wxList& GetChildren() { return m_children; }
|
||||||
|
|
||||||
@@ -226,12 +226,14 @@ public:
|
|||||||
wxWindowID GetId() const;
|
wxWindowID GetId() const;
|
||||||
|
|
||||||
void SetCursor( const wxCursor &cursor );
|
void SetCursor( const wxCursor &cursor );
|
||||||
|
|
||||||
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();
|
||||||
@@ -326,20 +328,20 @@ public:
|
|||||||
bool HasVMT();
|
bool HasVMT();
|
||||||
|
|
||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
|
||||||
/* used by all classes in the widget creation process */
|
/* used by all classes in the widget creation process */
|
||||||
|
|
||||||
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||||
const wxSize &size, long style, const wxString &name );
|
const wxSize &size, long style, const wxString &name );
|
||||||
void PostCreation();
|
void PostCreation();
|
||||||
|
|
||||||
/* the methods below are required because many native widgets
|
/* the methods below are required because many native widgets
|
||||||
are composed of several subwidgets and setting a style for
|
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
|
also, it is nor clear, which native widget is the top
|
||||||
widget where (most of) the input goes. even tooltips have
|
widget where (most of) the input goes. even tooltips have
|
||||||
to be applied to all subwidgets. */
|
to be applied to all subwidgets. */
|
||||||
|
|
||||||
virtual GtkWidget* GetConnectWidget();
|
virtual GtkWidget* GetConnectWidget();
|
||||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void ConnectWidget( GtkWidget *widget );
|
void ConnectWidget( GtkWidget *widget );
|
||||||
@@ -347,8 +349,10 @@ public:
|
|||||||
GtkStyle *GetWidgetStyle();
|
GtkStyle *GetWidgetStyle();
|
||||||
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;
|
||||||
|
@@ -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
|
||||||
*/
|
*/
|
||||||
|
@@ -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
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -30,15 +30,15 @@ extern bool g_blockEventsOnDrag;
|
|||||||
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
||||||
{
|
{
|
||||||
if (!cb->HasVMT()) return;
|
if (!cb->HasVMT()) return;
|
||||||
|
|
||||||
if (cb->m_blockFirstEvent)
|
if (cb->m_blockFirstEvent)
|
||||||
{
|
{
|
||||||
cb->m_blockFirstEvent = FALSE;
|
cb->m_blockFirstEvent = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||||
event.SetInt( cb->GetValue() );
|
event.SetInt( cb->GetValue() );
|
||||||
event.SetEventObject(cb);
|
event.SetEventObject(cb);
|
||||||
@@ -56,50 +56,50 @@ wxCheckBox::wxCheckBox(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
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 )
|
long style, const wxValidator& validator, const wxString &name )
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = TRUE;
|
||||||
|
|
||||||
PreCreation( parent, id, pos, size, style, name );
|
PreCreation( parent, id, pos, size, style, name );
|
||||||
|
|
||||||
SetValidator( validator );
|
SetValidator( validator );
|
||||||
|
|
||||||
m_widget = gtk_check_button_new_with_label( m_label );
|
m_widget = gtk_check_button_new_with_label( m_label );
|
||||||
|
|
||||||
m_blockFirstEvent = FALSE;
|
m_blockFirstEvent = FALSE;
|
||||||
|
|
||||||
wxSize newSize = size;
|
wxSize newSize = size;
|
||||||
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
|
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
|
||||||
if (newSize.y == -1) newSize.y = 26;
|
if (newSize.y == -1) newSize.y = 26;
|
||||||
SetSize( newSize.x, newSize.y );
|
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 );
|
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->AddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
(m_parent->m_insertCallback)( m_parent, this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( GTK_BUTTON( m_widget )->child );
|
gtk_widget_realize( GTK_BUTTON( m_widget )->child );
|
||||||
|
|
||||||
SetLabel( label );
|
SetLabel( label );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::SetValue( bool state )
|
void wxCheckBox::SetValue( bool state )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
if ( state == GetValue() )
|
if ( state == GetValue() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ void wxCheckBox::SetLabel( const wxString& label )
|
|||||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
wxControl::SetLabel( label );
|
wxControl::SetLabel( label );
|
||||||
|
|
||||||
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
|
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" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
wxControl::Enable( enable );
|
wxControl::Enable( enable );
|
||||||
|
|
||||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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__
|
||||||
@@ -31,7 +31,7 @@ wxCheckListBox::wxCheckListBox() :
|
|||||||
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
int nStrings,
|
int nStrings,
|
||||||
const wxString choices[],
|
const wxString choices[],
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
@@ -44,18 +44,18 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
|||||||
bool wxCheckListBox::IsChecked( int index ) const
|
bool wxCheckListBox::IsChecked( int index ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
|
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, index );
|
GList *child = g_list_nth( m_list->children, index );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFAIL_MSG("wrong checklistbox index");
|
wxFAIL_MSG("wrong checklistbox index");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -63,31 +63,32 @@ bool wxCheckListBox::IsChecked( int index ) const
|
|||||||
void wxCheckListBox::Check( int index, bool check )
|
void wxCheckListBox::Check( int index, bool check )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
|
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, index );
|
GList *child = g_list_nth( m_list->children, index );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ extern bool g_blockEventsOnScroll;
|
|||||||
// "button_press_event"
|
// "button_press_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
|
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
|
||||||
{
|
{
|
||||||
if (g_blockEventsOnDrag) return FALSE;
|
if (g_blockEventsOnDrag) return FALSE;
|
||||||
@@ -56,24 +56,24 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
|||||||
if (!listbox->HasVMT()) return FALSE;
|
if (!listbox->HasVMT()) return FALSE;
|
||||||
|
|
||||||
int sel = listbox->GetIndex( widget );
|
int sel = listbox->GetIndex( widget );
|
||||||
|
|
||||||
if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS))
|
if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS))
|
||||||
{
|
{
|
||||||
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
||||||
|
|
||||||
clb->Check( sel, !clb->IsChecked(sel) );
|
clb->Check( sel, !clb->IsChecked(sel) );
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
event.SetInt( sel );
|
event.SetInt( sel );
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_event->type == GDK_2BUTTON_PRESS)
|
if (gdk_event->type == GDK_2BUTTON_PRESS)
|
||||||
{
|
{
|
||||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int count = listbox->GetSelections(aSelections);
|
int count = listbox->GetSelections(aSelections);
|
||||||
if ( count > 0 )
|
if ( count > 0 )
|
||||||
@@ -90,7 +90,7 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
|||||||
}
|
}
|
||||||
|
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
if (event.m_commandString) delete[] event.m_commandString ;
|
if (event.m_commandString) delete[] event.m_commandString ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
|||||||
// "key_press_event"
|
// "key_press_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
|
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
|
||||||
{
|
{
|
||||||
if (g_blockEventsOnDrag) return FALSE;
|
if (g_blockEventsOnDrag) return FALSE;
|
||||||
@@ -109,18 +109,18 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
|
|||||||
if (!listbox->HasVMT()) return FALSE;
|
if (!listbox->HasVMT()) return FALSE;
|
||||||
|
|
||||||
if (gdk_event->keyval != ' ') return FALSE;
|
if (gdk_event->keyval != ' ') return FALSE;
|
||||||
|
|
||||||
int sel = listbox->GetIndex( widget );
|
int sel = listbox->GetIndex( widget );
|
||||||
|
|
||||||
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
||||||
|
|
||||||
clb->Check( sel, !clb->IsChecked(sel) );
|
clb->Check( sel, !clb->IsChecked(sel) );
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
event.SetInt( sel );
|
event.SetInt( sel );
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
|
m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
|
||||||
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
|
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
|
||||||
|
|
||||||
m_list = GTK_LIST( gtk_list_new() );
|
m_list = GTK_LIST( gtk_list_new() );
|
||||||
|
|
||||||
GtkSelectionMode mode = GTK_SELECTION_BROWSE;
|
GtkSelectionMode mode = GTK_SELECTION_BROWSE;
|
||||||
@@ -202,7 +202,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
debug_focus_in( m_widget, "wxListBox::m_widget", name );
|
debug_focus_in( m_widget, "wxListBox::m_widget", name );
|
||||||
|
|
||||||
debug_focus_in( GTK_WIDGET(m_list), "wxListBox::m_list", name );
|
debug_focus_in( GTK_WIDGET(m_list), "wxListBox::m_list", name );
|
||||||
|
|
||||||
GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
|
GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
|
||||||
@@ -230,24 +230,24 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
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 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
@@ -257,28 +257,28 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||||
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 );
|
||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->AddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
(m_parent->m_insertCallback)( m_parent, this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( GTK_WIDGET(m_list) );
|
gtk_widget_realize( GTK_WIDGET(m_list) );
|
||||||
@@ -299,13 +299,13 @@ wxListBox::~wxListBox()
|
|||||||
void wxListBox::AppendCommon( const wxString &item )
|
void wxListBox::AppendCommon( const wxString &item )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_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
|
||||||
@@ -323,20 +323,20 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
gtk_container_add( GTK_CONTAINER(m_list), list_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 );
|
||||||
|
|
||||||
ConnectWidget( list_item );
|
ConnectWidget( list_item );
|
||||||
@@ -354,7 +354,7 @@ void wxListBox::Append( const wxString &item )
|
|||||||
{
|
{
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
AppendCommon( item );
|
AppendCommon( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ void wxListBox::Append( const wxString &item, void *clientData )
|
|||||||
{
|
{
|
||||||
m_clientDataList.Append( (wxObject*) clientData );
|
m_clientDataList.Append( (wxObject*) clientData );
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
AppendCommon( item );
|
AppendCommon( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,50 +370,50 @@ void wxListBox::Append( const wxString &item, wxClientData *clientData )
|
|||||||
{
|
{
|
||||||
m_clientObjectList.Append( (wxObject*) clientData );
|
m_clientObjectList.Append( (wxObject*) clientData );
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
AppendCommon( item );
|
AppendCommon( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetClientData( int n, void* clientData )
|
void wxListBox::SetClientData( int n, void* clientData )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientDataList.Nth( n );
|
wxNode *node = m_clientDataList.Nth( n );
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
node->SetData( (wxObject*) clientData );
|
node->SetData( (wxObject*) clientData );
|
||||||
}
|
}
|
||||||
|
|
||||||
void* wxListBox::GetClientData( int n )
|
void* wxListBox::GetClientData( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
|
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientDataList.Nth( n );
|
wxNode *node = m_clientDataList.Nth( n );
|
||||||
if (!node) return NULL;
|
if (!node) return NULL;
|
||||||
|
|
||||||
return node->Data();
|
return node->Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetClientObject( int n, wxClientData* clientData )
|
void wxListBox::SetClientObject( int n, wxClientData* clientData )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientObjectList.Nth( n );
|
wxNode *node = m_clientObjectList.Nth( n );
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
wxClientData *cd = (wxClientData*) node->Data();
|
wxClientData *cd = (wxClientData*) node->Data();
|
||||||
if (cd) delete cd;
|
if (cd) delete cd;
|
||||||
|
|
||||||
node->SetData( (wxObject*) clientData );
|
node->SetData( (wxObject*) clientData );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClientData* wxListBox::GetClientObject( int n )
|
wxClientData* wxListBox::GetClientObject( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientObjectList.Nth( n );
|
wxNode *node = m_clientObjectList.Nth( n );
|
||||||
if (!node) return (wxClientData*) NULL;
|
if (!node) return (wxClientData*) NULL;
|
||||||
|
|
||||||
return (wxClientData*) node->Data();
|
return (wxClientData*) node->Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +431,7 @@ void wxListBox::Clear()
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
m_clientObjectList.Clear();
|
m_clientObjectList.Clear();
|
||||||
|
|
||||||
m_clientDataList.Clear();
|
m_clientDataList.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ void wxListBox::Delete( int n )
|
|||||||
if (cd) delete cd;
|
if (cd) delete cd;
|
||||||
m_clientObjectList.DeleteNode( node );
|
m_clientObjectList.DeleteNode( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
node = m_clientDataList.Nth( n );
|
node = m_clientDataList.Nth( n );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
@@ -472,19 +472,19 @@ void wxListBox::Deselect( int n )
|
|||||||
int wxListBox::FindString( const wxString &item ) const
|
int wxListBox::FindString( const wxString &item ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
@@ -497,7 +497,7 @@ int wxListBox::FindString( const wxString &item ) const
|
|||||||
int wxListBox::GetSelection() const
|
int wxListBox::GetSelection() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -512,7 +512,7 @@ int wxListBox::GetSelection() const
|
|||||||
int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
// get the number of selected items first
|
// get the number of selected items first
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -524,7 +524,7 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
|||||||
|
|
||||||
aSelections.Empty();
|
aSelections.Empty();
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
// now fill the list
|
// now fill the list
|
||||||
aSelections.Alloc(count); // optimization attempt
|
aSelections.Alloc(count); // optimization attempt
|
||||||
@@ -542,16 +542,16 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
|||||||
wxString wxListBox::GetString( int n ) const
|
wxString wxListBox::GetString( int n ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
wxFAIL_MSG("wrong listbox index");
|
wxFAIL_MSG("wrong listbox index");
|
||||||
@@ -561,19 +561,19 @@ wxString wxListBox::GetString( int n ) const
|
|||||||
wxString wxListBox::GetStringSelection() const
|
wxString wxListBox::GetStringSelection() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
||||||
|
|
||||||
GList *selection = m_list->selection;
|
GList *selection = m_list->selection;
|
||||||
if (selection)
|
if (selection)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFAIL_MSG("no listbox selection available");
|
wxFAIL_MSG("no listbox selection available");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -581,7 +581,7 @@ wxString wxListBox::GetStringSelection() const
|
|||||||
int wxListBox::Number()
|
int wxListBox::Number()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child) { count++; child = child->next; }
|
while (child) { count++; child = child->next; }
|
||||||
@@ -591,7 +591,7 @@ int wxListBox::Number()
|
|||||||
bool wxListBox::Selected( int n )
|
bool wxListBox::Selected( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" );
|
||||||
|
|
||||||
GList *target = g_list_nth( m_list->children, n );
|
GList *target = g_list_nth( m_list->children, n );
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
@@ -624,7 +624,7 @@ void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
|
|||||||
void wxListBox::SetSelection( int n, bool select )
|
void wxListBox::SetSelection( int n, bool select )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
if (select)
|
if (select)
|
||||||
gtk_list_select_item( m_list, n );
|
gtk_list_select_item( m_list, n );
|
||||||
else
|
else
|
||||||
@@ -634,29 +634,29 @@ void wxListBox::SetSelection( int n, bool select )
|
|||||||
void wxListBox::SetString( int n, const wxString &string )
|
void wxListBox::SetString( int n, const wxString &string )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFAIL_MSG("wrong listbox index");
|
wxFAIL_MSG("wrong listbox index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
SetSelection( FindString(string), select );
|
SetSelection( FindString(string), select );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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,24 +686,25 @@ 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 )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
#ifndef NEW_GTK_DND_CODE
|
#ifndef NEW_GTK_DND_CODE
|
||||||
if (m_dropTarget)
|
if (m_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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxWindow::SetDropTarget( dropTarget );
|
wxWindow::SetDropTarget( dropTarget );
|
||||||
|
|
||||||
#ifndef NEW_GTK_DND_CODE
|
#ifndef NEW_GTK_DND_CODE
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -742,7 +744,7 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
void wxListBox::ApplyWidgetStyle()
|
void wxListBox::ApplyWidgetStyle()
|
||||||
{
|
{
|
||||||
SetWidgetStyle();
|
SetWidgetStyle();
|
||||||
|
|
||||||
if (m_backgroundColour.Ok())
|
if (m_backgroundColour.Ok())
|
||||||
{
|
{
|
||||||
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
||||||
@@ -750,16 +752,16 @@ void wxListBox::ApplyWidgetStyle()
|
|||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
||||||
|
|
||||||
GtkBin *bin = GTK_BIN( child->data );
|
GtkBin *bin = GTK_BIN( child->data );
|
||||||
GtkWidget *label = GTK_WIDGET( bin->child );
|
GtkWidget *label = GTK_WIDGET( bin->child );
|
||||||
gtk_widget_set_style( label, m_widgetStyle );
|
gtk_widget_set_style( label, m_widgetStyle );
|
||||||
|
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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"
|
||||||
@@ -23,7 +24,7 @@
|
|||||||
static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
|
static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
|
||||||
static GdkColor ss_bg;
|
static GdkColor ss_bg;
|
||||||
static GdkColor ss_fg;
|
static GdkColor ss_fg;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolTip
|
// wxToolTip
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -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;
|
||||||
@@ -57,22 +48,22 @@ void wxToolTip::Apply( wxWindow *win )
|
|||||||
if (!ss_tooltips)
|
if (!ss_tooltips)
|
||||||
{
|
{
|
||||||
ss_tooltips = gtk_tooltips_new();
|
ss_tooltips = gtk_tooltips_new();
|
||||||
|
|
||||||
ss_fg.red = 0;
|
ss_fg.red = 0;
|
||||||
ss_fg.green = 0;
|
ss_fg.green = 0;
|
||||||
ss_fg.blue = 0;
|
ss_fg.blue = 0;
|
||||||
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg );
|
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg );
|
||||||
|
|
||||||
ss_bg.red = 65535;
|
ss_bg.red = 65535;
|
||||||
ss_bg.green = 65535;
|
ss_bg.green = 65535;
|
||||||
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;
|
||||||
|
|
||||||
if (m_text.IsEmpty())
|
if (m_text.IsEmpty())
|
||||||
m_window->ApplyToolTip( ss_tooltips, (char*) NULL );
|
m_window->ApplyToolTip( ss_tooltips, (char*) NULL );
|
||||||
else
|
else
|
||||||
@@ -82,7 +73,7 @@ void wxToolTip::Apply( wxWindow *win )
|
|||||||
void wxToolTip::Enable( bool flag )
|
void wxToolTip::Enable( bool flag )
|
||||||
{
|
{
|
||||||
if (!ss_tooltips) return;
|
if (!ss_tooltips) return;
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
gtk_tooltips_enable( ss_tooltips );
|
gtk_tooltips_enable( ss_tooltips );
|
||||||
else
|
else
|
||||||
@@ -92,7 +83,7 @@ void wxToolTip::Enable( bool flag )
|
|||||||
void wxToolTip::SetDelay( long msecs )
|
void wxToolTip::SetDelay( long msecs )
|
||||||
{
|
{
|
||||||
if (!ss_tooltips) return;
|
if (!ss_tooltips) return;
|
||||||
|
|
||||||
gtk_tooltips_set_delay( ss_tooltips, msecs );
|
gtk_tooltips_set_delay( ss_tooltips, msecs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,14 +132,14 @@
|
|||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
|
||||||
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 );
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,9 +150,9 @@ void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
|
|||||||
wxString tmp = name;
|
wxString tmp = name;
|
||||||
tmp += " FROM ";
|
tmp += " FROM ";
|
||||||
tmp += window;
|
tmp += window;
|
||||||
|
|
||||||
char *s = new char[tmp.Length()+1];
|
char *s = new char[tmp.Length()+1];
|
||||||
|
|
||||||
strcpy( s, WXSTRINGCAST tmp );
|
strcpy( s, WXSTRINGCAST tmp );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
|
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
|
||||||
@@ -345,38 +345,38 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
ancestor = ancestor->GetParent();
|
ancestor = ancestor->GetParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// win is a control: tab can be propagated up
|
// win is a control: tab can be propagated up
|
||||||
if ((!ret) && (gdk_event->keyval == GDK_Tab))
|
if ((!ret) && (gdk_event->keyval == GDK_Tab))
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// win is a panel: up can be propagated to the panel
|
// win is a panel: up can be propagated to the panel
|
||||||
if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
|
if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
|
||||||
(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
|
||||||
if ((!ret) && (win->m_wxwindow) &&
|
if ((!ret) && (win->m_wxwindow) &&
|
||||||
((gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Left) ||
|
((gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Left) ||
|
||||||
(gdk_event->keyval == GDK_Up) || (gdk_event->keyval == GDK_Down)))
|
(gdk_event->keyval == GDK_Up) || (gdk_event->keyval == GDK_Down)))
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||||
@@ -588,37 +588,37 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
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,12 +627,12 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint pt(win->GetClientAreaOrigin());
|
wxPoint pt(win->GetClientAreaOrigin());
|
||||||
event.m_x -= pt.x;
|
event.m_x -= pt.x;
|
||||||
event.m_y -= pt.y;
|
event.m_y -= pt.y;
|
||||||
@@ -696,37 +696,37 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
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();
|
||||||
}
|
}
|
||||||
@@ -759,7 +759,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
|
|
||||||
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
|
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
|
||||||
{
|
{
|
||||||
if (gdk_event->is_hint)
|
if (gdk_event->is_hint)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
@@ -769,7 +769,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
gdk_event->y = y;
|
gdk_event->y = y;
|
||||||
gdk_event->state = state;
|
gdk_event->state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return TRUE;
|
if (g_blockEventsOnDrag) return TRUE;
|
||||||
@@ -805,37 +805,37 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
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();
|
||||||
}
|
}
|
||||||
@@ -869,9 +869,9 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
|
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
|
||||||
{
|
{
|
||||||
if (g_blockEventsOnDrag) return TRUE;
|
if (g_blockEventsOnDrag) return TRUE;
|
||||||
|
|
||||||
g_focusWindow = win;
|
g_focusWindow = win;
|
||||||
|
|
||||||
if (win->m_wxwindow)
|
if (win->m_wxwindow)
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
|
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
|
||||||
@@ -961,13 +961,13 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
|
|
||||||
wxMouseEvent event( wxEVT_ENTER_WINDOW );
|
wxMouseEvent event( wxEVT_ENTER_WINDOW );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
GdkModifierType state = (GdkModifierType)0;
|
GdkModifierType state = (GdkModifierType)0;
|
||||||
|
|
||||||
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
||||||
|
|
||||||
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
||||||
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
||||||
event.m_altDown = (state & GDK_MOD1_MASK);
|
event.m_altDown = (state & GDK_MOD1_MASK);
|
||||||
@@ -978,7 +978,7 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
|
|
||||||
event.m_x = (long)x;
|
event.m_x = (long)x;
|
||||||
event.m_y = (long)y;
|
event.m_y = (long)y;
|
||||||
|
|
||||||
wxPoint pt(win->GetClientAreaOrigin());
|
wxPoint pt(win->GetClientAreaOrigin());
|
||||||
event.m_x -= pt.x;
|
event.m_x -= pt.x;
|
||||||
event.m_y -= pt.y;
|
event.m_y -= pt.y;
|
||||||
@@ -1017,9 +1017,9 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
GdkModifierType state = (GdkModifierType)0;
|
GdkModifierType state = (GdkModifierType)0;
|
||||||
|
|
||||||
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
||||||
|
|
||||||
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
||||||
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
||||||
event.m_altDown = (state & GDK_MOD1_MASK);
|
event.m_altDown = (state & GDK_MOD1_MASK);
|
||||||
@@ -1030,7 +1030,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
|
|
||||||
event.m_x = (long)x;
|
event.m_x = (long)x;
|
||||||
event.m_y = (long)y;
|
event.m_y = (long)y;
|
||||||
|
|
||||||
wxPoint pt(win->GetClientAreaOrigin());
|
wxPoint pt(win->GetClientAreaOrigin());
|
||||||
event.m_x -= pt.x;
|
event.m_x -= pt.x;
|
||||||
event.m_y -= pt.y;
|
event.m_y -= pt.y;
|
||||||
@@ -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,23 +1246,23 @@ 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))
|
||||||
{
|
{
|
||||||
parent->m_sizeSet = FALSE;
|
parent->m_sizeSet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1347,11 +1347,13 @@ wxWindow::wxWindow()
|
|||||||
|
|
||||||
m_clientObject = (wxClientData*) NULL;
|
m_clientObject = (wxClientData*) NULL;
|
||||||
m_clientData = NULL;
|
m_clientData = NULL;
|
||||||
|
|
||||||
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,
|
||||||
@@ -1374,7 +1376,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
|
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
debug_focus_in( m_widget, "wxWindow::m_widget", name );
|
debug_focus_in( m_widget, "wxWindow::m_widget", name );
|
||||||
#endif
|
#endif
|
||||||
@@ -1431,8 +1433,8 @@ 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;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -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 );
|
||||||
@@ -1641,9 +1645,12 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_clientObject = (wxClientData*)NULL;
|
m_clientObject = (wxClientData*)NULL;
|
||||||
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()
|
||||||
@@ -2089,7 +2096,7 @@ void wxWindow::Fit()
|
|||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetClientSize(maxX + 7, maxY + 14);
|
SetClientSize(maxX + 7, maxY + 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2116,9 +2123,9 @@ bool wxWindow::Show( bool show )
|
|||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
else
|
else
|
||||||
gtk_widget_hide( m_widget );
|
gtk_widget_hide( m_widget );
|
||||||
|
|
||||||
m_isShown = show;
|
m_isShown = show;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2127,7 +2134,7 @@ void wxWindow::Enable( bool enable )
|
|||||||
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
||||||
|
|
||||||
m_isEnabled = enable;
|
m_isEnabled = enable;
|
||||||
|
|
||||||
gtk_widget_set_sensitive( m_widget, enable );
|
gtk_widget_set_sensitive( m_widget, enable );
|
||||||
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
|
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
|
||||||
}
|
}
|
||||||
@@ -2139,7 +2146,7 @@ int wxWindow::GetCharHeight() const
|
|||||||
wxCHECK_MSG( m_font.Ok(), 12, "invalid font" );
|
wxCHECK_MSG( m_font.Ok(), 12, "invalid font" );
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return font->ascent + font->descent;
|
return font->ascent + font->descent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2150,7 +2157,7 @@ int wxWindow::GetCharWidth() const
|
|||||||
wxCHECK_MSG( m_font.Ok(), 8, "invalid font" );
|
wxCHECK_MSG( m_font.Ok(), 8, "invalid font" );
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return gdk_string_width( font, "H" );
|
return gdk_string_width( font, "H" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2172,7 +2179,7 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
|
|||||||
void wxWindow::MakeModal( bool modal )
|
void wxWindow::MakeModal( bool modal )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Disable all other windows
|
// Disable all other windows
|
||||||
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
|
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
|
||||||
{
|
{
|
||||||
@@ -2190,7 +2197,7 @@ void wxWindow::MakeModal( bool modal )
|
|||||||
void wxWindow::OnKeyDown( wxKeyEvent &event )
|
void wxWindow::OnKeyDown( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
event.SetEventType( wxEVT_CHAR );
|
event.SetEventType( wxEVT_CHAR );
|
||||||
|
|
||||||
if (!GetEventHandler()->ProcessEvent( event ))
|
if (!GetEventHandler()->ProcessEvent( event ))
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
@@ -2200,7 +2207,7 @@ void wxWindow::OnKeyDown( wxKeyEvent &event )
|
|||||||
void wxWindow::SetFocus()
|
void wxWindow::SetFocus()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
||||||
|
|
||||||
GtkWidget *connect_widget = GetConnectWidget();
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (connect_widget)
|
if (connect_widget)
|
||||||
{
|
{
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2244,7 +2251,7 @@ void wxWindow::AddChild( wxWindow *child )
|
|||||||
wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" );
|
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" );
|
||||||
|
|
||||||
wxWindow *oldParent = GetParent();
|
wxWindow *oldParent = GetParent();
|
||||||
|
|
||||||
if (oldParent) oldParent->RemoveChild( this );
|
if (oldParent) oldParent->RemoveChild( this );
|
||||||
@@ -2418,12 +2425,12 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rect)
|
if (!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())
|
|
||||||
{
|
|
||||||
delete m_toolTip;
|
|
||||||
m_toolTip = (wxToolTip*) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setting empty tooltip text does not remove the tooltip any more for
|
||||||
|
// wxMSW compatibility - use SetToolTip((wxToolTip *)NULL) for this
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetToolTip( wxToolTip *tip )
|
void wxWindow::SetToolTip( wxToolTip *tip )
|
||||||
@@ -2499,21 +2503,18 @@ void wxWindow::SetToolTip( wxToolTip *tip )
|
|||||||
m_toolTip->SetTip( (char*) NULL );
|
m_toolTip->SetTip( (char*) NULL );
|
||||||
delete m_toolTip;
|
delete m_toolTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
@@ -2538,14 +2539,14 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
sysbg.Blue() == colour.Blue())
|
sysbg.Blue() == colour.Blue())
|
||||||
{
|
{
|
||||||
m_backgroundColour = wxNullColour;
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
m_backgroundColour = sysbg;
|
m_backgroundColour = sysbg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
@@ -2567,14 +2568,14 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
if (!m_foregroundColour.Ok()) return;
|
if (!m_foregroundColour.Ok()) return;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
sysbg.Blue() == colour.Blue())
|
sysbg.Blue() == colour.Blue())
|
||||||
{
|
{
|
||||||
m_backgroundColour = wxNullColour;
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
m_backgroundColour = sysbg;
|
m_backgroundColour = sysbg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
@@ -2634,9 +2635,9 @@ 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;
|
||||||
@@ -2670,9 +2671,9 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2729,10 +2730,10 @@ bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
|
|||||||
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" );
|
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" );
|
||||||
|
|
||||||
SetInvokingWindow( menu, this );
|
SetInvokingWindow( menu, this );
|
||||||
|
|
||||||
gs_pop_x = x;
|
gs_pop_x = x;
|
||||||
gs_pop_y = y;
|
gs_pop_y = y;
|
||||||
|
|
||||||
gtk_menu_popup(
|
gtk_menu_popup(
|
||||||
GTK_MENU(menu->m_menu),
|
GTK_MENU(menu->m_menu),
|
||||||
(GtkWidget *) NULL, // parent menu shell
|
(GtkWidget *) NULL, // parent menu shell
|
||||||
@@ -2792,14 +2793,14 @@ void wxWindow::SetFont( const wxFont &font )
|
|||||||
m_font = *wxSWISS_FONT;
|
m_font = *wxSWISS_FONT;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == m_backgroundColour.Red() &&
|
if (sysbg.Red() == m_backgroundColour.Red() &&
|
||||||
sysbg.Green() == m_backgroundColour.Green() &&
|
sysbg.Green() == m_backgroundColour.Green() &&
|
||||||
sysbg.Blue() == m_backgroundColour.Blue())
|
sysbg.Blue() == m_backgroundColour.Blue())
|
||||||
{
|
{
|
||||||
m_backgroundColour = wxNullColour;
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
m_backgroundColour = sysbg;
|
m_backgroundColour = sysbg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
@@ -2829,9 +2830,9 @@ void wxWindow::CaptureMouse()
|
|||||||
(GDK_BUTTON_PRESS_MASK |
|
(GDK_BUTTON_PRESS_MASK |
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3000,7 +3001,7 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
|
|||||||
if (fpos > m_vAdjust->upper - m_vAdjust->page_size) fpos = m_vAdjust->upper - m_vAdjust->page_size;
|
if (fpos > m_vAdjust->upper - m_vAdjust->page_size) fpos = m_vAdjust->upper - m_vAdjust->page_size;
|
||||||
if (fpos < 0.0) fpos = 0.0;
|
if (fpos < 0.0) fpos = 0.0;
|
||||||
m_oldVerticalPos = fpos;
|
m_oldVerticalPos = fpos;
|
||||||
|
|
||||||
if (fabs(fpos-m_vAdjust->value) < 0.2) return;
|
if (fabs(fpos-m_vAdjust->value) < 0.2) return;
|
||||||
m_vAdjust->value = fpos;
|
m_vAdjust->value = fpos;
|
||||||
}
|
}
|
||||||
@@ -3407,9 +3408,9 @@ void wxWindow::SetConstraintSizes(bool recurse)
|
|||||||
winName = "unnamed";
|
winName = "unnamed";
|
||||||
else
|
else
|
||||||
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" );
|
||||||
|
@@ -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
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -30,15 +30,15 @@ extern bool g_blockEventsOnDrag;
|
|||||||
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
|
||||||
{
|
{
|
||||||
if (!cb->HasVMT()) return;
|
if (!cb->HasVMT()) return;
|
||||||
|
|
||||||
if (cb->m_blockFirstEvent)
|
if (cb->m_blockFirstEvent)
|
||||||
{
|
{
|
||||||
cb->m_blockFirstEvent = FALSE;
|
cb->m_blockFirstEvent = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
|
||||||
event.SetInt( cb->GetValue() );
|
event.SetInt( cb->GetValue() );
|
||||||
event.SetEventObject(cb);
|
event.SetEventObject(cb);
|
||||||
@@ -56,50 +56,50 @@ wxCheckBox::wxCheckBox(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
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 )
|
long style, const wxValidator& validator, const wxString &name )
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = TRUE;
|
||||||
|
|
||||||
PreCreation( parent, id, pos, size, style, name );
|
PreCreation( parent, id, pos, size, style, name );
|
||||||
|
|
||||||
SetValidator( validator );
|
SetValidator( validator );
|
||||||
|
|
||||||
m_widget = gtk_check_button_new_with_label( m_label );
|
m_widget = gtk_check_button_new_with_label( m_label );
|
||||||
|
|
||||||
m_blockFirstEvent = FALSE;
|
m_blockFirstEvent = FALSE;
|
||||||
|
|
||||||
wxSize newSize = size;
|
wxSize newSize = size;
|
||||||
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
|
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
|
||||||
if (newSize.y == -1) newSize.y = 26;
|
if (newSize.y == -1) newSize.y = 26;
|
||||||
SetSize( newSize.x, newSize.y );
|
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 );
|
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->AddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
(m_parent->m_insertCallback)( m_parent, this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( GTK_BUTTON( m_widget )->child );
|
gtk_widget_realize( GTK_BUTTON( m_widget )->child );
|
||||||
|
|
||||||
SetLabel( label );
|
SetLabel( label );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::SetValue( bool state )
|
void wxCheckBox::SetValue( bool state )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
if ( state == GetValue() )
|
if ( state == GetValue() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ void wxCheckBox::SetLabel( const wxString& label )
|
|||||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
wxControl::SetLabel( label );
|
wxControl::SetLabel( label );
|
||||||
|
|
||||||
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
|
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" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
wxControl::Enable( enable );
|
wxControl::Enable( enable );
|
||||||
|
|
||||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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__
|
||||||
@@ -31,7 +31,7 @@ wxCheckListBox::wxCheckListBox() :
|
|||||||
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
int nStrings,
|
int nStrings,
|
||||||
const wxString choices[],
|
const wxString choices[],
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
@@ -44,18 +44,18 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
|||||||
bool wxCheckListBox::IsChecked( int index ) const
|
bool wxCheckListBox::IsChecked( int index ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
|
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, index );
|
GList *child = g_list_nth( m_list->children, index );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFAIL_MSG("wrong checklistbox index");
|
wxFAIL_MSG("wrong checklistbox index");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -63,31 +63,32 @@ bool wxCheckListBox::IsChecked( int index ) const
|
|||||||
void wxCheckListBox::Check( int index, bool check )
|
void wxCheckListBox::Check( int index, bool check )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
|
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, index );
|
GList *child = g_list_nth( m_list->children, index );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ extern bool g_blockEventsOnScroll;
|
|||||||
// "button_press_event"
|
// "button_press_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
|
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
|
||||||
{
|
{
|
||||||
if (g_blockEventsOnDrag) return FALSE;
|
if (g_blockEventsOnDrag) return FALSE;
|
||||||
@@ -56,24 +56,24 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
|||||||
if (!listbox->HasVMT()) return FALSE;
|
if (!listbox->HasVMT()) return FALSE;
|
||||||
|
|
||||||
int sel = listbox->GetIndex( widget );
|
int sel = listbox->GetIndex( widget );
|
||||||
|
|
||||||
if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS))
|
if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS))
|
||||||
{
|
{
|
||||||
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
||||||
|
|
||||||
clb->Check( sel, !clb->IsChecked(sel) );
|
clb->Check( sel, !clb->IsChecked(sel) );
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
event.SetInt( sel );
|
event.SetInt( sel );
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_event->type == GDK_2BUTTON_PRESS)
|
if (gdk_event->type == GDK_2BUTTON_PRESS)
|
||||||
{
|
{
|
||||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int count = listbox->GetSelections(aSelections);
|
int count = listbox->GetSelections(aSelections);
|
||||||
if ( count > 0 )
|
if ( count > 0 )
|
||||||
@@ -90,7 +90,7 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
|||||||
}
|
}
|
||||||
|
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
if (event.m_commandString) delete[] event.m_commandString ;
|
if (event.m_commandString) delete[] event.m_commandString ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event,
|
|||||||
// "key_press_event"
|
// "key_press_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
|
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
|
||||||
{
|
{
|
||||||
if (g_blockEventsOnDrag) return FALSE;
|
if (g_blockEventsOnDrag) return FALSE;
|
||||||
@@ -109,18 +109,18 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
|
|||||||
if (!listbox->HasVMT()) return FALSE;
|
if (!listbox->HasVMT()) return FALSE;
|
||||||
|
|
||||||
if (gdk_event->keyval != ' ') return FALSE;
|
if (gdk_event->keyval != ' ') return FALSE;
|
||||||
|
|
||||||
int sel = listbox->GetIndex( widget );
|
int sel = listbox->GetIndex( widget );
|
||||||
|
|
||||||
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
wxCheckListBox *clb = (wxCheckListBox *)listbox;
|
||||||
|
|
||||||
clb->Check( sel, !clb->IsChecked(sel) );
|
clb->Check( sel, !clb->IsChecked(sel) );
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
event.SetInt( sel );
|
event.SetInt( sel );
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
|
m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
|
||||||
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
|
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
|
||||||
|
|
||||||
m_list = GTK_LIST( gtk_list_new() );
|
m_list = GTK_LIST( gtk_list_new() );
|
||||||
|
|
||||||
GtkSelectionMode mode = GTK_SELECTION_BROWSE;
|
GtkSelectionMode mode = GTK_SELECTION_BROWSE;
|
||||||
@@ -202,7 +202,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
debug_focus_in( m_widget, "wxListBox::m_widget", name );
|
debug_focus_in( m_widget, "wxListBox::m_widget", name );
|
||||||
|
|
||||||
debug_focus_in( GTK_WIDGET(m_list), "wxListBox::m_list", name );
|
debug_focus_in( GTK_WIDGET(m_list), "wxListBox::m_list", name );
|
||||||
|
|
||||||
GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
|
GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
|
||||||
@@ -230,24 +230,24 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
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 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
@@ -257,28 +257,28 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||||
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 );
|
||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->AddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
(m_parent->m_insertCallback)( m_parent, this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( GTK_WIDGET(m_list) );
|
gtk_widget_realize( GTK_WIDGET(m_list) );
|
||||||
@@ -299,13 +299,13 @@ wxListBox::~wxListBox()
|
|||||||
void wxListBox::AppendCommon( const wxString &item )
|
void wxListBox::AppendCommon( const wxString &item )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_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
|
||||||
@@ -323,20 +323,20 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
gtk_container_add( GTK_CONTAINER(m_list), list_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 );
|
||||||
|
|
||||||
ConnectWidget( list_item );
|
ConnectWidget( list_item );
|
||||||
@@ -354,7 +354,7 @@ void wxListBox::Append( const wxString &item )
|
|||||||
{
|
{
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
AppendCommon( item );
|
AppendCommon( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ void wxListBox::Append( const wxString &item, void *clientData )
|
|||||||
{
|
{
|
||||||
m_clientDataList.Append( (wxObject*) clientData );
|
m_clientDataList.Append( (wxObject*) clientData );
|
||||||
m_clientObjectList.Append( (wxObject*) NULL );
|
m_clientObjectList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
AppendCommon( item );
|
AppendCommon( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,50 +370,50 @@ void wxListBox::Append( const wxString &item, wxClientData *clientData )
|
|||||||
{
|
{
|
||||||
m_clientObjectList.Append( (wxObject*) clientData );
|
m_clientObjectList.Append( (wxObject*) clientData );
|
||||||
m_clientDataList.Append( (wxObject*) NULL );
|
m_clientDataList.Append( (wxObject*) NULL );
|
||||||
|
|
||||||
AppendCommon( item );
|
AppendCommon( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetClientData( int n, void* clientData )
|
void wxListBox::SetClientData( int n, void* clientData )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientDataList.Nth( n );
|
wxNode *node = m_clientDataList.Nth( n );
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
node->SetData( (wxObject*) clientData );
|
node->SetData( (wxObject*) clientData );
|
||||||
}
|
}
|
||||||
|
|
||||||
void* wxListBox::GetClientData( int n )
|
void* wxListBox::GetClientData( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
|
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientDataList.Nth( n );
|
wxNode *node = m_clientDataList.Nth( n );
|
||||||
if (!node) return NULL;
|
if (!node) return NULL;
|
||||||
|
|
||||||
return node->Data();
|
return node->Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetClientObject( int n, wxClientData* clientData )
|
void wxListBox::SetClientObject( int n, wxClientData* clientData )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientObjectList.Nth( n );
|
wxNode *node = m_clientObjectList.Nth( n );
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
wxClientData *cd = (wxClientData*) node->Data();
|
wxClientData *cd = (wxClientData*) node->Data();
|
||||||
if (cd) delete cd;
|
if (cd) delete cd;
|
||||||
|
|
||||||
node->SetData( (wxObject*) clientData );
|
node->SetData( (wxObject*) clientData );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClientData* wxListBox::GetClientObject( int n )
|
wxClientData* wxListBox::GetClientObject( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
|
||||||
|
|
||||||
wxNode *node = m_clientObjectList.Nth( n );
|
wxNode *node = m_clientObjectList.Nth( n );
|
||||||
if (!node) return (wxClientData*) NULL;
|
if (!node) return (wxClientData*) NULL;
|
||||||
|
|
||||||
return (wxClientData*) node->Data();
|
return (wxClientData*) node->Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +431,7 @@ void wxListBox::Clear()
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
m_clientObjectList.Clear();
|
m_clientObjectList.Clear();
|
||||||
|
|
||||||
m_clientDataList.Clear();
|
m_clientDataList.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ void wxListBox::Delete( int n )
|
|||||||
if (cd) delete cd;
|
if (cd) delete cd;
|
||||||
m_clientObjectList.DeleteNode( node );
|
m_clientObjectList.DeleteNode( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
node = m_clientDataList.Nth( n );
|
node = m_clientDataList.Nth( n );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
@@ -472,19 +472,19 @@ void wxListBox::Deselect( int n )
|
|||||||
int wxListBox::FindString( const wxString &item ) const
|
int wxListBox::FindString( const wxString &item ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
@@ -497,7 +497,7 @@ int wxListBox::FindString( const wxString &item ) const
|
|||||||
int wxListBox::GetSelection() const
|
int wxListBox::GetSelection() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child)
|
while (child)
|
||||||
@@ -512,7 +512,7 @@ int wxListBox::GetSelection() const
|
|||||||
int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
// get the number of selected items first
|
// get the number of selected items first
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -524,7 +524,7 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
|||||||
|
|
||||||
aSelections.Empty();
|
aSelections.Empty();
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
// now fill the list
|
// now fill the list
|
||||||
aSelections.Alloc(count); // optimization attempt
|
aSelections.Alloc(count); // optimization attempt
|
||||||
@@ -542,16 +542,16 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const
|
|||||||
wxString wxListBox::GetString( int n ) const
|
wxString wxListBox::GetString( int n ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
wxFAIL_MSG("wrong listbox index");
|
wxFAIL_MSG("wrong listbox index");
|
||||||
@@ -561,19 +561,19 @@ wxString wxListBox::GetString( int n ) const
|
|||||||
wxString wxListBox::GetStringSelection() const
|
wxString wxListBox::GetStringSelection() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, "", "invalid listbox" );
|
||||||
|
|
||||||
GList *selection = m_list->selection;
|
GList *selection = m_list->selection;
|
||||||
if (selection)
|
if (selection)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFAIL_MSG("no listbox selection available");
|
wxFAIL_MSG("no listbox selection available");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -581,7 +581,7 @@ wxString wxListBox::GetStringSelection() const
|
|||||||
int wxListBox::Number()
|
int wxListBox::Number()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (child) { count++; child = child->next; }
|
while (child) { count++; child = child->next; }
|
||||||
@@ -591,7 +591,7 @@ int wxListBox::Number()
|
|||||||
bool wxListBox::Selected( int n )
|
bool wxListBox::Selected( int n )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" );
|
wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" );
|
||||||
|
|
||||||
GList *target = g_list_nth( m_list->children, n );
|
GList *target = g_list_nth( m_list->children, n );
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
@@ -624,7 +624,7 @@ void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
|
|||||||
void wxListBox::SetSelection( int n, bool select )
|
void wxListBox::SetSelection( int n, bool select )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
if (select)
|
if (select)
|
||||||
gtk_list_select_item( m_list, n );
|
gtk_list_select_item( m_list, n );
|
||||||
else
|
else
|
||||||
@@ -634,29 +634,29 @@ void wxListBox::SetSelection( int n, bool select )
|
|||||||
void wxListBox::SetString( int n, const wxString &string )
|
void wxListBox::SetString( int n, const wxString &string )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
GList *child = g_list_nth( m_list->children, n );
|
GList *child = g_list_nth( m_list->children, n );
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFAIL_MSG("wrong listbox index");
|
wxFAIL_MSG("wrong listbox index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
void wxListBox::SetStringSelection( const wxString &string, bool select )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
SetSelection( FindString(string), select );
|
SetSelection( FindString(string), select );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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,24 +686,25 @@ 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 )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
wxCHECK_RET( m_list != NULL, "invalid listbox" );
|
||||||
|
|
||||||
#ifndef NEW_GTK_DND_CODE
|
#ifndef NEW_GTK_DND_CODE
|
||||||
if (m_dropTarget)
|
if (m_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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxWindow::SetDropTarget( dropTarget );
|
wxWindow::SetDropTarget( dropTarget );
|
||||||
|
|
||||||
#ifndef NEW_GTK_DND_CODE
|
#ifndef NEW_GTK_DND_CODE
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -742,7 +744,7 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
void wxListBox::ApplyWidgetStyle()
|
void wxListBox::ApplyWidgetStyle()
|
||||||
{
|
{
|
||||||
SetWidgetStyle();
|
SetWidgetStyle();
|
||||||
|
|
||||||
if (m_backgroundColour.Ok())
|
if (m_backgroundColour.Ok())
|
||||||
{
|
{
|
||||||
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
||||||
@@ -750,16 +752,16 @@ void wxListBox::ApplyWidgetStyle()
|
|||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
|
||||||
|
|
||||||
GtkBin *bin = GTK_BIN( child->data );
|
GtkBin *bin = GTK_BIN( child->data );
|
||||||
GtkWidget *label = GTK_WIDGET( bin->child );
|
GtkWidget *label = GTK_WIDGET( bin->child );
|
||||||
gtk_widget_set_style( label, m_widgetStyle );
|
gtk_widget_set_style( label, m_widgetStyle );
|
||||||
|
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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"
|
||||||
@@ -23,7 +24,7 @@
|
|||||||
static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
|
static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
|
||||||
static GdkColor ss_bg;
|
static GdkColor ss_bg;
|
||||||
static GdkColor ss_fg;
|
static GdkColor ss_fg;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolTip
|
// wxToolTip
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -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;
|
||||||
@@ -57,22 +48,22 @@ void wxToolTip::Apply( wxWindow *win )
|
|||||||
if (!ss_tooltips)
|
if (!ss_tooltips)
|
||||||
{
|
{
|
||||||
ss_tooltips = gtk_tooltips_new();
|
ss_tooltips = gtk_tooltips_new();
|
||||||
|
|
||||||
ss_fg.red = 0;
|
ss_fg.red = 0;
|
||||||
ss_fg.green = 0;
|
ss_fg.green = 0;
|
||||||
ss_fg.blue = 0;
|
ss_fg.blue = 0;
|
||||||
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg );
|
gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg );
|
||||||
|
|
||||||
ss_bg.red = 65535;
|
ss_bg.red = 65535;
|
||||||
ss_bg.green = 65535;
|
ss_bg.green = 65535;
|
||||||
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;
|
||||||
|
|
||||||
if (m_text.IsEmpty())
|
if (m_text.IsEmpty())
|
||||||
m_window->ApplyToolTip( ss_tooltips, (char*) NULL );
|
m_window->ApplyToolTip( ss_tooltips, (char*) NULL );
|
||||||
else
|
else
|
||||||
@@ -82,7 +73,7 @@ void wxToolTip::Apply( wxWindow *win )
|
|||||||
void wxToolTip::Enable( bool flag )
|
void wxToolTip::Enable( bool flag )
|
||||||
{
|
{
|
||||||
if (!ss_tooltips) return;
|
if (!ss_tooltips) return;
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
gtk_tooltips_enable( ss_tooltips );
|
gtk_tooltips_enable( ss_tooltips );
|
||||||
else
|
else
|
||||||
@@ -92,7 +83,7 @@ void wxToolTip::Enable( bool flag )
|
|||||||
void wxToolTip::SetDelay( long msecs )
|
void wxToolTip::SetDelay( long msecs )
|
||||||
{
|
{
|
||||||
if (!ss_tooltips) return;
|
if (!ss_tooltips) return;
|
||||||
|
|
||||||
gtk_tooltips_set_delay( ss_tooltips, msecs );
|
gtk_tooltips_set_delay( ss_tooltips, msecs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,14 +132,14 @@
|
|||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
|
||||||
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 );
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,9 +150,9 @@ void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
|
|||||||
wxString tmp = name;
|
wxString tmp = name;
|
||||||
tmp += " FROM ";
|
tmp += " FROM ";
|
||||||
tmp += window;
|
tmp += window;
|
||||||
|
|
||||||
char *s = new char[tmp.Length()+1];
|
char *s = new char[tmp.Length()+1];
|
||||||
|
|
||||||
strcpy( s, WXSTRINGCAST tmp );
|
strcpy( s, WXSTRINGCAST tmp );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
|
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
|
||||||
@@ -345,38 +345,38 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
ancestor = ancestor->GetParent();
|
ancestor = ancestor->GetParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// win is a control: tab can be propagated up
|
// win is a control: tab can be propagated up
|
||||||
if ((!ret) && (gdk_event->keyval == GDK_Tab))
|
if ((!ret) && (gdk_event->keyval == GDK_Tab))
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// win is a panel: up can be propagated to the panel
|
// win is a panel: up can be propagated to the panel
|
||||||
if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
|
if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
|
||||||
(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
|
||||||
if ((!ret) && (win->m_wxwindow) &&
|
if ((!ret) && (win->m_wxwindow) &&
|
||||||
((gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Left) ||
|
((gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Left) ||
|
||||||
(gdk_event->keyval == GDK_Up) || (gdk_event->keyval == GDK_Down)))
|
(gdk_event->keyval == GDK_Up) || (gdk_event->keyval == GDK_Down)))
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||||
@@ -588,37 +588,37 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
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,12 +627,12 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint pt(win->GetClientAreaOrigin());
|
wxPoint pt(win->GetClientAreaOrigin());
|
||||||
event.m_x -= pt.x;
|
event.m_x -= pt.x;
|
||||||
event.m_y -= pt.y;
|
event.m_y -= pt.y;
|
||||||
@@ -696,37 +696,37 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
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();
|
||||||
}
|
}
|
||||||
@@ -759,7 +759,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
|
|
||||||
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
|
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
|
||||||
{
|
{
|
||||||
if (gdk_event->is_hint)
|
if (gdk_event->is_hint)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
@@ -769,7 +769,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
gdk_event->y = y;
|
gdk_event->y = y;
|
||||||
gdk_event->state = state;
|
gdk_event->state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return TRUE;
|
if (g_blockEventsOnDrag) return TRUE;
|
||||||
@@ -805,37 +805,37 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
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();
|
||||||
}
|
}
|
||||||
@@ -869,9 +869,9 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
|
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
|
||||||
{
|
{
|
||||||
if (g_blockEventsOnDrag) return TRUE;
|
if (g_blockEventsOnDrag) return TRUE;
|
||||||
|
|
||||||
g_focusWindow = win;
|
g_focusWindow = win;
|
||||||
|
|
||||||
if (win->m_wxwindow)
|
if (win->m_wxwindow)
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
|
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
|
||||||
@@ -961,13 +961,13 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
|
|
||||||
wxMouseEvent event( wxEVT_ENTER_WINDOW );
|
wxMouseEvent event( wxEVT_ENTER_WINDOW );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
GdkModifierType state = (GdkModifierType)0;
|
GdkModifierType state = (GdkModifierType)0;
|
||||||
|
|
||||||
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
||||||
|
|
||||||
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
||||||
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
||||||
event.m_altDown = (state & GDK_MOD1_MASK);
|
event.m_altDown = (state & GDK_MOD1_MASK);
|
||||||
@@ -978,7 +978,7 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
|
|
||||||
event.m_x = (long)x;
|
event.m_x = (long)x;
|
||||||
event.m_y = (long)y;
|
event.m_y = (long)y;
|
||||||
|
|
||||||
wxPoint pt(win->GetClientAreaOrigin());
|
wxPoint pt(win->GetClientAreaOrigin());
|
||||||
event.m_x -= pt.x;
|
event.m_x -= pt.x;
|
||||||
event.m_y -= pt.y;
|
event.m_y -= pt.y;
|
||||||
@@ -1017,9 +1017,9 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
GdkModifierType state = (GdkModifierType)0;
|
GdkModifierType state = (GdkModifierType)0;
|
||||||
|
|
||||||
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
gdk_window_get_pointer( widget->window, &x, &y, &state );
|
||||||
|
|
||||||
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
event.m_shiftDown = (state & GDK_SHIFT_MASK);
|
||||||
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
event.m_controlDown = (state & GDK_CONTROL_MASK);
|
||||||
event.m_altDown = (state & GDK_MOD1_MASK);
|
event.m_altDown = (state & GDK_MOD1_MASK);
|
||||||
@@ -1030,7 +1030,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
|
|||||||
|
|
||||||
event.m_x = (long)x;
|
event.m_x = (long)x;
|
||||||
event.m_y = (long)y;
|
event.m_y = (long)y;
|
||||||
|
|
||||||
wxPoint pt(win->GetClientAreaOrigin());
|
wxPoint pt(win->GetClientAreaOrigin());
|
||||||
event.m_x -= pt.x;
|
event.m_x -= pt.x;
|
||||||
event.m_y -= pt.y;
|
event.m_y -= pt.y;
|
||||||
@@ -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,23 +1246,23 @@ 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))
|
||||||
{
|
{
|
||||||
parent->m_sizeSet = FALSE;
|
parent->m_sizeSet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1347,11 +1347,13 @@ wxWindow::wxWindow()
|
|||||||
|
|
||||||
m_clientObject = (wxClientData*) NULL;
|
m_clientObject = (wxClientData*) NULL;
|
||||||
m_clientData = NULL;
|
m_clientData = NULL;
|
||||||
|
|
||||||
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,
|
||||||
@@ -1374,7 +1376,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
|
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
debug_focus_in( m_widget, "wxWindow::m_widget", name );
|
debug_focus_in( m_widget, "wxWindow::m_widget", name );
|
||||||
#endif
|
#endif
|
||||||
@@ -1431,8 +1433,8 @@ 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;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -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 );
|
||||||
@@ -1641,9 +1645,12 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_clientObject = (wxClientData*)NULL;
|
m_clientObject = (wxClientData*)NULL;
|
||||||
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()
|
||||||
@@ -2089,7 +2096,7 @@ void wxWindow::Fit()
|
|||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetClientSize(maxX + 7, maxY + 14);
|
SetClientSize(maxX + 7, maxY + 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2116,9 +2123,9 @@ bool wxWindow::Show( bool show )
|
|||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
else
|
else
|
||||||
gtk_widget_hide( m_widget );
|
gtk_widget_hide( m_widget );
|
||||||
|
|
||||||
m_isShown = show;
|
m_isShown = show;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2127,7 +2134,7 @@ void wxWindow::Enable( bool enable )
|
|||||||
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
||||||
|
|
||||||
m_isEnabled = enable;
|
m_isEnabled = enable;
|
||||||
|
|
||||||
gtk_widget_set_sensitive( m_widget, enable );
|
gtk_widget_set_sensitive( m_widget, enable );
|
||||||
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
|
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
|
||||||
}
|
}
|
||||||
@@ -2139,7 +2146,7 @@ int wxWindow::GetCharHeight() const
|
|||||||
wxCHECK_MSG( m_font.Ok(), 12, "invalid font" );
|
wxCHECK_MSG( m_font.Ok(), 12, "invalid font" );
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return font->ascent + font->descent;
|
return font->ascent + font->descent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2150,7 +2157,7 @@ int wxWindow::GetCharWidth() const
|
|||||||
wxCHECK_MSG( m_font.Ok(), 8, "invalid font" );
|
wxCHECK_MSG( m_font.Ok(), 8, "invalid font" );
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
GdkFont *font = m_font.GetInternalFont( 1.0 );
|
||||||
|
|
||||||
return gdk_string_width( font, "H" );
|
return gdk_string_width( font, "H" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2172,7 +2179,7 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
|
|||||||
void wxWindow::MakeModal( bool modal )
|
void wxWindow::MakeModal( bool modal )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Disable all other windows
|
// Disable all other windows
|
||||||
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
|
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
|
||||||
{
|
{
|
||||||
@@ -2190,7 +2197,7 @@ void wxWindow::MakeModal( bool modal )
|
|||||||
void wxWindow::OnKeyDown( wxKeyEvent &event )
|
void wxWindow::OnKeyDown( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
event.SetEventType( wxEVT_CHAR );
|
event.SetEventType( wxEVT_CHAR );
|
||||||
|
|
||||||
if (!GetEventHandler()->ProcessEvent( event ))
|
if (!GetEventHandler()->ProcessEvent( event ))
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
@@ -2200,7 +2207,7 @@ void wxWindow::OnKeyDown( wxKeyEvent &event )
|
|||||||
void wxWindow::SetFocus()
|
void wxWindow::SetFocus()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
wxCHECK_RET( (m_widget != NULL), "invalid window" );
|
||||||
|
|
||||||
GtkWidget *connect_widget = GetConnectWidget();
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
if (connect_widget)
|
if (connect_widget)
|
||||||
{
|
{
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2244,7 +2251,7 @@ void wxWindow::AddChild( wxWindow *child )
|
|||||||
wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" );
|
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" );
|
||||||
|
|
||||||
wxWindow *oldParent = GetParent();
|
wxWindow *oldParent = GetParent();
|
||||||
|
|
||||||
if (oldParent) oldParent->RemoveChild( this );
|
if (oldParent) oldParent->RemoveChild( this );
|
||||||
@@ -2418,12 +2425,12 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rect)
|
if (!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())
|
|
||||||
{
|
|
||||||
delete m_toolTip;
|
|
||||||
m_toolTip = (wxToolTip*) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setting empty tooltip text does not remove the tooltip any more for
|
||||||
|
// wxMSW compatibility - use SetToolTip((wxToolTip *)NULL) for this
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetToolTip( wxToolTip *tip )
|
void wxWindow::SetToolTip( wxToolTip *tip )
|
||||||
@@ -2499,21 +2503,18 @@ void wxWindow::SetToolTip( wxToolTip *tip )
|
|||||||
m_toolTip->SetTip( (char*) NULL );
|
m_toolTip->SetTip( (char*) NULL );
|
||||||
delete m_toolTip;
|
delete m_toolTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
@@ -2538,14 +2539,14 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
sysbg.Blue() == colour.Blue())
|
sysbg.Blue() == colour.Blue())
|
||||||
{
|
{
|
||||||
m_backgroundColour = wxNullColour;
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
m_backgroundColour = sysbg;
|
m_backgroundColour = sysbg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
@@ -2567,14 +2568,14 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
if (!m_foregroundColour.Ok()) return;
|
if (!m_foregroundColour.Ok()) return;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
sysbg.Blue() == colour.Blue())
|
sysbg.Blue() == colour.Blue())
|
||||||
{
|
{
|
||||||
m_backgroundColour = wxNullColour;
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
m_backgroundColour = sysbg;
|
m_backgroundColour = sysbg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
@@ -2634,9 +2635,9 @@ 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;
|
||||||
@@ -2670,9 +2671,9 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2729,10 +2730,10 @@ bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
|
|||||||
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" );
|
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" );
|
||||||
|
|
||||||
SetInvokingWindow( menu, this );
|
SetInvokingWindow( menu, this );
|
||||||
|
|
||||||
gs_pop_x = x;
|
gs_pop_x = x;
|
||||||
gs_pop_y = y;
|
gs_pop_y = y;
|
||||||
|
|
||||||
gtk_menu_popup(
|
gtk_menu_popup(
|
||||||
GTK_MENU(menu->m_menu),
|
GTK_MENU(menu->m_menu),
|
||||||
(GtkWidget *) NULL, // parent menu shell
|
(GtkWidget *) NULL, // parent menu shell
|
||||||
@@ -2792,14 +2793,14 @@ void wxWindow::SetFont( const wxFont &font )
|
|||||||
m_font = *wxSWISS_FONT;
|
m_font = *wxSWISS_FONT;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == m_backgroundColour.Red() &&
|
if (sysbg.Red() == m_backgroundColour.Red() &&
|
||||||
sysbg.Green() == m_backgroundColour.Green() &&
|
sysbg.Green() == m_backgroundColour.Green() &&
|
||||||
sysbg.Blue() == m_backgroundColour.Blue())
|
sysbg.Blue() == m_backgroundColour.Blue())
|
||||||
{
|
{
|
||||||
m_backgroundColour = wxNullColour;
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
m_backgroundColour = sysbg;
|
m_backgroundColour = sysbg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
@@ -2829,9 +2830,9 @@ void wxWindow::CaptureMouse()
|
|||||||
(GDK_BUTTON_PRESS_MASK |
|
(GDK_BUTTON_PRESS_MASK |
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3000,7 +3001,7 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
|
|||||||
if (fpos > m_vAdjust->upper - m_vAdjust->page_size) fpos = m_vAdjust->upper - m_vAdjust->page_size;
|
if (fpos > m_vAdjust->upper - m_vAdjust->page_size) fpos = m_vAdjust->upper - m_vAdjust->page_size;
|
||||||
if (fpos < 0.0) fpos = 0.0;
|
if (fpos < 0.0) fpos = 0.0;
|
||||||
m_oldVerticalPos = fpos;
|
m_oldVerticalPos = fpos;
|
||||||
|
|
||||||
if (fabs(fpos-m_vAdjust->value) < 0.2) return;
|
if (fabs(fpos-m_vAdjust->value) < 0.2) return;
|
||||||
m_vAdjust->value = fpos;
|
m_vAdjust->value = fpos;
|
||||||
}
|
}
|
||||||
@@ -3407,9 +3408,9 @@ void wxWindow::SetConstraintSizes(bool recurse)
|
|||||||
winName = "unnamed";
|
winName = "unnamed";
|
||||||
else
|
else
|
||||||
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" );
|
||||||
|
Reference in New Issue
Block a user