]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/listbox.h
Added wxGTK-only cmn dialogs.
[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
20 #if wxUSE_LISTBOX
21
22 #include "wx/object.h"
23 #include "wx/list.h"
24 #include "wx/control.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class wxListBox;
31 class wxArrayInt;
32
33 //-----------------------------------------------------------------------------
34 // global data
35 //-----------------------------------------------------------------------------
36
37 extern const char *wxListBoxNameStr;
38
39 //-----------------------------------------------------------------------------
40 // wxListBox
41 //-----------------------------------------------------------------------------
42
43 class wxListBox : public wxControl
44 {
45 DECLARE_DYNAMIC_CLASS(wxListBox)
46
47 public:
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 {
57 #if wxUSE_CHECKLISTBOX
58 m_hasCheckBoxes = FALSE;
59 #endif // wxUSE_CHECKLISTBOX
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
76 void InsertItems(int nItems, const wxString items[], int pos);
77
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
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
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 );
105
106 #if wxUSE_DRAG_AND_DROP
107 void SetDropTarget( wxDropTarget *dropTarget );
108 #endif
109
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
119 void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
120 #endif // wxUSE_TOOLTIPS
121
122 GtkList *m_list;
123 wxList m_clientDataList;
124 wxList m_clientObjectList;
125
126 #if wxUSE_CHECKLISTBOX
127 bool m_hasCheckBoxes;
128 #endif // wxUSE_CHECKLISTBOX
129 };
130
131 #endif
132
133 #endif // __GTKLISTBOXH__