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
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKLISTBOXH__
|
|
|
|
#define __GTKLISTBOXH__
|
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
2002-05-11 17:13:20 +00:00
|
|
|
#pragma interface "listbox.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
2003-07-20 19:32:44 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxSortedArrayString;
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-10-22 15:55:27 +00:00
|
|
|
class wxListBox : public wxListBoxBase
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1998-11-06 08:50:52 +00:00
|
|
|
public:
|
1999-10-22 15:55:27 +00:00
|
|
|
// ctors and such
|
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 )
|
|
|
|
{
|
1999-06-01 15:32:12 +00:00
|
|
|
#if wxUSE_CHECKLISTBOX
|
1999-02-01 14:40:53 +00:00
|
|
|
m_hasCheckBoxes = FALSE;
|
1999-06-01 15:32:12 +00:00
|
|
|
#endif // wxUSE_CHECKLISTBOX
|
1999-02-01 14:40:53 +00:00
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 18:21:45 +00: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 14:40:53 +00: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 18:21:45 +00: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 14:40:53 +00:00
|
|
|
|
1999-10-22 15:55:27 +00: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 18:00:39 +00: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 15:55:27 +00:00
|
|
|
|
2004-05-06 17:26:25 +00:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
|
|
|
|
1999-10-22 15:55:27 +00:00
|
|
|
// implementation from now on
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-10-24 16:45:01 +00:00
|
|
|
void GtkAddItem( const wxString &item, int pos=-1 );
|
|
|
|
int GtkGetIndex( GtkWidget *item ) const;
|
1999-02-01 14:40:53 +00:00
|
|
|
GtkWidget *GetConnectWidget();
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
|
|
|
void ApplyWidgetStyle();
|
1999-09-30 22:13:45 +00:00
|
|
|
void OnInternalIdle();
|
1999-02-01 14:40:53 +00:00
|
|
|
|
|
|
|
#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;
|
1999-10-24 16:45:01 +00:00
|
|
|
wxList m_clientList;
|
1999-06-01 15:32:12 +00:00
|
|
|
|
|
|
|
#if wxUSE_CHECKLISTBOX
|
1999-02-01 14:40:53 +00:00
|
|
|
bool m_hasCheckBoxes;
|
1999-06-01 15:32:12 +00:00
|
|
|
#endif // wxUSE_CHECKLISTBOX
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2001-11-17 22:32:15 +00:00
|
|
|
int m_prevSelection;
|
|
|
|
bool m_blockEvent;
|
2002-09-04 13:45:39 +00:00
|
|
|
|
2002-05-31 14:00:01 +00:00
|
|
|
virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
|
|
|
|
|
1999-11-19 21:01:20 +00:00
|
|
|
protected:
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2002-09-04 13:45:39 +00:00
|
|
|
// return the string label for the given item
|
|
|
|
wxString GetRealLabel(struct _GList *item) const;
|
|
|
|
|
2004-05-06 17:26:25 +00: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 15:55:27 +00: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 23:04:05 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif // __GTKLISTBOXH__
|