1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-22 21:28:01 -05:00
|
|
|
// Name: wx/gtk1/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__
|
|
|
|
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
|
2003-07-20 15:32:44 -04:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE 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
|
2006-03-13 05:04:15 -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
|
2006-03-13 05:04:15 -05:00
|
|
|
m_hasCheckBoxes = false;
|
2004-01-31 13:21:45 -05:00
|
|
|
#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
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual void DoClear();
|
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
1999-10-22 11:55:27 -04:00
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual unsigned int GetCount() const;
|
|
|
|
virtual wxString GetString(unsigned int n) const;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& s);
|
2005-09-27 12:54:43 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
1999-10-22 11:55:27 -04:00
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
2005-02-13 12:08:27 -05:00
|
|
|
virtual void DoSetSelection(int n, bool select);
|
1999-10-22 11:55:27 -04:00
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
|
|
|
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
1999-10-22 11:55:27 -04:00
|
|
|
|
|
|
|
virtual void DoSetFirstItem(int n);
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned 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);
|
2005-09-27 12:54:43 -04:00
|
|
|
|
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 );
|
2004-06-14 13:34:00 -04:00
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
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__
|