1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: listbox.h
|
1999-02-01 09:40:53 -05:00
|
|
|
// Purpose: wxListBox class declaration
|
1998-05-20 10:01:55 -04:00
|
|
|
// Author: Robert Roebling
|
1998-10-29 13:03:18 -05:00
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKLISTBOXH__
|
|
|
|
#define __GTKLISTBOXH__
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
2002-05-11 13:13:20 -04:00
|
|
|
#pragma interface "listbox.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
2003-07-20 15:32:44 -04:00
|
|
|
class WXDLLIMPEXP_BASE wxSortedArrayString;
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
class wxListBox : public wxListBoxBase
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1998-11-06 03:50:52 -05:00
|
|
|
public:
|
1999-10-22 11:55:27 -04:00
|
|
|
// ctors and such
|
1999-02-01 09:40:53 -05: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 )
|
|
|
|
{
|
1999-06-01 11:32:12 -04:00
|
|
|
#if wxUSE_CHECKLISTBOX
|
1999-02-01 09:40:53 -05:00
|
|
|
m_hasCheckBoxes = FALSE;
|
1999-06-01 11:32:12 -04:00
|
|
|
#endif // wxUSE_CHECKLISTBOX
|
1999-02-01 09:40:53 -05:00
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 13:21:45 -05:00
|
|
|
wxListBox( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr )
|
|
|
|
{
|
|
|
|
#if wxUSE_CHECKLISTBOX
|
|
|
|
m_hasCheckBoxes = FALSE;
|
|
|
|
#endif // wxUSE_CHECKLISTBOX
|
|
|
|
Create(parent, id, pos, size, choices, style, validator, name);
|
|
|
|
}
|
1999-02-01 09:40:53 -05:00
|
|
|
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);
|
2004-01-31 13:21:45 -05:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr);
|
1999-02-01 09:40:53 -05:00
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual void Clear();
|
|
|
|
virtual void Delete(int n);
|
|
|
|
|
|
|
|
virtual int GetCount() const;
|
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
virtual void SetString(int n, const wxString& s);
|
|
|
|
virtual int FindString(const wxString& s) const;
|
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
|
|
|
virtual void SetSelection(int n, bool select = TRUE);
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
|
|
|
|
|
|
|
virtual int DoAppend(const wxString& item);
|
|
|
|
virtual void DoInsertItems(const wxArrayString& items, int pos);
|
|
|
|
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
|
|
|
|
|
|
|
virtual void DoSetFirstItem(int n);
|
|
|
|
|
1999-10-22 14:00:39 -04:00
|
|
|
virtual void DoSetItemClientData(int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(int n) const;
|
|
|
|
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
|
|
|
virtual wxClientData* DoGetItemClientObject(int n) const;
|
1999-10-22 11:55:27 -04:00
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
// implementation from now on
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-10-24 12:45:01 -04:00
|
|
|
void GtkAddItem( const wxString &item, int pos=-1 );
|
|
|
|
int GtkGetIndex( GtkWidget *item ) const;
|
1999-02-01 09:40:53 -05:00
|
|
|
GtkWidget *GetConnectWidget();
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
|
|
|
void ApplyWidgetStyle();
|
1999-09-30 18:13:45 -04:00
|
|
|
void OnInternalIdle();
|
1999-02-01 09:40:53 -05:00
|
|
|
|
|
|
|
#if wxUSE_TOOLTIPS
|
1999-04-21 17:46:02 -04:00
|
|
|
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
1999-02-01 09:40:53 -05:00
|
|
|
#endif // wxUSE_TOOLTIPS
|
|
|
|
|
|
|
|
GtkList *m_list;
|
1999-10-24 12:45:01 -04:00
|
|
|
wxList m_clientList;
|
1999-06-01 11:32:12 -04:00
|
|
|
|
|
|
|
#if wxUSE_CHECKLISTBOX
|
1999-02-01 09:40:53 -05:00
|
|
|
bool m_hasCheckBoxes;
|
1999-06-01 11:32:12 -04:00
|
|
|
#endif // wxUSE_CHECKLISTBOX
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2001-11-17 17:32:15 -05:00
|
|
|
int m_prevSelection;
|
|
|
|
bool m_blockEvent;
|
2002-09-04 09:45:39 -04:00
|
|
|
|
2002-05-31 10:00:01 -04:00
|
|
|
virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
|
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
protected:
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2002-09-04 09:45:39 -04:00
|
|
|
// return the string label for the given item
|
|
|
|
wxString GetRealLabel(struct _GList *item) const;
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
// Widgets that use the style->base colour for the BG colour should
|
|
|
|
// override this and return true.
|
|
|
|
virtual bool UseGTKStyleBase() const { return true; }
|
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
private:
|
|
|
|
// this array is only used for controls with wxCB_SORT style, so only
|
|
|
|
// allocate it if it's needed (hence using pointer)
|
|
|
|
wxSortedArrayString *m_strings;
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
|
|
|
};
|
1999-06-14 19:04:05 -04:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif // __GTKLISTBOXH__
|