]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/listbox.h
HTML_xxxx constants changed to wxHTML_xxxx (with backward compatibility through WXWIN...
[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
18#include "wx/defs.h"
dcf924a3
RR
19
20#if wxUSE_LISTBOX
21
c801d85f
KB
22#include "wx/object.h"
23#include "wx/list.h"
24#include "wx/control.h"
25
26//-----------------------------------------------------------------------------
27// classes
28//-----------------------------------------------------------------------------
29
30class wxListBox;
a3622daa 31class wxArrayInt;
c801d85f
KB
32
33//-----------------------------------------------------------------------------
34// global data
35//-----------------------------------------------------------------------------
36
37extern const char *wxListBoxNameStr;
38
39//-----------------------------------------------------------------------------
40// wxListBox
41//-----------------------------------------------------------------------------
42
fd0eed64 43class wxListBox : public wxControl
c801d85f 44{
ff8bfdbb 45DECLARE_DYNAMIC_CLASS(wxListBox)
c801d85f 46
fd0eed64 47public:
ff8bfdbb
VZ
48 wxListBox();
49 wxListBox( wxWindow *parent, wxWindowID id,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 int n = 0, const wxString choices[] = (const wxString *) NULL,
53 long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxListBoxNameStr )
56 {
88ac883a 57#if wxUSE_CHECKLISTBOX
ff8bfdbb 58 m_hasCheckBoxes = FALSE;
88ac883a 59#endif // wxUSE_CHECKLISTBOX
ff8bfdbb
VZ
60 Create(parent, id, pos, size, n, choices, style, validator, name);
61 }
62 virtual ~wxListBox();
63
64 bool Create(wxWindow *parent, wxWindowID id,
65 const wxPoint& pos = wxDefaultPosition,
66 const wxSize& size = wxDefaultSize,
67 int n = 0, const wxString choices[] = (const wxString *) NULL,
68 long style = 0,
69 const wxValidator& validator = wxDefaultValidator,
70 const wxString& name = wxListBoxNameStr);
71
72 void Append( const wxString &item );
73 void Append( const wxString &item, void* clientData );
74 void Append( const wxString &item, wxClientData* clientData );
75
a994f81b
VZ
76 void InsertItems(int nItems, const wxString items[], int pos);
77
ff8bfdbb
VZ
78 void SetClientData( int n, void* clientData );
79 void* GetClientData( int n );
80 void SetClientObject( int n, wxClientData* clientData );
81 wxClientData* GetClientObject( int n );
82
0de9b5b2
RR
83 void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); }
84 wxClientData *GetClientObject() const { return wxControl::GetClientObject(); }
85 void SetClientData( void *data ) { wxControl::SetClientData( data ); }
86 void *GetClientData() const { return wxControl::GetClientData(); }
87
ff8bfdbb
VZ
88 void Clear();
89 void Delete( int n );
90
91 void Deselect( int n );
92 int FindString( const wxString &item ) const;
fd9811b1 93 int GetSelection() const;
ff8bfdbb
VZ
94 int GetSelections( class wxArrayInt &) const;
95 wxString GetString( int n ) const;
fd9811b1 96 wxString GetStringSelection() const;
ff8bfdbb
VZ
97 int Number();
98 bool Selected( int n );
99 void Set( int n, const wxString *choices );
100 void SetFirstItem( int n );
101 void SetFirstItem( const wxString &item );
102 void SetSelection( int n, bool select = TRUE );
103 void SetString( int n, const wxString &string );
104 void SetStringSelection( const wxString &string, bool select = TRUE );
c801d85f 105
06cfab17 106#if wxUSE_DRAG_AND_DROP
ff8bfdbb 107 void SetDropTarget( wxDropTarget *dropTarget );
ac57418f 108#endif
debe6624 109
ff8bfdbb
VZ
110 // implementation
111
953704c1
RR
112 void DisableEvents();
113 void EnableEvents();
ff8bfdbb
VZ
114 void AppendCommon( const wxString &item );
115 int GetIndex( GtkWidget *item ) const;
116 GtkWidget *GetConnectWidget();
117 bool IsOwnGtkWindow( GdkWindow *window );
118 void ApplyWidgetStyle();
5e014a0c 119 void OnInternalIdle();
ff8bfdbb
VZ
120
121#if wxUSE_TOOLTIPS
4de6207a 122 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
ff8bfdbb
VZ
123#endif // wxUSE_TOOLTIPS
124
125 GtkList *m_list;
126 wxList m_clientDataList;
127 wxList m_clientObjectList;
88ac883a
VZ
128
129#if wxUSE_CHECKLISTBOX
ff8bfdbb 130 bool m_hasCheckBoxes;
88ac883a 131#endif // wxUSE_CHECKLISTBOX
c801d85f
KB
132};
133
dcf924a3
RR
134#endif
135
c801d85f 136#endif // __GTKLISTBOXH__