]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/listbox.h
pass correct key code in TREE_KEY_DOWN event
[wxWidgets.git] / include / wx / motif / listbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: listbox.h
3 // Purpose: wxListBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_LISTBOX_H_
13 #define _WX_LISTBOX_H_
14
15 #ifdef __GNUG__
16 #pragma interface "listbox.h"
17 #endif
18
19 #include "wx/ctrlsub.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr;
22
23 // forward decl for GetSelections()
24 class WXDLLEXPORT wxArrayInt;
25
26 WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
27
28 // List box item
29 class WXDLLEXPORT wxListBox: public wxListBoxBase
30 {
31 DECLARE_DYNAMIC_CLASS(wxListBox)
32
33 public:
34 wxListBox();
35 wxListBox(wxWindow *parent, wxWindowID id,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 int n = 0, const wxString choices[] = NULL,
39 long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxListBoxNameStr):
42 m_clientDataList(wxKEY_INTEGER)
43 {
44 Create(parent, id, pos, size, n, choices, style, validator, name);
45 }
46
47 bool Create(wxWindow *parent, wxWindowID id,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 int n = 0, const wxString choices[] = NULL,
51 long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = wxListBoxNameStr);
54
55 ~wxListBox();
56
57 // Virtual functions required by wxControlWithItems.
58 // They are not all implemented yet :-(
59 virtual int GetCount() const;
60 virtual int DoAppend(const wxString& item);
61 virtual void DoInsertItems(const wxArrayString& items, int pos);
62 virtual void DoSetItems(const wxArrayString& items, void **clientData);
63 virtual void DoSetFirstItem(int n);
64 virtual void DoSetItemClientData(int n, void* clientData);
65 virtual void* DoGetItemClientData(int n) const;
66 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
67 virtual wxClientData* DoGetItemClientObject(int n) const;
68 virtual void Select(int n);
69
70 virtual void Append(const wxString& item);
71 virtual void Append(const wxString& item, void *clientData);
72 virtual void Set(int n, const wxString* choices, void **clientData = NULL);
73 virtual int FindString(const wxString& s) const ;
74 virtual void Clear();
75 virtual void SetSelection(int n, bool select = TRUE);
76
77 virtual void Deselect(int n);
78
79 // For single choice list item only
80 virtual int GetSelection() const ;
81 virtual void Delete(int n);
82 virtual void *GetClientData(int n) const ;
83 virtual void *GetClientData() { return wxWindow::GetClientData(); }
84 virtual void SetClientData(int n, void *clientData);
85 virtual void SetClientData( void *data ) { wxWindow::SetClientData(data); }
86 virtual void SetString(int n, const wxString& s);
87
88 // For single or multiple choice list item
89 virtual int GetSelections(wxArrayInt& aSelections) const;
90 virtual bool IsSelected(int n) const ;
91 virtual wxString GetString(int n) const ;
92
93 // Set the specified item at the first visible item
94 // or scroll to max range.
95 virtual void SetFirstItem(int n) ;
96 virtual void SetFirstItem(const wxString& s) ;
97
98 virtual void InsertItems(int nItems, const wxString items[], int pos);
99
100 virtual wxString GetStringSelection() const ;
101 virtual bool SetStringSelection(const wxString& s, bool flag = TRUE);
102 virtual int Number() const ;
103
104 void Command(wxCommandEvent& event);
105
106 // Implementation
107 virtual void ChangeFont(bool keepOriginalSize = TRUE);
108 virtual void ChangeBackgroundColour();
109 virtual void ChangeForegroundColour();
110 WXWidget GetTopWidget() const;
111
112 protected:
113 int m_noItems;
114 int m_selected;
115
116 // List mapping positions->client data
117 wxList m_clientDataList;
118
119 virtual void DoSetSize(int x, int y,
120 int width, int height,
121 int sizeFlags = wxSIZE_AUTO);
122 };
123
124 #endif
125 // _WX_LISTBOX_H_