]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/listbox.h
Unicode changes.
[wxWidgets.git] / include / wx / gtk / listbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: listbox.h
3 // Purpose: wxListBox class declaration
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
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;
28 class wxArrayInt;
29
30 //-----------------------------------------------------------------------------
31 // global data
32 //-----------------------------------------------------------------------------
33
34 extern const char *wxListBoxNameStr;
35
36 //-----------------------------------------------------------------------------
37 // wxListBox
38 //-----------------------------------------------------------------------------
39
40 class wxListBox : public wxControl
41 {
42 DECLARE_DYNAMIC_CLASS(wxListBox)
43
44 public:
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 {
54 #if wxUSE_CHECKLISTBOX
55 m_hasCheckBoxes = FALSE;
56 #endif // wxUSE_CHECKLISTBOX
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
73 void InsertItems(int nItems, const wxString items[], int pos);
74
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
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
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 );
102
103 #if wxUSE_DRAG_AND_DROP
104 void SetDropTarget( wxDropTarget *dropTarget );
105 #endif
106
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
116 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
117 #endif // wxUSE_TOOLTIPS
118
119 GtkList *m_list;
120 wxList m_clientDataList;
121 wxList m_clientObjectList;
122
123 #if wxUSE_CHECKLISTBOX
124 bool m_hasCheckBoxes;
125 #endif // wxUSE_CHECKLISTBOX
126 };
127
128 #endif // __GTKLISTBOXH__