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