]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/listbox.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxListBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_LISTBOX_H_
13 #define _WX_LISTBOX_H_
16 #pragma interface "listbox.h"
19 #include "wx/control.h"
21 WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr
;
23 // forward decl for GetSelections()
24 class WXDLLEXPORT wxArrayInt
;
26 WXDLLEXPORT_DATA(extern const char*) wxEmptyString
;
29 class WXDLLEXPORT wxListBox
: public wxControl
31 DECLARE_DYNAMIC_CLASS(wxListBox
)
35 inline wxListBox(wxWindow
*parent
, wxWindowID id
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
,
38 int n
= 0, const wxString choices
[] = NULL
,
40 const wxValidator
& validator
= wxDefaultValidator
,
41 const wxString
& name
= wxListBoxNameStr
):
42 m_clientDataList(wxKEY_INTEGER
)
44 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
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
,
52 const wxValidator
& validator
= wxDefaultValidator
,
53 const wxString
& name
= wxListBoxNameStr
);
57 virtual void Append(const wxString
& item
);
58 virtual void Append(const wxString
& item
, char *clientData
);
59 virtual void Set(int n
, const wxString
* choices
, char **clientData
= NULL
);
60 virtual int FindString(const wxString
& s
) const ;
62 virtual void SetSelection(int n
, bool select
= TRUE
);
64 virtual void Deselect(int n
);
66 // For single choice list item only
67 virtual int GetSelection() const ;
68 virtual void Delete(int n
);
69 virtual char *GetClientData(int n
) const ;
70 virtual void *GetClientData() { return wxWindow::GetClientData(); }
71 virtual void SetClientData(int n
, char *clientData
);
72 virtual void SetClientData( void *data
) { wxWindow::SetClientData(data
); }
73 virtual void SetString(int n
, const wxString
& s
);
75 // For single or multiple choice list item
76 virtual int GetSelections(wxArrayInt
& aSelections
) const;
77 virtual bool Selected(int n
) const ;
78 virtual wxString
GetString(int n
) const ;
80 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
81 virtual void SetSize(const wxRect
& rect
, int sizeFlags
= wxSIZE_AUTO
)
82 { wxWindow::SetSize(rect
, sizeFlags
); }
83 virtual void SetSize(const wxSize
& size
) { wxWindow::SetSize(size
); }
84 virtual void SetSize(int width
, int height
) { SetSize(-1, -1, width
, height
, wxSIZE_USE_EXISTING
); }
86 // Set the specified item at the first visible item
87 // or scroll to max range.
88 virtual void SetFirstItem(int n
) ;
89 virtual void SetFirstItem(const wxString
& s
) ;
91 virtual void InsertItems(int nItems
, const wxString items
[], int pos
);
93 virtual wxString
GetStringSelection() const ;
94 virtual bool SetStringSelection(const wxString
& s
, bool flag
= TRUE
);
95 virtual int Number() const ;
97 void Command(wxCommandEvent
& event
);
100 virtual void ChangeFont(bool keepOriginalSize
= TRUE
);
101 virtual void ChangeBackgroundColour();
102 virtual void ChangeForegroundColour();
103 WXWidget
GetTopWidget() const;
109 // List mapping positions->client data
110 wxList m_clientDataList
;