1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/gtk/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
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-04-12 10:57:41 -04:00
|
|
|
#ifndef _WX_GTK_LISTBOX_H_
|
|
|
|
#define _WX_GTK_LISTBOX_H_
|
|
|
|
|
|
|
|
struct _GtkTreeEntry;
|
|
|
|
struct _GtkTreeIter;
|
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
|
2006-03-11 08:24:07 -05:00
|
|
|
wxListBox()
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
1999-02-01 09:40:53 -05:00
|
|
|
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 )
|
|
|
|
{
|
2006-03-11 08:24:07 -05:00
|
|
|
Init();
|
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 )
|
|
|
|
{
|
2006-03-11 08:24:07 -05:00
|
|
|
Init();
|
2004-01-31 13:21:45 -05:00
|
|
|
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
|
|
|
|
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;
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
|
|
|
|
2008-02-11 11:03:23 -05:00
|
|
|
virtual void EnsureVisible(int n);
|
|
|
|
|
2008-07-02 04:15:28 -04:00
|
|
|
virtual void Update();
|
|
|
|
|
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-02-01 09:40:53 -05:00
|
|
|
GtkWidget *GetConnectWidget();
|
|
|
|
|
|
|
|
#if wxUSE_TOOLTIPS
|
2009-02-13 05:10:36 -05:00
|
|
|
void GTKApplyToolTip( GtkTooltips *tips, const gchar *tip );
|
1999-02-01 09:40:53 -05:00
|
|
|
#endif // wxUSE_TOOLTIPS
|
|
|
|
|
2006-03-01 16:51:42 -05:00
|
|
|
struct _GtkTreeView *m_treeview;
|
|
|
|
struct _GtkListStore *m_liststore;
|
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
|
|
|
|
2007-04-12 10:57:41 -04:00
|
|
|
struct _GtkTreeEntry* GtkGetEntry(unsigned pos) const;
|
2008-05-22 16:53:10 -04:00
|
|
|
|
|
|
|
void GtkDisableEvents();
|
|
|
|
void GtkEnableEvents();
|
2002-05-31 10:00:01 -04:00
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
protected:
|
2007-10-26 02:20:23 -04:00
|
|
|
virtual void DoClear();
|
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
1999-11-19 16:01:20 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2006-08-25 08:59:28 -04:00
|
|
|
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
|
|
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
|
|
|
|
2006-02-08 16:47:09 -05:00
|
|
|
virtual void DoSetSelection(int n, bool select);
|
2007-07-26 09:54:14 -04:00
|
|
|
|
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
|
|
|
|
2006-02-08 16:47:09 -05: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;
|
2006-03-09 07:48:52 -05:00
|
|
|
virtual int DoListHitTest(const wxPoint& point) const;
|
|
|
|
|
2007-04-12 10:57:41 -04:00
|
|
|
// get the iterator for the given index, returns false if invalid
|
|
|
|
bool GtkGetIteratorFor(unsigned pos, _GtkTreeIter *iter) const;
|
|
|
|
|
|
|
|
// get the index for the given iterator, return wxNOT_FOUND on failure
|
|
|
|
int GtkGetIndexFor(_GtkTreeIter& iter) const;
|
|
|
|
|
|
|
|
// set the specified item
|
|
|
|
void GtkSetItem(_GtkTreeIter& iter, const _GtkTreeEntry *entry);
|
|
|
|
|
2008-02-11 11:03:23 -05:00
|
|
|
// common part of DoSetFirstItem() and EnsureVisible()
|
|
|
|
void DoScrollToCell(int n, float alignY, float alignX);
|
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
private:
|
2006-03-13 04:37:23 -05:00
|
|
|
void Init(); //common construction
|
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
|
|
|
};
|
1999-06-14 19:04:05 -04:00
|
|
|
|
2007-04-12 10:57:41 -04:00
|
|
|
#endif // _WX_GTK_LISTBOX_H_
|