]>
Commit | Line | Data |
---|---|---|
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 | m_hasCheckBoxes = FALSE; | |
55 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
56 | } | |
57 | virtual ~wxListBox(); | |
58 | ||
59 | bool Create(wxWindow *parent, wxWindowID id, | |
60 | const wxPoint& pos = wxDefaultPosition, | |
61 | const wxSize& size = wxDefaultSize, | |
62 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
63 | long style = 0, | |
64 | const wxValidator& validator = wxDefaultValidator, | |
65 | const wxString& name = wxListBoxNameStr); | |
66 | ||
67 | void Append( const wxString &item ); | |
68 | void Append( const wxString &item, void* clientData ); | |
69 | void Append( const wxString &item, wxClientData* clientData ); | |
70 | ||
71 | void InsertItems(int nItems, const wxString items[], int pos); | |
72 | ||
73 | void SetClientData( int n, void* clientData ); | |
74 | void* GetClientData( int n ); | |
75 | void SetClientObject( int n, wxClientData* clientData ); | |
76 | wxClientData* GetClientObject( int n ); | |
77 | ||
78 | void Clear(); | |
79 | void Delete( int n ); | |
80 | ||
81 | void Deselect( int n ); | |
82 | int FindString( const wxString &item ) const; | |
83 | int GetSelection(void) const; | |
84 | int GetSelections( class wxArrayInt &) const; | |
85 | wxString GetString( int n ) const; | |
86 | wxString GetStringSelection(void) const; | |
87 | int Number(); | |
88 | bool Selected( int n ); | |
89 | void Set( int n, const wxString *choices ); | |
90 | void SetFirstItem( int n ); | |
91 | void SetFirstItem( const wxString &item ); | |
92 | void SetSelection( int n, bool select = TRUE ); | |
93 | void SetString( int n, const wxString &string ); | |
94 | void SetStringSelection( const wxString &string, bool select = TRUE ); | |
95 | ||
96 | #if wxUSE_DRAG_AND_DROP | |
97 | void SetDropTarget( wxDropTarget *dropTarget ); | |
98 | #endif | |
99 | ||
100 | // implementation | |
101 | ||
102 | void AppendCommon( const wxString &item ); | |
103 | int GetIndex( GtkWidget *item ) const; | |
104 | GtkWidget *GetConnectWidget(); | |
105 | bool IsOwnGtkWindow( GdkWindow *window ); | |
106 | void ApplyWidgetStyle(); | |
107 | ||
108 | #if wxUSE_TOOLTIPS | |
109 | void ApplyToolTip( GtkTooltips *tips, const char *tip ); | |
110 | #endif // wxUSE_TOOLTIPS | |
111 | ||
112 | GtkList *m_list; | |
113 | wxList m_clientDataList; | |
114 | wxList m_clientObjectList; | |
115 | bool m_hasCheckBoxes; | |
116 | }; | |
117 | ||
118 | #endif // __GTKLISTBOXH__ |