]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/listbox.h
1. corrected client data deletion in wxListBox (no more memory leaks in controls
[wxWidgets.git] / include / wx / gtk / listbox.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: listbox.h
ff8bfdbb 3// Purpose: wxListBox class declaration
c801d85f 4// Author: Robert Roebling
58614078
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
ff8bfdbb 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
10
11#ifndef __GTKLISTBOXH__
12#define __GTKLISTBOXH__
13
14#ifdef __GNUG__
15#pragma interface
16#endif
17
c801d85f 18#include "wx/list.h"
c801d85f
KB
19
20//-----------------------------------------------------------------------------
21// wxListBox
22//-----------------------------------------------------------------------------
23
2ee3ee1b 24class wxListBox : public wxListBoxBase
c801d85f 25{
fd0eed64 26public:
2ee3ee1b 27 // ctors and such
ff8bfdbb
VZ
28 wxListBox();
29 wxListBox( wxWindow *parent, wxWindowID id,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 int n = 0, const wxString choices[] = (const wxString *) NULL,
33 long style = 0,
34 const wxValidator& validator = wxDefaultValidator,
35 const wxString& name = wxListBoxNameStr )
36 {
88ac883a 37#if wxUSE_CHECKLISTBOX
ff8bfdbb 38 m_hasCheckBoxes = FALSE;
88ac883a 39#endif // wxUSE_CHECKLISTBOX
ff8bfdbb
VZ
40 Create(parent, id, pos, size, n, choices, style, validator, name);
41 }
42 virtual ~wxListBox();
43
44 bool Create(wxWindow *parent, wxWindowID id,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 int n = 0, const wxString choices[] = (const wxString *) NULL,
48 long style = 0,
49 const wxValidator& validator = wxDefaultValidator,
50 const wxString& name = wxListBoxNameStr);
51
2ee3ee1b
VZ
52 // implement base class pure virtuals
53 virtual void Clear();
54 virtual void Delete(int n);
55
56 virtual int GetCount() const;
57 virtual wxString GetString(int n) const;
58 virtual void SetString(int n, const wxString& s);
59 virtual int FindString(const wxString& s) const;
60
61 virtual bool IsSelected(int n) const;
62 virtual void SetSelection(int n, bool select = TRUE);
63 virtual int GetSelection() const;
64 virtual int GetSelections(wxArrayInt& aSelections) const;
65
66 virtual int DoAppend(const wxString& item);
67 virtual void DoInsertItems(const wxArrayString& items, int pos);
68 virtual void DoSetItems(const wxArrayString& items, void **clientData);
69
70 virtual void DoSetFirstItem(int n);
71
6c8a980f
VZ
72 virtual void DoSetItemClientData(int n, void* clientData);
73 virtual void* DoGetItemClientData(int n) const;
74 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
75 virtual wxClientData* DoGetItemClientObject(int n) const;
2ee3ee1b
VZ
76
77 // implementation from now on
c801d85f 78
06cfab17 79#if wxUSE_DRAG_AND_DROP
ff8bfdbb 80 void SetDropTarget( wxDropTarget *dropTarget );
ac57418f 81#endif
debe6624 82
953704c1
RR
83 void DisableEvents();
84 void EnableEvents();
2ee3ee1b 85 void AppendWithoutSorting( const wxString &item );
ff8bfdbb
VZ
86 int GetIndex( GtkWidget *item ) const;
87 GtkWidget *GetConnectWidget();
88 bool IsOwnGtkWindow( GdkWindow *window );
89 void ApplyWidgetStyle();
5e014a0c 90 void OnInternalIdle();
ff8bfdbb
VZ
91
92#if wxUSE_TOOLTIPS
4de6207a 93 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
ff8bfdbb
VZ
94#endif // wxUSE_TOOLTIPS
95
96 GtkList *m_list;
2ee3ee1b 97 wxList m_clientData;
88ac883a
VZ
98
99#if wxUSE_CHECKLISTBOX
ff8bfdbb 100 bool m_hasCheckBoxes;
88ac883a 101#endif // wxUSE_CHECKLISTBOX
c801d85f 102
2ee3ee1b
VZ
103private:
104 // this array is only used for controls with wxCB_SORT style, so only
105 // allocate it if it's needed (hence using pointer)
106 wxSortedArrayString *m_strings;
107
108 DECLARE_DYNAMIC_CLASS(wxListBox)
109};
dcf924a3 110
c801d85f 111#endif // __GTKLISTBOXH__