1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: listbox.h
|
1999-02-01 14:40:53 +00:00
|
|
|
// Purpose: wxListBox class declaration
|
1998-05-20 14:01:55 +00:00
|
|
|
// Author: Robert Roebling
|
1998-10-29 18:03:18 +00:00
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
1999-02-01 14:40:53 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKLISTBOXH__
|
|
|
|
#define __GTKLISTBOXH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/list.h"
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxListBox;
|
1998-08-07 15:09:04 +00:00
|
|
|
class wxArrayInt;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern const char *wxListBoxNameStr;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-11-06 08:50:52 +00:00
|
|
|
class wxListBox : public wxControl
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-02-01 14:40:53 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1998-11-06 08:50:52 +00:00
|
|
|
public:
|
1999-02-01 14:40:53 +00:00
|
|
|
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 );
|
|
|
|
|
1999-02-25 14:47:18 +00:00
|
|
|
void InsertItems(int nItems, const wxString items[], int pos);
|
|
|
|
|
1999-02-01 14:40:53 +00:00
|
|
|
void SetClientData( int n, void* clientData );
|
|
|
|
void* GetClientData( int n );
|
|
|
|
void SetClientObject( int n, wxClientData* clientData );
|
|
|
|
wxClientData* GetClientObject( int n );
|
|
|
|
|
1999-05-12 20:26:54 +00:00
|
|
|
void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); }
|
|
|
|
wxClientData *GetClientObject() const { return wxControl::GetClientObject(); }
|
|
|
|
void SetClientData( void *data ) { wxControl::SetClientData( data ); }
|
|
|
|
void *GetClientData() const { return wxControl::GetClientData(); }
|
|
|
|
|
1999-02-01 14:40:53 +00:00
|
|
|
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 );
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-01-06 21:09:17 +00:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
1999-02-01 14:40:53 +00:00
|
|
|
void SetDropTarget( wxDropTarget *dropTarget );
|
1999-01-04 13:52:06 +00:00
|
|
|
#endif
|
1998-07-04 15:17:59 +00:00
|
|
|
|
1999-02-01 14:40:53 +00:00
|
|
|
// implementation
|
|
|
|
|
|
|
|
void AppendCommon( const wxString &item );
|
|
|
|
int GetIndex( GtkWidget *item ) const;
|
|
|
|
GtkWidget *GetConnectWidget();
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
|
|
|
void ApplyWidgetStyle();
|
|
|
|
|
|
|
|
#if wxUSE_TOOLTIPS
|
1999-04-21 21:46:02 +00:00
|
|
|
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
1999-02-01 14:40:53 +00:00
|
|
|
#endif // wxUSE_TOOLTIPS
|
|
|
|
|
|
|
|
GtkList *m_list;
|
|
|
|
wxList m_clientDataList;
|
|
|
|
wxList m_clientObjectList;
|
|
|
|
bool m_hasCheckBoxes;
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GTKLISTBOXH__
|