]>
Commit | Line | Data |
---|---|---|
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 | ||
30 | class wxListBox; | |
a3622daa | 31 | class wxArrayInt; |
c801d85f KB |
32 | |
33 | //----------------------------------------------------------------------------- | |
34 | // global data | |
35 | //----------------------------------------------------------------------------- | |
36 | ||
37 | extern const char *wxListBoxNameStr; | |
38 | ||
39 | //----------------------------------------------------------------------------- | |
40 | // wxListBox | |
41 | //----------------------------------------------------------------------------- | |
42 | ||
fd0eed64 | 43 | class wxListBox : public wxControl |
c801d85f | 44 | { |
ff8bfdbb | 45 | DECLARE_DYNAMIC_CLASS(wxListBox) |
c801d85f | 46 | |
fd0eed64 | 47 | public: |
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; | |
93 | int GetSelection(void) const; | |
94 | int GetSelections( class wxArrayInt &) const; | |
95 | wxString GetString( int n ) const; | |
96 | wxString GetStringSelection(void) const; | |
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 | ||
112 | void AppendCommon( const wxString &item ); | |
113 | int GetIndex( GtkWidget *item ) const; | |
114 | GtkWidget *GetConnectWidget(); | |
115 | bool IsOwnGtkWindow( GdkWindow *window ); | |
116 | void ApplyWidgetStyle(); | |
117 | ||
118 | #if wxUSE_TOOLTIPS | |
4de6207a | 119 | void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); |
ff8bfdbb VZ |
120 | #endif // wxUSE_TOOLTIPS |
121 | ||
122 | GtkList *m_list; | |
123 | wxList m_clientDataList; | |
124 | wxList m_clientObjectList; | |
88ac883a VZ |
125 | |
126 | #if wxUSE_CHECKLISTBOX | |
ff8bfdbb | 127 | bool m_hasCheckBoxes; |
88ac883a | 128 | #endif // wxUSE_CHECKLISTBOX |
c801d85f KB |
129 | }; |
130 | ||
dcf924a3 RR |
131 | #endif |
132 | ||
c801d85f | 133 | #endif // __GTKLISTBOXH__ |