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/list.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
1999-11-19 21:01:20 +00:00
|
|
|
protected:
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
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__
|